Dev_Cob
Dev_Cob

Reputation: 111

How to avoid activity recreation due to change in CONFIG_ASSETS_PATHS?

After reboot the LauncherActivity is created. Then following a config change the activity is destroyed and recreated. I could in the log that ActivityTaskManager: Config changes=80000000 is printed. As per the definition, CONFIG_ASSETS_PATHS is 80000000.

If the LauncherActivity is recreated without restarting the process, it gets issues like duplicate widgets in 2 pages. The intention is that the activity should not be recreated. So all possible configs are mentioned in android:configChanges.

From the old answer it is understood that the CONFIG_ASSETS_PATHS config cannot be blocked via android:configChanges in manifest.

How to avoid recreation of activity due to change in CONFIG_ASSETS_PATHS?

    /**
 * Bit in {@link #configChanges} that indicates that the activity
 * can itself handle asset path changes.  Set from the {@link android.R.attr#configChanges}
 * attribute. This is not a core resource configuration, but a higher-level value, so its
 * constant starts at the high bits.
 * @hide We do not want apps handling this yet, but we do need some kind of bit for diffs.
 */
public static final int CONFIG_ASSETS_PATHS = 0x80000000;

Log reference:

I WindowManager: finishDrawing of relaunch: Window{495529e u10 .apps.homescreen/.apps.homescreen.ui.LauncherActivity} 24ms

I ActivityTaskManager: Config changes=80000000 {1.0 ?mcc?mnc [en_GB] ldltr sw720dp w1280dp h548dp 160dpi lrg land car finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1280, 720) mAppBounds=Rect(0, 0 - 1280, 624) mMaxBounds=Rect(0, 0 - 1280, 720) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.3 s.105 fontWeightAdjustment=0}

I WindowManager: Override config changes=80000000 {1.0 ?mcc?mnc [en_GB] ldltr sw720dp w1280dp h548dp 160dpi lrg land car finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1280, 720) mAppBounds=Rect(0, 0 - 1280, 624) mMaxBounds=Rect(0, 0 - 1280, 720) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.3 s.105 fontWeightAdjustment=0} for displayId=0

Upvotes: 1

Views: 18

Answers (0)

Related Questions