Add android:configChanges for SettingsHomepageActivity

When resuming Settings app of large screen devices,
SettingsHomepageActivity will be re-created for
Activity resized. It produces unnecessary Activity
destroy and re-create.

This change prevents SettingsHomepageActivity from
configuration changes for screenSize|screenLayout.

Bug: 198361315
Test: manual
      1. Launch Settings app by a Settings shortcut widget.
      2. Move Settings app to background.
      3. Click Settings shortcut widget again.
         Observe if SettingsHomepageActivity re-creates.
Change-Id: I4d71330f6a1760768ba4443e192f66b0a2cbb6bf
This commit is contained in:
Arc Wang
2021-09-08 10:52:14 +08:00
parent f6a8f6c8af
commit fdfac783ab
2 changed files with 4 additions and 1 deletions

View File

@@ -136,7 +136,7 @@
android:taskAffinity="com.android.settings.root"
android:launchMode="singleTask"
android:exported="true"
android:configChanges="keyboard|keyboardHidden">
android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout">
<intent-filter android:priority="1">
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />

View File

@@ -208,6 +208,9 @@ public class SettingsHomepageActivity extends FragmentActivity implements
return;
}
// To prevent launchDeepLinkIntentToRight again for configuration change.
intent.setAction(null);
targetIntent.setFlags(targetIntent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
targetIntent.putExtra(EXTRA_IS_FROM_SETTINGS_HOMEPAGE, true);