summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2015-02-10 23:59:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-02-10 23:59:46 +0000
commit667d55cf5a06a0e1bd12997fcd494bec52e58ad9 (patch)
tree3f67ae807317fb68adb8a12093ce056c39279959 /core/java/android/os
parente36fe7048e1b5885b9352886f8ddcb3457ab5b1e (diff)
parentfd282ed2f4649cc77127ab15b9167971abb5f379 (diff)
downloadframeworks_base-667d55cf5a06a0e1bd12997fcd494bec52e58ad9.zip
frameworks_base-667d55cf5a06a0e1bd12997fcd494bec52e58ad9.tar.gz
frameworks_base-667d55cf5a06a0e1bd12997fcd494bec52e58ad9.tar.bz2
Merge "check bootloader and baseband version"
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/Build.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index e4b594a..eb86e7e 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -650,15 +650,22 @@ public class Build {
}
/**
- * Check that device fingerprint is defined and that it matches across
- * various partitions.
+ * Verifies the the current flash of the device is consistent with what
+ * was expected at build time.
+ * 1) Checks that device fingerprint is defined and that it matches across
+ * various partitions.
+ * 2) Verifies radio and bootloader partitions are those expected in the build.
*
* @hide
*/
- public static boolean isFingerprintConsistent() {
+ public static boolean isBuildConsistent() {
final String system = SystemProperties.get("ro.build.fingerprint");
final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");
final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint");
+ final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader");
+ final String currentBootloader = SystemProperties.get("ro.bootloader");
+ final String requiredRadio = SystemProperties.get("ro.build.expect.baseband");
+ final String currentRadio = SystemProperties.get("gsm.version.baseband");
if (TextUtils.isEmpty(system)) {
Slog.e(TAG, "Required ro.build.fingerprint is empty!");
@@ -681,6 +688,22 @@ public class Build {
}
}
+ if (!TextUtils.isEmpty(requiredBootloader)) {
+ if (!Objects.equals(currentBootloader, requiredBootloader)) {
+ Slog.e(TAG, "Mismatched bootloader version: build requires " + requiredBootloader
+ + " but runtime reports " + currentBootloader);
+ return false;
+ }
+ }
+
+ if (!TextUtils.isEmpty(requiredRadio)) {
+ if (!Objects.equals(currentRadio, requiredRadio)) {
+ Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio
+ + " but runtime reports " + currentRadio);
+ return false;
+ }
+ }
+
return true;
}