Add app default UI to App & Notifications.
Bug: 31799948 Test: RunSettingsRoboTests Change-Id: Icca4954f82af38316cc232b8879c0f7e7869ecb3
This commit is contained in:
@@ -3387,6 +3387,34 @@
|
||||
android:value="com.android.settings.category.ia.accounts" />
|
||||
</activity-alias>
|
||||
|
||||
<activity-alias android:name="AppDefaultDashboardAlias"
|
||||
android:targetActivity="Settings$AdvancedAppsActivity"
|
||||
android:label="@string/app_default_dashboard_title"
|
||||
android:icon="@drawable/ic_settings_applications">
|
||||
<intent-filter android:priority="130">
|
||||
<action android:name="com.android.settings.action.SETTINGS"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.apps"/>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.applications.AdvancedAppSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
</activity-alias>
|
||||
|
||||
<activity-alias android:name="PaymentSettingsDashboardAlias"
|
||||
android:targetActivity="Settings$PaymentSettingsActivity">
|
||||
<intent-filter android:priority="10">
|
||||
<action android:name="com.android.settings.action.SETTINGS"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.apps.default"/>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.nfc.PaymentSettings"/>
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true"/>
|
||||
</activity-alias>
|
||||
|
||||
<!-- End of information architecture host activities -->
|
||||
|
||||
<service
|
||||
|
@@ -5933,6 +5933,9 @@
|
||||
<string name="app_and_notification_dashboard_title">Apps & notifications</string>
|
||||
<!-- Title for setting tile leading to User and accounts settings [CHAR LIMIT=40]-->
|
||||
<string name="account_dashboard_title">User & accounts</string>
|
||||
<!-- Title for setting tile leading to App defaults (which allows user set default app to
|
||||
handle actions such as open web page, making phone calls, default SMS apps [CHAR LIMIT=40]-->
|
||||
<string name="app_default_dashboard_title">App defaults</string>
|
||||
<!-- Summary text for system preference tile, showing current display language of device [CHAR LIMIT=NONE]-->
|
||||
<string name="system_dashboard_summary">Language: <xliff:g id="language">%1$s</xliff:g></string>
|
||||
|
||||
|
88
res/xml/app_default_settings.xml
Normal file
88
res/xml/app_default_settings.xml
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||
|
||||
<Preference
|
||||
android:key="assist_and_voice_input"
|
||||
android:title="@string/assist_and_voice_input_title"
|
||||
android:fragment="com.android.settings.applications.ManageAssist"
|
||||
android:order="-20"/>
|
||||
|
||||
<com.android.settings.applications.DefaultBrowserPreference
|
||||
android:key="default_browser"
|
||||
android:title="@string/default_browser_title"
|
||||
android:summary="@string/default_browser_title_none"
|
||||
android:order="-19"/>
|
||||
|
||||
<com.android.settings.applications.DefaultHomePreference
|
||||
android:key="default_home"
|
||||
android:title="@string/home_app"
|
||||
android:summary="@string/no_default_home"
|
||||
settings:keywords="@string/keywords_home"
|
||||
android:order="-18"/>
|
||||
|
||||
<com.android.settings.applications.DefaultPhonePreference
|
||||
android:key="default_phone_app"
|
||||
android:title="@string/default_phone_title"
|
||||
settings:keywords="@string/keywords_default_phone_app"
|
||||
android:order="-17"/>
|
||||
|
||||
<com.android.settings.applications.DefaultSmsPreference
|
||||
android:key="default_sms_app"
|
||||
android:title="@string/sms_application_title"
|
||||
settings:keywords="@string/keywords_more_default_sms_app"
|
||||
android:order="-16"/>
|
||||
|
||||
<com.android.settings.applications.DefaultEmergencyPreference
|
||||
android:key="default_emergency_app"
|
||||
android:title="@string/default_emergency_app"
|
||||
settings:keywords="@string/keywords_emergency_app"
|
||||
android:order="-15"/>
|
||||
|
||||
<Preference
|
||||
android:key="domain_urls"
|
||||
android:title="@string/domain_urls_title"
|
||||
android:fragment="com.android.settings.applications.ManageDomainUrls">
|
||||
</Preference>
|
||||
|
||||
<com.android.settings.WorkOnlyCategory
|
||||
android:key="work_defaults"
|
||||
android:title="@string/default_for_work">
|
||||
|
||||
<com.android.settings.applications.DefaultBrowserPreference
|
||||
android:key="work_default_browser"
|
||||
android:title="@string/default_browser_title"
|
||||
android:summary="@string/default_browser_title_none"
|
||||
settings:forWork="true"/>
|
||||
|
||||
<com.android.settings.applications.DefaultPhonePreference
|
||||
android:key="work_default_phone_app"
|
||||
android:title="@string/default_phone_title"
|
||||
settings:keywords="@string/keywords_default_phone_app"
|
||||
settings:forWork="true"/>
|
||||
|
||||
</com.android.settings.WorkOnlyCategory>
|
||||
|
||||
<Preference
|
||||
android:key="special_access"
|
||||
android:fragment="com.android.settings.applications.SpecialAccessSettings"
|
||||
android:title="@string/special_access"/>
|
||||
|
||||
</PreferenceScreen>
|
@@ -62,8 +62,8 @@ import com.android.settings.accounts.AccountSyncSettings;
|
||||
import com.android.settings.accounts.ChooseAccountActivity;
|
||||
import com.android.settings.accounts.ManagedProfileSettings;
|
||||
import com.android.settings.accounts.UserAndAccountDashboardFragment;
|
||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||
import com.android.settings.applications.AdvancedAppSettings;
|
||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||
import com.android.settings.applications.DrawOverlayDetails;
|
||||
import com.android.settings.applications.InstalledAppDetails;
|
||||
import com.android.settings.applications.ManageApplications;
|
||||
@@ -285,6 +285,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
Settings.SupportDashboardActivity.class.getName(),
|
||||
// Home page > Apps & Notifications
|
||||
"com.android.settings.Settings.ManageApplicationsDashboardAlias",
|
||||
"com.android.settings.Settings.PaymentSettingsDashboardAlias",
|
||||
// Home page > Network & Internet
|
||||
"com.android.settings.Settings.WifiDashboardAlias",
|
||||
"com.android.settings.Settings.DataUsageDashboardAlias",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2016 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.
|
||||
@@ -24,8 +24,10 @@ import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settingslib.drawer.CategoryKey;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -41,7 +43,7 @@ public class AdvancedAppSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected String getCategoryKey() {
|
||||
return "";
|
||||
return CategoryKey.CATEGORY_APPS_DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +53,9 @@ public class AdvancedAppSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.advanced_apps;
|
||||
return mDashboardFeatureProvider.isEnabled()
|
||||
? R.xml.app_default_settings
|
||||
: R.xml.advanced_apps;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,8 +73,11 @@ public class AdvancedAppSettings extends DashboardFragment {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.advanced_apps;
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = FeatureFactory.getFactory(context)
|
||||
.getDashboardFeatureProvider(context).isEnabled()
|
||||
? R.xml.app_default_settings
|
||||
: R.xml.advanced_apps;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
|
@@ -245,7 +245,8 @@ public class ManageApplications extends InstrumentedFragment
|
||||
}
|
||||
if (className.equals(AllApplicationsActivity.class.getName())) {
|
||||
mShowSystem = true;
|
||||
} else if (className.equals(NotificationAppListActivity.class.getName())) {
|
||||
} else if (className.equals(NotificationAppListActivity.class.getName())
|
||||
|| this instanceof NotificationApps) {
|
||||
mListType = LIST_TYPE_NOTIFICATION;
|
||||
mNotifBackend = new NotificationBackend();
|
||||
} else if (className.equals(StorageUseActivity.class.getName())) {
|
||||
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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 android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class AdvancedAppSettingsTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
private AdvancedAppSettings mFragment;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FakeFeatureFactory.setupForTest(mContext);
|
||||
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||
mFragment = new AdvancedAppSettings();
|
||||
mFragment.onAttach(ShadowApplication.getInstance().getApplicationContext());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceScreenResId_differentIAEnabledState_shouldUseDifferentPrefLayout() {
|
||||
when(mFeatureFactory.dashboardFeatureProvider.isEnabled()).thenReturn(true);
|
||||
assertThat(mFragment.getPreferenceScreenResId()).isEqualTo(
|
||||
R.xml.app_default_settings);
|
||||
|
||||
when(mFeatureFactory.dashboardFeatureProvider.isEnabled()).thenReturn(false);
|
||||
assertThat(mFragment.getPreferenceScreenResId()).isEqualTo(
|
||||
R.xml.advanced_apps);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user