diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d035d5d8c2d..3d04a37784f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3492,6 +3492,18 @@
android:value="@string/menu_key_notifications"/>
+
+
+
+
+
+
+
+
+
Default apps
+
+ Cloned Apps
Languages, gestures, time, backup
diff --git a/res/xml/apps.xml b/res/xml/apps.xml
index 4dc7c4dc026..8fb72e823be 100644
--- a/res/xml/apps.xml
+++ b/res/xml/apps.xml
@@ -62,6 +62,18 @@
+
+
+
+
+
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 53960b44a8a..342ab7048e7 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -312,6 +312,8 @@ public class Settings extends SettingsActivity {
public static class AppBubbleNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ }
public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
+ /** Activity to manage Cloned Apps page */
+ public static class ClonedAppsListActivity extends SettingsActivity { /* empty */ }
public static class NotificationReviewPermissionsActivity extends SettingsActivity { /* empty */ }
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/applications/ClonedAppsPreferenceController.java b/src/com/android/settings/applications/ClonedAppsPreferenceController.java
new file mode 100644
index 00000000000..76ccf06eb45
--- /dev/null
+++ b/src/com/android/settings/applications/ClonedAppsPreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.applications;
+
+import static com.android.settings.core.SettingsUIDeviceConfig.CLONED_APPS_ENABLED;
+
+import android.content.Context;
+import android.provider.DeviceConfig;
+
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * A preference controller handling the logic for updating the summary of cloned apps.
+ */
+public class ClonedAppsPreferenceController extends BasePreferenceController {
+
+ public ClonedAppsPreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ // todo(b/249916469): Update summary once we have mechanism of allowlisting available
+ // for cloned apps.
+ return null;
+ }
+ @Override
+ public int getAvailabilityStatus() {
+ return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI,
+ CLONED_APPS_ENABLED, false) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+}
diff --git a/src/com/android/settings/core/SettingsUIDeviceConfig.java b/src/com/android/settings/core/SettingsUIDeviceConfig.java
index 94074dfa335..5689067c749 100644
--- a/src/com/android/settings/core/SettingsUIDeviceConfig.java
+++ b/src/com/android/settings/core/SettingsUIDeviceConfig.java
@@ -42,4 +42,9 @@ public class SettingsUIDeviceConfig {
* {@code true} whether or not event_log for generic actions is enabled. Default is true.
*/
public static final String GENERIC_EVENT_LOGGING_ENABLED = "event_logging_enabled";
+
+ /**
+ * {@code true} if Cloned Apps menu is available in Apps page. Default is false.
+ */
+ public static final String CLONED_APPS_ENABLED = "cloned_apps_enabled";
}
diff --git a/tests/robotests/src/com/android/settings/applications/ClonedAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/ClonedAppsPreferenceControllerTest.java
new file mode 100644
index 00000000000..9e30d60648d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/ClonedAppsPreferenceControllerTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.applications;
+
+import static android.provider.DeviceConfig.NAMESPACE_SETTINGS_UI;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.spy;
+
+import android.content.Context;
+import android.provider.DeviceConfig;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.SettingsUIDeviceConfig;
+import com.android.settings.testutils.shadow.ShadowDeviceConfig;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowDeviceConfig.class})
+public class ClonedAppsPreferenceControllerTest {
+
+ private ClonedAppsPreferenceController mController;
+ private static final String KEY = "key";
+ private Context mContext;
+
+ @Before
+ public void setUp() {
+ mContext = spy(ApplicationProvider.getApplicationContext());
+ mController = new ClonedAppsPreferenceController(mContext, KEY);
+ }
+
+ @Test
+ public void getAvailabilityStatus_featureNotEnabled_shouldNotReturnAvailable() {
+ DeviceConfig.setProperty(NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.CLONED_APPS_ENABLED,
+ "false", true /* makeDefault */);
+
+ assertThat(mController.getAvailabilityStatus()).isNotEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_featureEnabled_shouldReturnAvailable() {
+ DeviceConfig.setProperty(NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.CLONED_APPS_ENABLED,
+ "true", true /* makeDefault */);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+}