AppClone: Add preference to display new page Cloned Apps
Also adds a faeture flag and controller class for this page. UX path: Apps > Cloned Apps Bug: 249916503 Bug: 248235441 Test: manual Test: make RunSettingsRoboTests -j30 ROBOTEST_FILTER=AppsPreferenceControllerTest Test: make RunSettingsRoboTests -j30 ROBOTEST_FILTER=ClonedAppsPreferenceControllerTest Change-Id: I2f68f4365ce08481c7db7bfdda4fdffc369321a9
This commit is contained in:
@@ -3492,6 +3492,18 @@
|
|||||||
android:value="@string/menu_key_notifications"/>
|
android:value="@string/menu_key_notifications"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<!-- Displays a list of apps available for cloning on the device -->
|
||||||
|
<activity android:name=".Settings$ClonedAppsListActivity"
|
||||||
|
android:label="@string/cloned_apps_dashboard_title"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="1">
|
||||||
|
<action android:name="android.settings.MANAGE_CLONED_APPS_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.applications.manageapplications.ManageApplications" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<!-- Application-level notification settings page, same as above but only accessible
|
<!-- Application-level notification settings page, same as above but only accessible
|
||||||
internally from system server -->
|
internally from system server -->
|
||||||
<activity android:name="Settings$NotificationReviewPermissionsActivity"
|
<activity android:name="Settings$NotificationReviewPermissionsActivity"
|
||||||
|
@@ -6986,6 +6986,8 @@
|
|||||||
<!-- Title for setting tile leading to setting UI which allows user set default app to
|
<!-- Title for setting tile leading to setting UI which allows user set default app to
|
||||||
handle actions such as open web page, making phone calls, default SMS apps [CHAR LIMIT=40]-->
|
handle actions such as open web page, making phone calls, default SMS apps [CHAR LIMIT=40]-->
|
||||||
<string name="app_default_dashboard_title">Default apps</string>
|
<string name="app_default_dashboard_title">Default apps</string>
|
||||||
|
<!-- Title for setting tile leading to App Clones menu under the Apps page [CHAR LIMIT=40] -->
|
||||||
|
<string name="cloned_apps_dashboard_title">Cloned Apps</string>
|
||||||
<!-- Summary text for system preference title, showing important setting items under system setting [CHAR LIMIT=NONE]-->
|
<!-- Summary text for system preference title, showing important setting items under system setting [CHAR LIMIT=NONE]-->
|
||||||
<string name="system_dashboard_summary">Languages, gestures, time, backup</string>
|
<string name="system_dashboard_summary">Languages, gestures, time, backup</string>
|
||||||
<!-- Summary text for language preference title, showing important setting items under language setting [CHAR LIMIT=NONE]-->
|
<!-- Summary text for language preference title, showing important setting items under language setting [CHAR LIMIT=NONE]-->
|
||||||
|
@@ -62,6 +62,18 @@
|
|||||||
<intent android:action="android.settings.MANAGE_DEFAULT_APPS_SETTINGS"/>
|
<intent android:action="android.settings.MANAGE_DEFAULT_APPS_SETTINGS"/>
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="cloned_apps"
|
||||||
|
android:title="@string/cloned_apps_dashboard_title"
|
||||||
|
android:order="-995"
|
||||||
|
settings:controller="com.android.settings.applications.ClonedAppsPreferenceController"
|
||||||
|
android:fragment="com.android.settings.applications.manageapplications.ManageApplications">
|
||||||
|
<extra
|
||||||
|
android:name="classname"
|
||||||
|
android:value="com.android.settings.Settings$ClonedAppsListActivity"/>
|
||||||
|
<intent android:action="android.settings.MANAGE_CLONED_APPS_SETTINGS"/>
|
||||||
|
</Preference>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="dashboard_tile_placeholder"
|
android:key="dashboard_tile_placeholder"
|
||||||
android:order="10"/>
|
android:order="10"/>
|
||||||
|
@@ -312,6 +312,8 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class AppBubbleNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AppBubbleNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ }
|
public static class NotificationAssistantSettingsActivity extends SettingsActivity{ /* empty */ }
|
||||||
public static class NotificationAppListActivity 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 NotificationReviewPermissionsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -42,4 +42,9 @@ public class SettingsUIDeviceConfig {
|
|||||||
* {@code true} whether or not event_log for generic actions is enabled. Default is true.
|
* {@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";
|
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";
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user