| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.base; | 5 package org.chromium.base; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.pm.ApplicationInfo; | 8 import android.content.pm.ApplicationInfo; |
| 9 import android.content.pm.PackageInfo; | 9 import android.content.pm.PackageInfo; |
| 10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
| 11 import android.content.pm.PackageManager.NameNotFoundException; | 11 import android.content.pm.PackageManager.NameNotFoundException; |
| 12 import android.os.Build; | 12 import android.os.Build; |
| 13 import android.util.Log; | 13 import android.util.Log; |
| 14 | 14 |
| 15 import org.chromium.base.CalledByNative; | |
| 16 | |
| 17 /** | 15 /** |
| 18 * BuildInfo is a utility class providing easy access to {@link PackageInfo} | 16 * BuildInfo is a utility class providing easy access to {@link PackageInfo} |
| 19 * information. This is primarly of use for accessesing package information | 17 * information. This is primarly of use for accessesing package information |
| 20 * from native code. | 18 * from native code. |
| 21 */ | 19 */ |
| 22 public class BuildInfo { | 20 public class BuildInfo { |
| 23 private static final String TAG = "BuildInfo"; | 21 private static final String TAG = "BuildInfo"; |
| 24 private static final int MAX_FINGERPRINT_LENGTH = 128; | 22 private static final int MAX_FINGERPRINT_LENGTH = 128; |
| 25 | 23 |
| 26 /** | 24 /** |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 public static String getPackageName(Context context) { | 106 public static String getPackageName(Context context) { |
| 109 String packageName = context != null ? context.getPackageName() : null; | 107 String packageName = context != null ? context.getPackageName() : null; |
| 110 return packageName != null ? packageName : ""; | 108 return packageName != null ? packageName : ""; |
| 111 } | 109 } |
| 112 | 110 |
| 113 @CalledByNative | 111 @CalledByNative |
| 114 public static int getSdkInt() { | 112 public static int getSdkInt() { |
| 115 return Build.VERSION.SDK_INT; | 113 return Build.VERSION.SDK_INT; |
| 116 } | 114 } |
| 117 } | 115 } |
| OLD | NEW |