修改了frameworks/base/core/java/android/content/res/Configuration.java
float fontSize = Float.parseFloat(SystemProperties.get("ro.sys.font.default", "1.0")); 后无法开机,打印如下log
No implementation found for
java.lang.String android.os.SystemProperties.native_get(java.lang.String)
(tried Java_android_os_SystemProperties_native_1get and Java_android_os_SystemProperties_native_1get__Ljava_lang_String_2
开始以为是平台的代码写的有漏洞,对比了5.1的相关代码,发现代码没有问题;于是认为是property_service么有启动,于是查了一下system/init下的相关代码,发现也没有问题,并且adb shell getprop 都能正常显示,说明底下的服务没问题,那就只能是jni有问题,查找了一下资料,对照代码,发现问题出在
frameworks/base/core/jni/AndroidRuntime.cpp
static const RegJNIRec gRegJNI[] = {
...
REG_JNI(register_com_android_internal_os_RuntimeInit),
REG_JNI(register_android_os_SystemClock),
REG_JNI(register_android_util_EventLog),
REG_JNI(register_android_util_Log),
REG_JNI(register_android_util_MemoryIntArray),
REG_JNI(register_android_util_PathParser),
REG_JNI(register_android_app_admin_SecurityLog),
REG_JNI(register_com_mediatek_perfservice_PerfServiceWrapper),
REG_JNI(register_android_content_AssetManager),
REG_JNI(register_android_content_StringBlock),
REG_JNI(register_android_content_XmlBlock),
REG_JNI(register_android_text_AndroidCharacter),
REG_JNI(register_android_text_StaticLayout),
REG_JNI(register_android_text_AndroidBidi),
REG_JNI(register_android_view_InputDevice),
REG_JNI(register_android_view_KeyCharacterMap),
REG_JNI(register_android_os_Process),
REG_JNI(register_android_os_SystemProperties), // 该句注册晚了,导致register_android_content_AssetManager此处调用configuration中调用SystemProperties.get失败,把该句挪到register_android_content_AssetManager即可解决问题
...
}