1. Problem scenario:
Our product is based on aosp 4.4. When I build the whole system with the addition of the ar_EG locale to our product, there will be an error log during the first boot procedure, in addition, if I create a system without the ar_EG locale, the problem will not work.
01-01 08:01:38.711 W/PackageParser( 529): /system/app/Email.apk (at Binary XML file line #357): <provider> does not include authorities attribute
And this error will lead to the e-mail application dysfunction, at the end there will be a dialogue message about Exchange failure. Crash log below:
01-01 09:18:53.475 E/AndroidRuntime( 982): FATAL EXCEPTION: main
01-01 09:18:53.475 E/AndroidRuntime( 982): Process: com.android.exchange, PID: 982
01-01 09:18:53.475 E/AndroidRuntime( 982): java.lang.RuntimeException: Unable to create application com.android.exchange.Exchange: java.lang.IllegalArgumentException: Unknown URI content://com.android.email.provider
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4331)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.os.Handler.dispatchMessage(Handler.java:102)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.os.Looper.loop(Looper.java:136)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.ActivityThread.main(ActivityThread.java:5008)
01-01 09:18:53.475 E/AndroidRuntime( 982): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 09:18:53.475 E/AndroidRuntime( 982): at java.lang.reflect.Method.invoke(Method.java:515)
01-01 09:18:53.475 E/AndroidRuntime( 982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
01-01 09:18:53.475 E/AndroidRuntime( 982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
01-01 09:18:53.475 E/AndroidRuntime( 982): at dalvik.system.NativeStart.main(Native Method)
01-01 09:18:53.475 E/AndroidRuntime( 982): Caused by: java.lang.IllegalArgumentException: Unknown URI content://com.android.email.provider
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.content.ContentResolver.call(ContentResolver.java:1352)
01-01 09:18:53.475 E/AndroidRuntime( 982): at com.android.exchange.Exchange.onCreate(Exchange.java:34)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
01-01 09:18:53.475 E/AndroidRuntime( 982): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
01-01 09:18:53.475 E/AndroidRuntime( 982): ... 10 more
2. My research
Firstly, I have to say that the electronic AndroidManifest.xml is not touched, I just add some Arabic lines to the email.
I tracked the associated source code in $ (aosp_dir) /frameworks/base/core/java/android/content/pm/PackageParser.java inside a function called:
private Provider parseProvider(Package owner, Resources res,
XmlPullParser parser, AttributeSet attrs, int flags, String[] outError)
, Email Androidmanifest.xml:
String cpname = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifestProvider_authorities, 0);
NULL, .
, , getNonConfigurationString null, , TypedArray parseProvider :
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestProvider);
"TypedArray sa" - , , com.android.internal.R.styleable.AndroidManifestProvider_authorities , 10- , sa : AR_EG AR_EG. :
The successful case: 3, 188, -1, 0, 0, 0,
The failed case: 3, 1127, 2, 2131362092, 4, 0
, STYLE_CHANGING_CONFIGURATIONS, , 4, , sa.getNonConfigurationString return null.
:
android_content_AssetManager_retrieveAttributes in frameworks\base\core\jni\android_util_AssetManager.cpp
||
||
\/
ResTable::resolveReference in frameworks\base\libs\androidfw\ResourceTypes.cpp
||
||
\/
ResTable::getResource in frameworks\base\libs\androidfw\ResourceTypes.cpp
, SpecFlags struct ResTable:: Type finally.
3.
, stackoverflow, , , , , . , typeSpecFlags struct ResTable:: Type, , . , . !