Merge "Prevent crash on SIM Lock settings while rotating" into main
diff --git a/res/values/config.xml b/res/values/config.xml
index d084ff9..d0cd96b 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -38,6 +38,11 @@
     <!-- Whether to show Camera laser sensor switch in Developer Options -->
     <bool name="config_show_camera_laser_sensor">false</bool>
 
+    <!-- Intent action to open Avatar Picker app -->
+    <string name="config_avatar_picker_action" translatable="false">
+        com.android.avatarpicker.FULL_SCREEN_ACTIVITY
+    </string>
+
     <!-- Package name and fully-qualified class name for the wallpaper picker activity. -->
     <string name="config_wallpaper_picker_package" translatable="false">com.android.settings</string>
     <string name="config_wallpaper_picker_class" translatable="false">com.android.settings.Settings$WallpaperSettingsActivity</string>
diff --git a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
index 3b79b47..50134ba 100644
--- a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
+++ b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
@@ -34,6 +34,7 @@
 import androidx.window.embedding.SplitPlaceholderRule;
 import androidx.window.embedding.SplitRule;
 
+import com.android.settings.R;
 import com.android.settings.Settings;
 import com.android.settings.SettingsActivity;
 import com.android.settings.SubSettings;
@@ -261,8 +262,13 @@
         addActivityFilter(activityFilters, FaceEnrollIntroduction.class);
         addActivityFilter(activityFilters, RemoteAuthActivity.class);
         addActivityFilter(activityFilters, RemoteAuthActivityInternal.class);
-        addActivityFilter(activityFilters, AvatarPickerActivity.class);
         addActivityFilter(activityFilters, ChooseLockPattern.class);
+        if (android.multiuser.Flags.avatarSync()) {
+            String action = mContext.getString(R.string.config_avatar_picker_action);
+            addActivityFilter(activityFilters, new Intent(action));
+        } else {
+            addActivityFilter(activityFilters, AvatarPickerActivity.class);
+        }
         ActivityRule activityRule = new ActivityRule.Builder(activityFilters).setAlwaysExpand(true)
                 .build();
         mRuleController.addRule(activityRule);
diff --git a/src/com/android/settings/spa/app/appinfo/AppButtons.kt b/src/com/android/settings/spa/app/appinfo/AppButtons.kt
index 403263c..c0fa313 100644
--- a/src/com/android/settings/spa/app/appinfo/AppButtons.kt
+++ b/src/com/android/settings/spa/app/appinfo/AppButtons.kt
@@ -63,7 +63,7 @@
 
     @Composable
     private fun getActionButtons(app: ApplicationInfo): List<ActionButton> = listOfNotNull(
-        if (featureFlags.archiving()) {
+        if (isArchivingEnabled(featureFlags)) {
             if (app.isArchived) {
                 appRestoreButton.getActionButton(app)
             } else {
diff --git a/src/com/android/settings/spa/app/appinfo/AppInfoSettings.kt b/src/com/android/settings/spa/app/appinfo/AppInfoSettings.kt
index 85e59de..9291892 100644
--- a/src/com/android/settings/spa/app/appinfo/AppInfoSettings.kt
+++ b/src/com/android/settings/spa/app/appinfo/AppInfoSettings.kt
@@ -125,7 +125,7 @@
         title = stringResource(R.string.application_info_label),
         actions = {
             packageInfoState.value?.applicationInfo?.let { app ->
-                if (featureFlags.archiving()) TopBarAppLaunchButton(packageInfoPresenter, app)
+                if (isArchivingEnabled(featureFlags)) TopBarAppLaunchButton(packageInfoPresenter, app)
                 AppInfoSettingsMoreOptions(packageInfoPresenter, app)
             }
         }
@@ -174,3 +174,6 @@
         appInfoProvider.FooterAppVersion()
     }
 }
+
+fun isArchivingEnabled(featureFlags: FeatureFlags) =
+        featureFlags.archiving() || "true" == System.getProperty("pm.archiving.enabled")
diff --git a/src/com/android/settings/spa/app/appinfo/PackageInfoPresenter.kt b/src/com/android/settings/spa/app/appinfo/PackageInfoPresenter.kt
index 8c802d1..230ccb9 100644
--- a/src/com/android/settings/spa/app/appinfo/PackageInfoPresenter.kt
+++ b/src/com/android/settings/spa/app/appinfo/PackageInfoPresenter.kt
@@ -166,7 +166,7 @@
             flags = PackageManager.MATCH_ANY_USER.toLong() or
                 PackageManager.MATCH_DISABLED_COMPONENTS.toLong() or
                 PackageManager.GET_PERMISSIONS.toLong() or
-                if (featureFlags.archiving()) PackageManager.MATCH_ARCHIVED_PACKAGES else 0,
+                if (isArchivingEnabled(featureFlags)) PackageManager.MATCH_ARCHIVED_PACKAGES else 0,
             userId = userId,
         )
 }