The first stage
- First determine the time point of relaunch in the event log
08-11 15:40:11.327 1000 1709 4746 I wm_relaunch_resume_activity: [0,133396621,3,com.android.xxx/.XXX]
- Look forward to
the time point near the configuration_changed related log in the corresponding event log. If you can’t find it before, please go to the second stage below.
08-11 15:40:11.051 1000 1709 4746 I configuration_changed: 4
- Convert the config value in 2 to hexadecimal, and find the corresponding config name in attrs_manifest.xml. The
above 4 converted to hexadecimal is 0x0004, which corresponds to the locale in the android function manifest file
<attr name="configChanges">
<flag name="mcc" value="0x0001" />
<flag name="mnc" value="0x0002" />
<flag name="locale" value="0x0004" />
<flag name="touchscreen" value="0x0008" />
<flag name="keyboard" value="0x0010" />
<flag name="keyboardHidden" value="0x0020" />
<flag name="navigation" value="0x0040" />
<flag name="orientation" value="0x0080" />
<flag name="screenLayout" value="0x0100" />
<flag name="uiMode" value="0x0200" />
<flag name="screenSize" value="0x0400" />
<flag name="smallestScreenSize" value="0x0800" />
<flag name="density" value="0x1000" />
<flag name="layoutDirection" value="0x2000" />
<flag name="colorMode" value="0x4000" />
<flag name="fontScale" value="0x40000000" />
<flag name="fontWeightAdjustment" value="0x10000000" />
</attr>
- The configuration in the function manifest file
does not take effect after restarting the configuration to avoid the Activity, please go to the third stage
<activity
android:name=".XXXActivity"
android:configChanges="locale"/>
second stage
If the relaunch page is not in the foreground when the config changes, it will trigger the activity's relaunch when the page resumes again
- Search for the latest configuration_changed forward without looking at the time
// config发生在2min前
08-11 15:40:11.051 1000 1709 4746 I configuration_changed: 4
// 再次resume该页面
08-11 15:42:04.763 1000 1709 3335 I wm_set_resumed_activity: [0,com.android.settings/.XXX,resumeTopActivity]
// 同一system server线程触发relaunch
08-11 15:42:04.770 1000 1709 3335 I wm_relaunch_resume_activity: [0,88191110,3,com.android.settings/.XXX]
- Repeat operations 3 and 4 of the first stage
The third phase
After the configuration does not take effect, the relaunch of the page still occurs
- Determine whether the configuration takes effect.
The target Activity is not executed before finishadb shell dumpsys activity a >a.txt
. Check whether the configChanges value of the target Activity is consistent with expectations, and determine whether the corresponding modification is carried in the Rom.
* Hist #4: ActivityRecord{
541b086 u0 com.android.settings/.XXX t3}
packageName=com.android.settings processName=com.android.settings
launchedFromUid=1000 launchedFromPackage=com.android.provision launchedFromFeature=null userId=0
app=ProcessRecord{
74745ed 16242:com.android.settings/1000}
Intent {
cmp=com.android.settings/.XXX }
........
configChanges=0xfa7 // 确定跟功能清单文件是否一致
neverSandboxDisplayApis=false
alwaysSandboxDisplayApis=false
areBoundsLetterboxed=false
- Check if there are other missing config changes. After
executingadb shell wm logging enable-text WM_DEBUG_CONFIGURATION
the command, re-line the problem and grab bugreoprt - Find the corresponding time point according to 1 and 2 of the first stage, and look for "allChanges" in the main log
08-11 15:42:04.763 1000 1709 3335 I wm_set_resumed_activity: [0,com.android.settings/.SetUpNewFingerprintInternalActivity,resumeTopActivity]
// 包括两个config,缺一不可 {CONFIG_LOCALE, CONFIG_LAYOUT_DIRECTION}
08-11 15:42:04.770 1000 1709 3335 V WindowManager: Configuration changes for ActivityRecord{
541b086 u0 com.android.settings/.SetUpNewFingerprintInternalActivity t3}, allChanges={
CONFIG_LOCALE, CONFIG_LAYOUT_DIRECTION}
08-11 15:42:04.770 1000 1709 3335 I wm_relaunch_resume_activity: [0,88191110,3,com.android.settings/.SetUpNewFingerprintInternalActivity]
- Repeat operations 3 and 4 of the first stage to add missing configChanges