您的设备内部出现了问题。请联系您的设备制造商了解详情。
1. 文件:frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java中判断Build.isBuildConsistent的值进行检查
15411 public void systemReady(final Runnable goingCallback, TimingsTraceLog traceLog) {
……
5601 if (!Build.isBuildConsistent()) {
15602 Slog.e(TAG, "Build fingerprint is not consistent, warning user");
15603 mUiHandler.obtainMessage(SHOW_FINGERPRINT_ERROR_UI_MSG).sendToTarget();
15604 }
……
- isBuildConsistent函数在frameworks/base/core/java/android/os/Build.java中其中IS_TREBLE_ENABLED是进行兼容性判断的关键判断,这个值来自于属性ro.treble.enabled。继续查看发现 int result = VintfObject.verifyWithoutAvb();为判断设备兼容性的关键函数。
962
967 public static final boolean IS_TREBLE_ENABLED =
968 SystemProperties.getBoolean("ro.treble.enabled", false);
969
970
983 public static boolean isBuildConsistent() {
984 // Don't care on eng builds. Incremental build may trigger false negative.
985 if (IS_ENG) return true;
986
987 if (IS_TREBLE_ENABLED) {
988 // If we can run this code, the device should already pass AVB.
989 // So, we don't need to check AVB here.
990 int result = VintfObject.verifyWithoutAvb();
991
992 if (result != 0) {
993 Slog.e(TAG, "Vendor interface is incompatible, error="
994 + String.valueOf(result));
995 }
996
997 return result == 0;
998 }
VintfObject.verifyWithoutAvb()---->
frameworks/base/core/java/android/os/VintfObject.java--->
public static native int verifyWithoutAvb();--->
core/jni/android_os_VintfObject.cpp --->
{"verifyWithoutAvb", "()I", (void*)android_os_VintfObject_verifyWithoutAvb}, ---->
static jint android_os_VintfObject_verifyWithoutAvb(JNIEnv* env, jclass) { ---->
static jint verify(JNIEnv* env, jobjectArray packageInfo, android::vintf::DisabledChecks checks) {--->
int32_t status = VintfObject::CheckCompatibility(cPackageInfo, &error, checks);
VintfObject::CheckCompatibility函数成为了关键函数,继续排查发现在system/libvintf/VintfObject.cpp中,
system/libvintf/VintfObject.cpp--->
return details::checkCompatibility(xmls, false , *details::gPartitionMounter, error,disabledChecks); --->
int32_t checkCompatibility(const std::vector<std::string>& xmls, bool mount,
此时checkCompatibility函数成为了我们的突破口,函数中的判断发现logcat中的关键打印:
"Runtime info and framework compatibility matrix are incompatible: "
在logcat中发现:
W VintfObject: VintfObject.verify() returns 1: Runtime info and framework compatibility matrix are incompatible: For config CONFIG_NFS_FS, value = y but required n
E Build : Vendor interface is incompatible, error=1
E ActivityManager: Build fingerprint is not consistent, warning user
此时找到了关键问题点,就是CONFIG_NFS_FS的不应该为Y应该为N,但是这个是怎么查找到的呢?
if (!updated.runtimeInfo->checkCompatibility(*updated.fwk.matrix, error, disabledChecks)) {---->
RuntimeInfo.cpp ----->
bool RuntimeInfo::checkCompatibility(const CompatibilityMatrix& mat, std::string* error,
现在发现,突然没了头绪,想到了之前error信息:
“For config CONFIG_NFS_FS, value = y but required n”
这个判断肯定是RuntimeInfo::checkCompatibility函数中返回,所以搜了下发现继续进行下去:
if (!matchKernelConfigs(matrixKernel.conditions(), error)) { --->
bool RuntimeInfo::matchKernelConfigs(const std::vector<KernelConfig>& matrixConfigs,
在RuntimeInfo::matchKernelConfigs函数中找到了关键的错误信息打印,并找到对应的判断:
if (!matrixConfig.second.matchValue(kernelValue)) {
到这发现是对kernel的信息进行比对,但是信息从哪里来呢?比对的信息又从哪里来呢?陷入了僵局
进行长时间博客谷歌查找再google的介绍里面找到了关键的兼容性介绍,链接如下:
https://source.android.google.cn/devices/architecture/vintf/match-rules#avb-version
其中内核匹配不就是我们想要的信息:
选择适当的 部分后,对于值不为 n 的每个 项,我们预计对应条目会存在于
/proc/config.gz 中;对于值为 n 的每个 项,我们预计对应条目不会存在于 /proc/config.gz
中。我们预计 的内容与等号后面的文本(包括引号)完全匹配,直到换行符或 #,开头和结尾的空格被截断。
这个config不就是我们想要的信息;
在介绍的开始有一个信息的链接:
https://source.android.google.cn/devices/architecture/vintf/objects#runtime-collectible-information
这个链接里面介绍了相关的清单,和信息来源,此时还是懵逼,不过有个信息很重要:
<!-- Comments, Legal notices, etc. here -->
<manifest version="1.0" type="device" target-level="1">
<!-- hals ommited -->
<kernel version="4.4.176">
<config>
<key>CONFIG_ANDROID</key>
<value>y</value>
</config>
<config>
<key>CONFIG_ARM64</key>
<value>y</value>
</config>
<!-- other configs ommited -->
</kernel>
</manifest>
但是此时我并没有发现他的重要性,不过让我知道了有这个列表,可是这个列表在哪呢?查找了源码还是一无所获
在system/libvintf目录中搜索了下“kernel version”发现不一般了:
test/vintf_object_tests.cpp文件中
1222 //
1223 // Set of framework matrices of different FCM version with <kernel>.
1224 //
1225
1226 #define FAKE_KERNEL(__version__, __key__) \
1227 " <kernel version=\"" __version__ "\">\n" \
1228 " <config>\n" \
1229 " <key>CONFIG_" __key__ "</key>\n" \
1230 " <value type=\"tristate\">y</value>\n" \
1231 " </config>\n" \
1232 " </kernel>\n"
当我看到FAKE_KERNEL定义的时候瞬间通透了,原来他是生成出来的,继续往下看
1234 const static std::vector<std::string> systemMatrixKernelXmls = {
1235 // 1.xml
1236 "<compatibility-matrix version=\"1.0\" type=\"framework\" level=\"1\">\n"
1237 FAKE_KERNEL("1.0.0", "A1")
1238 FAKE_KERNEL("2.0.0", "B1")
1239 "</compatibility-matrix>\n",
1240 // 2.xml
1241 "<compatibility-matrix version=\"1.0\" type=\"framework\" level=\"2\">\n"
1242 FAKE_KERNEL("2.0.0", "B2")
1243 FAKE_KERNEL("3.0.0", "C2")
1244 FAKE_KERNEL("4.0.0", "D2")
1245 "</compatibility-matrix>\n",
1246 // 3.xml
1247 "<compatibility-matrix version=\"1.0\" type=\"framework\" level=\"3\">\n"
1248 FAKE_KERNEL("4.0.0", "D3")
1249 FAKE_KERNEL("5.0.0", "E3")
1250 "</compatibility-matrix>\n",
1251 };
通过这个发现了xml的关键节点,妥了,去编译出来的文件中去查之前的错误CONFIG_NFS_FS
system/etc/vintf/compatibility_matrix.3.xml:972: <key>CONFIG_NFS_FS</key>
system/etc/vintf/compatibility_matrix.3.xml:1758: <key>CONFIG_NFS_FS</key>
system/etc/vintf/compatibility_matrix.3.xml:2552: <key>CONFIG_NFS_FS</key>
system/etc/vintf/compatibility_matrix.2.xml:796: <key>CONFIG_NFS_FS</key>
system/etc/vintf/compatibility_matrix.2.xml:1434: <key>CONFIG_NFS_FS</key>
system/etc/vintf/compatibility_matrix.2.xml:2108: <key>CONFIG_NFS_FS</key>
system/compatibility_matrix.xml:976: <key>CONFIG_NFS_FS</key>
system/compatibility_matrix.xml:1762: <key>CONFIG_NFS_FS</key>
system/compatibility_matrix.xml:2556: <key>CONFIG_NFS_FS</key>
这一瞬间,感觉自己受到了极大的侮辱,原来如此;一切都通透了,一一匹配,对应然后查找
所有的配置中:
<config>
<key>CONFIG_NFS_FS</key>
<value type="tristate">n</value>
</config>
报错了,这下方便了,查找文件生成就好了:
继续查找其中与kernel version匹配的配置,compatibility_matrix.2.xml最为符合查找生成的位置:
hardware/interfaces/compatibility_matrices/Android.mk:
49 include $(CLEAR_VARS)
50 include $(LOCAL_PATH)/clear_vars.mk
51 LOCAL_MODULE := framework_compatibility_matrix.2.xml
52 LOCAL_MODULE_STEM := compatibility_matrix.2.xml
53 LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
54 LOCAL_KERNEL_CONFIG_DATA_PATHS := \
55 3.18.0:$(my_kernel_config_data)/o-mr1/android-3.18 \
56 4.4.0:$(my_kernel_config_data)/o-mr1/android-4.4 \
57 4.9.0:$(my_kernel_config_data)/o-mr1/android-4.9 \
58
59 include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
匹配找到对应的目录,然后进行修改就完事了
感谢博客:https://blog.csdn.net/yekongzhongdexing/article/details/103961461
提供很重要的思路