当前问题:恢复出厂设置重启后,弹出对话框提示:Android System There's an internal problem with your device. Contact your manufacturer for details.
这是因为Google在Android 5.1中添加了一个检查,该检查将/system/build.prop与/vendor/build.prop进行比较,如果它们不匹配,则会显示错误。 为了解决这个问题,你需要在/vendor/build.prop中使用一些值来将它与/system/build.prop文件进行匹配。
经过搜集资料,主要是由于/vendor/build.prop中的ro.vendor.build.fingerprint和/system/build.prop文件中的ro.build.fingerprint属性值不同导致的。
将vendor下的值改成system下的值即可。
/vendor/build.prop:ro.vendor.build.fingerprint=Android/acuteangle/acuteangle:8.1.0/OPM1.171019.011/sgf05301658:userdebug/test-keys
/system/build.prop:ro.build.fingerprint=Android/acuteangle/acuteangle:8.1.0/OPM1.171019.011/sgf05301658:userdebug/test-keys
修改方法如下:
build/make/core/Makefile
$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_system_build_prop)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
$(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
$(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
$(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
#$(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
$(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT)">>$@
从以下源码中也可以看出问题所在。
framework/base/core/java/android/os/Build.java
/**
* Verifies the current flash of the device is consistent with what
* was expected at build time.
*
* Treble devices will verify the Vendor Interface (VINTF). A device
* launched without Treble:
*
* 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 isBuildConsistent() {
// Don't care on eng builds. Incremental build may trigger false negative.
if (IS_ENG) return true;
if (IS_TREBLE_ENABLED) {
int result = VintfObject.verify(new String[0]);
if (result != 0) {
Slog.e(TAG, "Vendor interface is incompatible, error="
+ String.valueOf(result));
}
return result == 0;
}
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!");
return false;
}
if (!TextUtils.isEmpty(vendor)) {
if (!Objects.equals(system, vendor)) {
Slog.e(TAG, "Mismatched fingerprints; system reported " + system
+ " but vendor reported " + vendor);
return false;
}
}
/* TODO: Figure out issue with checks failing
if (!TextUtils.isEmpty(bootimage)) {
if (!Objects.equals(system, bootimage)) {
Slog.e(TAG, "Mismatched fingerprints; system reported " + system
+ " but bootimage reported " + bootimage);
return false;
}
}
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;
}