Misc fixes for User page and my device info page
- Rename UserAndAccountDashboard* to AccountDashboard* - Move emergency info from account to device info page - Move auto sync data toggles (4 of them) from Account page to user page - Move the controllers too. UserSettings is a not a DashboardFragment so I had to manually call each controller method. TODO: refactor UserSettings to a DashboardFragment - Move legal information/regulatory info above advance button within device info page. Fixes: 72523158 Bug: 71871075 Test: robotests Change-Id: I1b8af8af61e49d17926f984978a09a974b6c62e1
This commit is contained in:
@@ -1006,7 +1006,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
<activity android:name="Settings$MeCardActivity"
|
<activity android:name=".Settings$MyDeviceInfoActivity"
|
||||||
android:label="@string/device_info_settings"
|
android:label="@string/device_info_settings"
|
||||||
android:icon="@drawable/ic_settings_about"
|
android:icon="@drawable/ic_settings_about"
|
||||||
android:taskAffinity="com.android.settings"
|
android:taskAffinity="com.android.settings"
|
||||||
@@ -1020,7 +1020,7 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:priority="10">
|
<intent-filter android:priority="270">
|
||||||
<action android:name="com.android.settings.action.SETTINGS" />
|
<action android:name="com.android.settings.action.SETTINGS" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.category"
|
<meta-data android:name="com.android.settings.category"
|
||||||
@@ -2329,7 +2329,7 @@
|
|||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
android:label="@string/header_add_an_account"
|
android:label="@string/header_add_an_account"
|
||||||
android:taskAffinity="com.android.settings"
|
android:taskAffinity="com.android.settings"
|
||||||
android:parentActivityName="Settings$UserAndAccountDashboardActivity">
|
android:parentActivityName=".Settings$AccountDashboardActivity">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<action android:name="android.settings.ADD_ACCOUNT_SETTINGS" />
|
<action android:name="android.settings.ADD_ACCOUNT_SETTINGS" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
@@ -3092,7 +3092,7 @@
|
|||||||
android:resource="@string/app_and_notification_dashboard_summary"/>
|
android:resource="@string/app_and_notification_dashboard_summary"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".Settings$UserAndAccountDashboardActivity"
|
<activity android:name=".Settings$AccountDashboardActivity"
|
||||||
android:label="@string/account_dashboard_title"
|
android:label="@string/account_dashboard_title"
|
||||||
android:icon="@drawable/ic_homepage_accounts">
|
android:icon="@drawable/ic_homepage_accounts">
|
||||||
<intent-filter android:priority="3">
|
<intent-filter android:priority="3">
|
||||||
@@ -3103,11 +3103,9 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.accounts.UserAndAccountDashboardFragment"/>
|
android:value="com.android.settings.accounts.AccountDashboardFragment"/>
|
||||||
<meta-data android:name="com.android.settings.category"
|
<meta-data android:name="com.android.settings.category"
|
||||||
android:value="com.android.settings.category.ia.homepage"/>
|
android:value="com.android.settings.category.ia.homepage"/>
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
|
||||||
android:value="true" />
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".Settings$SystemDashboardActivity"
|
<activity android:name=".Settings$SystemDashboardActivity"
|
||||||
|
@@ -6663,8 +6663,8 @@
|
|||||||
<string name="app_and_notification_dashboard_title">Apps & notifications</string>
|
<string name="app_and_notification_dashboard_title">Apps & notifications</string>
|
||||||
<!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
|
<!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
|
||||||
<string name="app_and_notification_dashboard_summary">Permissions, default apps</string>
|
<string name="app_and_notification_dashboard_summary">Permissions, default apps</string>
|
||||||
<!-- Title for setting tile leading to User and accounts settings [CHAR LIMIT=40]-->
|
<!-- Title for setting tile leading to account settings [CHAR LIMIT=40]-->
|
||||||
<string name="account_dashboard_title">Users & accounts</string>
|
<string name="account_dashboard_title">Accounts</string>
|
||||||
<!-- 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>
|
||||||
|
28
res/xml/accounts_dashboard_settings.xml
Normal file
28
res/xml/accounts_dashboard_settings.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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-auto"
|
||||||
|
android:key="user_and_account_settings_screen"
|
||||||
|
android:title="@string/account_dashboard_title"
|
||||||
|
settings:keywords="@string/keywords_accounts">
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="dashboard_tile_placeholder"
|
||||||
|
android:order="200"/>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@@ -20,7 +20,7 @@
|
|||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="my_device_info_pref_screen"
|
android:key="my_device_info_pref_screen"
|
||||||
android:title="@string/my_device_info_title"
|
android:title="@string/my_device_info_title"
|
||||||
settings:initialExpandedChildrenCount="4">
|
settings:initialExpandedChildrenCount="7">
|
||||||
|
|
||||||
<com.android.settings.applications.LayoutPreference
|
<com.android.settings.applications.LayoutPreference
|
||||||
android:key="my_device_info_header"
|
android:key="my_device_info_header"
|
||||||
@@ -49,10 +49,31 @@
|
|||||||
android:title="@string/my_device_info_device_name_preference_title"
|
android:title="@string/my_device_info_device_name_preference_title"
|
||||||
android:summary="@string/summary_placeholder"/>
|
android:summary="@string/summary_placeholder"/>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="emergency_info"
|
||||||
|
android:order="4"
|
||||||
|
android:title="@string/emergency_info_title"
|
||||||
|
android:summary="@string/summary_placeholder"/>
|
||||||
|
|
||||||
|
<!-- Legal information -->
|
||||||
|
<Preference
|
||||||
|
android:key="legal_container"
|
||||||
|
android:order="5"
|
||||||
|
android:title="@string/legal_information"
|
||||||
|
android:fragment="com.android.settings.LegalSettings" />
|
||||||
|
|
||||||
|
<!-- Regulatory labels -->
|
||||||
|
<Preference
|
||||||
|
android:key="regulatory_info"
|
||||||
|
android:order="6"
|
||||||
|
android:title="@string/regulatory_labels">
|
||||||
|
<intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
|
||||||
|
</Preference>
|
||||||
|
|
||||||
<!-- SIM status -->
|
<!-- SIM status -->
|
||||||
<Preference
|
<Preference
|
||||||
android:key="sim_status"
|
android:key="sim_status"
|
||||||
android:order="4"
|
android:order="7"
|
||||||
android:title="@string/sim_status_title"
|
android:title="@string/sim_status_title"
|
||||||
settings:keywords="@string/keywords_sim_status"
|
settings:keywords="@string/keywords_sim_status"
|
||||||
android:summary="@string/summary_placeholder"/>
|
android:summary="@string/summary_placeholder"/>
|
||||||
@@ -110,23 +131,6 @@
|
|||||||
android:title="@string/status_bt_address"
|
android:title="@string/status_bt_address"
|
||||||
android:summary="@string/summary_placeholder"/>
|
android:summary="@string/summary_placeholder"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- Legal information -->
|
|
||||||
<Preference
|
|
||||||
android:key="legal_container"
|
|
||||||
android:order="37"
|
|
||||||
android:title="@string/legal_information"
|
|
||||||
android:fragment="com.android.settings.LegalSettings"
|
|
||||||
settings:allowDividerAbove="true"/>
|
|
||||||
|
|
||||||
<!-- Regulatory labels -->
|
|
||||||
<Preference
|
|
||||||
android:key="regulatory_info"
|
|
||||||
android:order="38"
|
|
||||||
android:title="@string/regulatory_labels">
|
|
||||||
<intent android:action="android.settings.SHOW_REGULATORY_INFO"/>
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
<!-- Safety & regulatory manual -->
|
<!-- Safety & regulatory manual -->
|
||||||
<Preference
|
<Preference
|
||||||
android:key="safety_info"
|
android:key="safety_info"
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
<?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-auto"
|
|
||||||
android:key="user_and_account_settings_screen"
|
|
||||||
android:title="@string/account_dashboard_title"
|
|
||||||
settings:keywords="@string/keywords_accounts">
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="emergency_info"
|
|
||||||
android:title="@string/emergency_info_title"
|
|
||||||
android:order="100"
|
|
||||||
settings:allowDividerAbove="true"/>
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="auto_sync_account_data"
|
|
||||||
android:title="@string/auto_sync_account_title"
|
|
||||||
android:summary="@string/auto_sync_account_summary"
|
|
||||||
android:order="102"
|
|
||||||
settings:allowDividerAbove="true"/>
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="auto_sync_work_account_data"
|
|
||||||
android:title="@string/account_settings_menu_auto_sync_work"
|
|
||||||
android:summary="@string/auto_sync_account_summary"
|
|
||||||
android:order="103"/>
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="auto_sync_personal_account_data"
|
|
||||||
android:title="@string/account_settings_menu_auto_sync_personal"
|
|
||||||
android:summary="@string/auto_sync_account_summary"
|
|
||||||
android:order="104"/>
|
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
|
||||||
android:key="user_settings_add_users_when_locked"
|
|
||||||
android:title="@string/user_add_on_lockscreen_menu"
|
|
||||||
android:singleLineTitle="false"
|
|
||||||
android:order="105"/>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="dashboard_tile_placeholder"
|
|
||||||
android:order="200"/>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
@@ -14,18 +14,47 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/user_settings_title">
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:key="user_settings_screen"
|
||||||
|
android:title="@string/user_settings_title">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="user_list"
|
android:key="user_list"
|
||||||
android:title="@string/user_list_title">
|
android:title="@string/user_list_title"
|
||||||
|
android:order="10">
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedPreference
|
<com.android.settingslib.RestrictedPreference
|
||||||
android:key="user_add"
|
android:key="user_add"
|
||||||
android:title="@string/user_add_user_or_profile_menu"
|
android:title="@string/user_add_user_or_profile_menu"
|
||||||
android:icon="@drawable/ic_menu_add" />
|
android:icon="@drawable/ic_menu_add"
|
||||||
|
android:order="20"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="auto_sync_account_data"
|
||||||
|
android:title="@string/auto_sync_account_title"
|
||||||
|
android:summary="@string/auto_sync_account_summary"
|
||||||
|
android:order="102"
|
||||||
|
settings:allowDividerAbove="true"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="auto_sync_work_account_data"
|
||||||
|
android:title="@string/account_settings_menu_auto_sync_work"
|
||||||
|
android:summary="@string/auto_sync_account_summary"
|
||||||
|
android:order="103"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="auto_sync_personal_account_data"
|
||||||
|
android:title="@string/account_settings_menu_auto_sync_personal"
|
||||||
|
android:summary="@string/auto_sync_account_summary"
|
||||||
|
android:order="104"/>
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
|
android:key="user_settings_add_users_when_locked"
|
||||||
|
android:title="@string/user_add_on_lockscreen_menu"
|
||||||
|
android:singleLineTitle="false"
|
||||||
|
android:order="105"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -54,7 +54,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class NightDisplaySettingsActivity extends SettingsActivity { /* empty */ }
|
public static class NightDisplaySettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class NightDisplaySuggestionActivity extends NightDisplaySettingsActivity { /* empty */ }
|
public static class NightDisplaySuggestionActivity extends NightDisplaySettingsActivity { /* empty */ }
|
||||||
public static class DeviceInfoSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class DeviceInfoSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class MeCardActivity extends SettingsActivity { /* empty */ }
|
public static class MyDeviceInfoActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ApplicationSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ApplicationSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ManageApplicationsActivity extends SettingsActivity { /* empty */ }
|
public static class ManageApplicationsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ManageAssistActivity extends SettingsActivity { /* empty */ }
|
public static class ManageAssistActivity extends SettingsActivity { /* empty */ }
|
||||||
@@ -168,7 +168,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class PowerUsageSummaryLegacyActivity extends SettingsActivity { /* empty */ }
|
public static class PowerUsageSummaryLegacyActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AppAndNotificationDashboardActivity extends SettingsActivity {}
|
public static class AppAndNotificationDashboardActivity extends SettingsActivity {}
|
||||||
public static class StorageDashboardActivity extends SettingsActivity {}
|
public static class StorageDashboardActivity extends SettingsActivity {}
|
||||||
public static class UserAndAccountDashboardActivity extends SettingsActivity {}
|
public static class AccountDashboardActivity extends SettingsActivity {}
|
||||||
public static class SystemDashboardActivity extends SettingsActivity {}
|
public static class SystemDashboardActivity extends SettingsActivity {}
|
||||||
public static class AdvancedConnectedDeviceActivity extends SettingsActivity {
|
public static class AdvancedConnectedDeviceActivity extends SettingsActivity {
|
||||||
public static final boolean isEnabled() {
|
public static final boolean isEnabled() {
|
||||||
|
@@ -878,7 +878,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
|||||||
.getAccountFeatureProvider()
|
.getAccountFeatureProvider()
|
||||||
.isMeCardEnabled(this);
|
.isMeCardEnabled(this);
|
||||||
somethingChanged = setTileEnabled(new ComponentName(packageName,
|
somethingChanged = setTileEnabled(new ComponentName(packageName,
|
||||||
Settings.MeCardActivity.class.getName()),
|
Settings.MyDeviceInfoActivity.class.getName()),
|
||||||
isMeCardEnabled, isAdmin)
|
isMeCardEnabled, isAdmin)
|
||||||
|| somethingChanged;
|
|| somethingChanged;
|
||||||
somethingChanged = setTileEnabled(new ComponentName(packageName,
|
somethingChanged = setTileEnabled(new ComponentName(packageName,
|
||||||
|
@@ -35,10 +35,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UserAndAccountDashboardFragment extends DashboardFragment {
|
public class AccountDashboardFragment extends DashboardFragment {
|
||||||
|
|
||||||
|
private static final String TAG = "AccountDashboardFrag";
|
||||||
|
|
||||||
private static final String TAG = "UserAndAccountDashboard";
|
|
||||||
private static final String KEY_ADD_USER_WHEN_LOCKED = "user_settings_add_users_when_locked";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -52,7 +52,7 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getPreferenceScreenResId() {
|
protected int getPreferenceScreenResId() {
|
||||||
return R.xml.user_and_accounts_settings;
|
return R.xml.accounts_dashboard_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,16 +63,7 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
|||||||
@Override
|
@Override
|
||||||
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new EmergencyInfoPreferenceController(context));
|
final String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
|
||||||
AddUserWhenLockedPreferenceController addUserWhenLockedPrefController =
|
|
||||||
new AddUserWhenLockedPreferenceController(
|
|
||||||
context, KEY_ADD_USER_WHEN_LOCKED);
|
|
||||||
controllers.add(addUserWhenLockedPrefController);
|
|
||||||
getLifecycle().addObserver(addUserWhenLockedPrefController);
|
|
||||||
controllers.add(new AutoSyncDataPreferenceController(context, this));
|
|
||||||
controllers.add(new AutoSyncPersonalDataPreferenceController(context, this));
|
|
||||||
controllers.add(new AutoSyncWorkDataPreferenceController(context, this));
|
|
||||||
String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
|
|
||||||
final AccountPreferenceController accountPrefController =
|
final AccountPreferenceController accountPrefController =
|
||||||
new AccountPreferenceController(context, this, authorities);
|
new AccountPreferenceController(context, this, authorities);
|
||||||
getLifecycle().addObserver(accountPrefController);
|
getLifecycle().addObserver(accountPrefController);
|
||||||
@@ -116,7 +107,7 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
|||||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||||
Context context, boolean enabled) {
|
Context context, boolean enabled) {
|
||||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||||
sir.xmlResId = R.xml.user_and_accounts_settings;
|
sir.xmlResId = R.xml.accounts_dashboard_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
};
|
};
|
@@ -36,7 +36,7 @@ import com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment;
|
|||||||
import com.android.settings.accounts.AccountSyncSettings;
|
import com.android.settings.accounts.AccountSyncSettings;
|
||||||
import com.android.settings.accounts.ChooseAccountActivity;
|
import com.android.settings.accounts.ChooseAccountActivity;
|
||||||
import com.android.settings.accounts.ManagedProfileSettings;
|
import com.android.settings.accounts.ManagedProfileSettings;
|
||||||
import com.android.settings.accounts.UserAndAccountDashboardFragment;
|
import com.android.settings.accounts.AccountDashboardFragment;
|
||||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||||
import com.android.settings.applications.DefaultAppSettings;
|
import com.android.settings.applications.DefaultAppSettings;
|
||||||
import com.android.settings.applications.InstalledAppDetails;
|
import com.android.settings.applications.InstalledAppDetails;
|
||||||
@@ -249,7 +249,7 @@ public class SettingsGateway {
|
|||||||
ConnectedDeviceDashboardFragment.class.getName(),
|
ConnectedDeviceDashboardFragment.class.getName(),
|
||||||
ConnectedDeviceDashboardFragmentOld.class.getName(),
|
ConnectedDeviceDashboardFragmentOld.class.getName(),
|
||||||
AppAndNotificationDashboardFragment.class.getName(),
|
AppAndNotificationDashboardFragment.class.getName(),
|
||||||
UserAndAccountDashboardFragment.class.getName(),
|
AccountDashboardFragment.class.getName(),
|
||||||
EnterprisePrivacySettings.class.getName(),
|
EnterprisePrivacySettings.class.getName(),
|
||||||
WebViewAppPicker.class.getName(),
|
WebViewAppPicker.class.getName(),
|
||||||
LockscreenDashboardFragment.class.getName(),
|
LockscreenDashboardFragment.class.getName(),
|
||||||
@@ -270,7 +270,7 @@ public class SettingsGateway {
|
|||||||
Settings.StorageDashboardActivity.class.getName(),
|
Settings.StorageDashboardActivity.class.getName(),
|
||||||
Settings.PowerUsageSummaryActivity.class.getName(),
|
Settings.PowerUsageSummaryActivity.class.getName(),
|
||||||
Settings.PowerUsageSummaryLegacyActivity.class.getName(),
|
Settings.PowerUsageSummaryLegacyActivity.class.getName(),
|
||||||
Settings.UserAndAccountDashboardActivity.class.getName(),
|
Settings.AccountDashboardActivity.class.getName(),
|
||||||
Settings.SecuritySettingsActivity.class.getName(),
|
Settings.SecuritySettingsActivity.class.getName(),
|
||||||
Settings.SecuritySettingsActivityV2.class.getName(),
|
Settings.SecuritySettingsActivityV2.class.getName(),
|
||||||
Settings.AccessibilitySettingsActivity.class.getName(),
|
Settings.AccessibilitySettingsActivity.class.getName(),
|
||||||
@@ -298,6 +298,6 @@ public class SettingsGateway {
|
|||||||
Settings.DateTimeSettingsActivity.class.getName(),
|
Settings.DateTimeSettingsActivity.class.getName(),
|
||||||
Settings.DeviceInfoSettingsActivity.class.getName(),
|
Settings.DeviceInfoSettingsActivity.class.getName(),
|
||||||
Settings.EnterprisePrivacySettingsActivity.class.getName(),
|
Settings.EnterprisePrivacySettingsActivity.class.getName(),
|
||||||
Settings.MeCardActivity.class.getName(),
|
Settings.MyDeviceInfoActivity.class.getName(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.util.ArrayMap;
|
|||||||
|
|
||||||
import com.android.settings.DisplaySettings;
|
import com.android.settings.DisplaySettings;
|
||||||
import com.android.settings.accounts.AccountDetailDashboardFragment;
|
import com.android.settings.accounts.AccountDetailDashboardFragment;
|
||||||
import com.android.settings.accounts.UserAndAccountDashboardFragment;
|
import com.android.settings.accounts.AccountDashboardFragment;
|
||||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||||
import com.android.settings.applications.DefaultAppSettings;
|
import com.android.settings.applications.DefaultAppSettings;
|
||||||
import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
|
import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
|
||||||
@@ -81,7 +81,7 @@ public class DashboardFragmentRegistry {
|
|||||||
CategoryKey.CATEGORY_SECURITY);
|
CategoryKey.CATEGORY_SECURITY);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDetailDashboardFragment.class.getName(),
|
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDetailDashboardFragment.class.getName(),
|
||||||
CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(UserAndAccountDashboardFragment.class.getName(),
|
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDashboardFragment.class.getName(),
|
||||||
CategoryKey.CATEGORY_ACCOUNT);
|
CategoryKey.CATEGORY_ACCOUNT);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(
|
PARENT_TO_CATEGORY_KEY_MAP.put(
|
||||||
SystemDashboardFragment.class.getName(), CategoryKey.CATEGORY_SYSTEM);
|
SystemDashboardFragment.class.getName(), CategoryKey.CATEGORY_SYSTEM);
|
||||||
|
@@ -85,7 +85,7 @@ public class WorkModeCondition extends Condition {
|
|||||||
@Override
|
@Override
|
||||||
public void onPrimaryClick() {
|
public void onPrimaryClick() {
|
||||||
mManager.getContext().startActivity(new Intent(mManager.getContext(),
|
mManager.getContext().startActivity(new Intent(mManager.getContext(),
|
||||||
Settings.UserAndAccountDashboardActivity.class)
|
Settings.UserSettingsActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,20 +25,20 @@ import android.content.pm.UserInfo;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.accounts.EmergencyInfoPreferenceController;
|
||||||
import com.android.settings.applications.LayoutPreference;
|
import com.android.settings.applications.LayoutPreference;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
import com.android.settings.dashboard.SummaryLoader;
|
||||||
import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
|
import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
|
||||||
import com.android.settings.deviceinfo.BrandedAccountPreferenceController;
|
import com.android.settings.deviceinfo.BrandedAccountPreferenceController;
|
||||||
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
|
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
|
||||||
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
|
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
|
||||||
|
import com.android.settings.deviceinfo.DeviceNamePreferenceController;
|
||||||
import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController;
|
import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController;
|
||||||
import com.android.settings.deviceinfo.FeedbackPreferenceController;
|
import com.android.settings.deviceinfo.FeedbackPreferenceController;
|
||||||
import com.android.settings.deviceinfo.ImsStatusPreferenceController;
|
import com.android.settings.deviceinfo.ImsStatusPreferenceController;
|
||||||
@@ -52,11 +52,9 @@ import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreference
|
|||||||
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController;
|
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController;
|
||||||
import com.android.settings.deviceinfo.simstatus.SimStatusPreferenceController;
|
import com.android.settings.deviceinfo.simstatus.SimStatusPreferenceController;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
|
||||||
import com.android.settings.widget.EntityHeaderController;
|
import com.android.settings.widget.EntityHeaderController;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settings.deviceinfo.DeviceNamePreferenceController;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -103,6 +101,7 @@ public class MyDeviceInfoFragment extends DashboardFragment {
|
|||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
||||||
Activity activity, Fragment fragment, Lifecycle lifecycle) {
|
Activity activity, Fragment fragment, Lifecycle lifecycle) {
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
|
controllers.add(new EmergencyInfoPreferenceController(context));
|
||||||
controllers.add(new PhoneNumberPreferenceController(context));
|
controllers.add(new PhoneNumberPreferenceController(context));
|
||||||
controllers.add(new BrandedAccountPreferenceController(context));
|
controllers.add(new BrandedAccountPreferenceController(context));
|
||||||
DeviceNamePreferenceController deviceNamePreferenceController =
|
DeviceNamePreferenceController deviceNamePreferenceController =
|
||||||
@@ -154,6 +153,25 @@ public class MyDeviceInfoFragment extends DashboardFragment {
|
|||||||
controller.done(context, true /* rebindActions */);
|
controller.done(context, true /* rebindActions */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
||||||
|
|
||||||
|
private final SummaryLoader mSummaryLoader;
|
||||||
|
|
||||||
|
public SummaryProvider(SummaryLoader summaryLoader) {
|
||||||
|
mSummaryLoader = summaryLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setListening(boolean listening) {
|
||||||
|
if (listening) {
|
||||||
|
mSummaryLoader.setSummary(this, DeviceModelPreferenceController.getDeviceModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
|
||||||
|
= (activity, summaryLoader) -> new SummaryProvider(summaryLoader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For Search.
|
* For Search.
|
||||||
*/
|
*/
|
||||||
|
@@ -25,7 +25,7 @@ import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
|
|||||||
import com.android.settings.accessibility.AccessibilitySettings;
|
import com.android.settings.accessibility.AccessibilitySettings;
|
||||||
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
|
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
|
||||||
import com.android.settings.accessibility.MagnificationPreferenceFragment;
|
import com.android.settings.accessibility.MagnificationPreferenceFragment;
|
||||||
import com.android.settings.accounts.UserAndAccountDashboardFragment;
|
import com.android.settings.accounts.AccountDashboardFragment;
|
||||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||||
import com.android.settings.applications.DefaultAppSettings;
|
import com.android.settings.applications.DefaultAppSettings;
|
||||||
import com.android.settings.applications.SpecialAccessSettings;
|
import com.android.settings.applications.SpecialAccessSettings;
|
||||||
@@ -138,7 +138,7 @@ public class SearchIndexableResourcesImpl implements SearchIndexableResources {
|
|||||||
addIndex(ScreenLockSettings.class);
|
addIndex(ScreenLockSettings.class);
|
||||||
addIndex(EncryptionAndCredential.class);
|
addIndex(EncryptionAndCredential.class);
|
||||||
addIndex(ScreenPinningSettings.class);
|
addIndex(ScreenPinningSettings.class);
|
||||||
addIndex(UserAndAccountDashboardFragment.class);
|
addIndex(AccountDashboardFragment.class);
|
||||||
addIndex(VirtualKeyboardFragment.class);
|
addIndex(VirtualKeyboardFragment.class);
|
||||||
addIndex(AvailableVirtualKeyboardFragment.class);
|
addIndex(AvailableVirtualKeyboardFragment.class);
|
||||||
addIndex(PhysicalKeyboardFragment.class);
|
addIndex(PhysicalKeyboardFragment.class);
|
||||||
|
@@ -22,7 +22,7 @@ import android.support.annotation.VisibleForTesting;
|
|||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.accounts.AddUserWhenLockedPreferenceController;
|
import com.android.settings.users.AddUserWhenLockedPreferenceController;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.notification.LockScreenNotificationPreferenceController;
|
import com.android.settings.notification.LockScreenNotificationPreferenceController;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
@@ -86,10 +86,8 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
|||||||
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
|
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
|
||||||
lifecycle.addObserver(notificationController);
|
lifecycle.addObserver(notificationController);
|
||||||
controllers.add(notificationController);
|
controllers.add(notificationController);
|
||||||
final AddUserWhenLockedPreferenceController addUserWhenLockedController =
|
controllers.add(new AddUserWhenLockedPreferenceController(
|
||||||
new AddUserWhenLockedPreferenceController(context, KEY_ADD_USER_FROM_LOCK_SCREEN);
|
context, KEY_ADD_USER_FROM_LOCK_SCREEN, lifecycle));
|
||||||
lifecycle.addObserver(addUserWhenLockedController);
|
|
||||||
controllers.add(addUserWhenLockedController);
|
|
||||||
mOwnerInfoPreferenceController =
|
mOwnerInfoPreferenceController =
|
||||||
new OwnerInfoPreferenceController(context, this, lifecycle);
|
new OwnerInfoPreferenceController(context, this, lifecycle);
|
||||||
controllers.add(mOwnerInfoPreferenceController);
|
controllers.add(mOwnerInfoPreferenceController);
|
||||||
@@ -121,7 +119,7 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
|||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new LockScreenNotificationPreferenceController(context));
|
controllers.add(new LockScreenNotificationPreferenceController(context));
|
||||||
controllers.add(new AddUserWhenLockedPreferenceController(context,
|
controllers.add(new AddUserWhenLockedPreferenceController(context,
|
||||||
KEY_ADD_USER_FROM_LOCK_SCREEN));
|
KEY_ADD_USER_FROM_LOCK_SCREEN, null /* lifecycle */));
|
||||||
controllers.add(new OwnerInfoPreferenceController(
|
controllers.add(new OwnerInfoPreferenceController(
|
||||||
context, null /* fragment */, null /* lifecycle */));
|
context, null /* fragment */, null /* lifecycle */));
|
||||||
controllers.add(new LockdownButtonPreferenceController(context));
|
controllers.add(new LockdownButtonPreferenceController(context));
|
||||||
|
@@ -13,16 +13,16 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settings.users.UserCapabilities;
|
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnResume;
|
import com.android.settingslib.core.lifecycle.events.OnResume;
|
||||||
@@ -35,10 +35,13 @@ public class AddUserWhenLockedPreferenceController extends AbstractPreferenceCon
|
|||||||
private final UserCapabilities mUserCaps;
|
private final UserCapabilities mUserCaps;
|
||||||
private boolean mShouldUpdateUserList;
|
private boolean mShouldUpdateUserList;
|
||||||
|
|
||||||
public AddUserWhenLockedPreferenceController(Context context, String key) {
|
public AddUserWhenLockedPreferenceController(Context context, String key, Lifecycle lifecycle) {
|
||||||
super(context);
|
super(context);
|
||||||
mPrefKey = key;
|
mPrefKey = key;
|
||||||
mUserCaps = UserCapabilities.create(context);
|
mUserCaps = UserCapabilities.create(context);
|
||||||
|
if (lifecycle != null) {
|
||||||
|
lifecycle.addObserver(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@@ -41,6 +41,7 @@ public class UserCapabilities {
|
|||||||
public static UserCapabilities create(Context context) {
|
public static UserCapabilities create(Context context) {
|
||||||
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
UserCapabilities caps = new UserCapabilities();
|
UserCapabilities caps = new UserCapabilities();
|
||||||
|
|
||||||
if (!UserManager.supportsMultipleUsers() || Utils.isMonkeyRunning()) {
|
if (!UserManager.supportsMultipleUsers() || Utils.isMonkeyRunning()) {
|
||||||
caps.mEnabled = false;
|
caps.mEnabled = false;
|
||||||
return caps;
|
return caps;
|
||||||
|
@@ -103,6 +103,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
private static final String KEY_USER_LIST = "user_list";
|
private static final String KEY_USER_LIST = "user_list";
|
||||||
private static final String KEY_USER_ME = "user_me";
|
private static final String KEY_USER_ME = "user_me";
|
||||||
private static final String KEY_ADD_USER = "user_add";
|
private static final String KEY_ADD_USER = "user_add";
|
||||||
|
private static final String KEY_ADD_USER_WHEN_LOCKED = "user_settings_add_users_when_locked";
|
||||||
|
|
||||||
private static final int MENU_REMOVE_USER = Menu.FIRST;
|
private static final int MENU_REMOVE_USER = Menu.FIRST;
|
||||||
|
|
||||||
@@ -145,8 +146,11 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
private SparseArray<Bitmap> mUserIcons = new SparseArray<>();
|
private SparseArray<Bitmap> mUserIcons = new SparseArray<>();
|
||||||
private static SparseArray<Bitmap> sDarkDefaultUserBitmapCache = new SparseArray<>();
|
private static SparseArray<Bitmap> sDarkDefaultUserBitmapCache = new SparseArray<>();
|
||||||
|
|
||||||
private EditUserInfoController mEditUserInfoController =
|
private EditUserInfoController mEditUserInfoController = new EditUserInfoController();
|
||||||
new EditUserInfoController();
|
private AddUserWhenLockedPreferenceController mAddUserWhenLockedPreferenceController;
|
||||||
|
private AutoSyncDataPreferenceController mAutoSyncDataPreferenceController;
|
||||||
|
private AutoSyncPersonalDataPreferenceController mAutoSyncPersonalDataPreferenceController;
|
||||||
|
private AutoSyncWorkDataPreferenceController mAutoSyncWorkDataPreferenceController;
|
||||||
|
|
||||||
// A place to cache the generated default avatar
|
// A place to cache the generated default avatar
|
||||||
private Drawable mDefaultIconDrawable;
|
private Drawable mDefaultIconDrawable;
|
||||||
@@ -191,6 +195,28 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
addPreferencesFromResource(R.xml.user_settings);
|
||||||
|
if (Global.getInt(getContext().getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||||
|
getActivity().finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Context context = getActivity();
|
||||||
|
mAddUserWhenLockedPreferenceController = new AddUserWhenLockedPreferenceController(
|
||||||
|
context, KEY_ADD_USER_WHEN_LOCKED, getLifecycle());
|
||||||
|
|
||||||
|
mAutoSyncDataPreferenceController = new AutoSyncDataPreferenceController(context, this);
|
||||||
|
mAutoSyncPersonalDataPreferenceController =
|
||||||
|
new AutoSyncPersonalDataPreferenceController(context, this);
|
||||||
|
mAutoSyncWorkDataPreferenceController =
|
||||||
|
new AutoSyncWorkDataPreferenceController(context, this);
|
||||||
|
|
||||||
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
mAddUserWhenLockedPreferenceController.displayPreference(screen);
|
||||||
|
mAutoSyncDataPreferenceController.displayPreference(screen);
|
||||||
|
mAutoSyncPersonalDataPreferenceController.displayPreference(screen);
|
||||||
|
mAutoSyncWorkDataPreferenceController.displayPreference(screen);
|
||||||
|
screen.findPreference(mAddUserWhenLockedPreferenceController.getPreferenceKey())
|
||||||
|
.setOnPreferenceChangeListener(mAddUserWhenLockedPreferenceController);
|
||||||
|
|
||||||
if (icicle != null) {
|
if (icicle != null) {
|
||||||
if (icicle.containsKey(SAVE_ADDING_USER)) {
|
if (icicle.containsKey(SAVE_ADDING_USER)) {
|
||||||
@@ -201,7 +227,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
mEditUserInfoController.onRestoreInstanceState(icicle);
|
mEditUserInfoController.onRestoreInstanceState(icicle);
|
||||||
}
|
}
|
||||||
final Context context = getActivity();
|
|
||||||
mUserCaps = UserCapabilities.create(context);
|
mUserCaps = UserCapabilities.create(context);
|
||||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
if (!mUserCaps.mEnabled) {
|
if (!mUserCaps.mEnabled) {
|
||||||
@@ -210,7 +236,6 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
final int myUserId = UserHandle.myUserId();
|
final int myUserId = UserHandle.myUserId();
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.user_settings);
|
|
||||||
mUserListCategory = (PreferenceGroup) findPreference(KEY_USER_LIST);
|
mUserListCategory = (PreferenceGroup) findPreference(KEY_USER_LIST);
|
||||||
mMePreference = new UserPreference(getPrefContext(), null /* attrs */, myUserId,
|
mMePreference = new UserPreference(getPrefContext(), null /* attrs */, myUserId,
|
||||||
null /* settings icon handler */,
|
null /* settings icon handler */,
|
||||||
@@ -230,25 +255,40 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
mAddUser.setTitle(R.string.user_add_user_menu);
|
mAddUser.setTitle(R.string.user_add_user_menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setHasOptionsMenu(true);
|
final IntentFilter filter = new IntentFilter(Intent.ACTION_USER_REMOVED);
|
||||||
IntentFilter filter = new IntentFilter(Intent.ACTION_USER_REMOVED);
|
|
||||||
filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
|
filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
|
||||||
context.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null, mHandler);
|
context.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null, mHandler);
|
||||||
loadProfile();
|
loadProfile();
|
||||||
updateUserList();
|
updateUserList();
|
||||||
mShouldUpdateUserList = false;
|
mShouldUpdateUserList = false;
|
||||||
|
|
||||||
if (Global.getInt(getContext().getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
|
||||||
getActivity().finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (!mUserCaps.mEnabled) return;
|
if (!mUserCaps.mEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
|
||||||
|
if (mAutoSyncDataPreferenceController.isAvailable()) {
|
||||||
|
mAutoSyncDataPreferenceController.updateState(screen.findPreference(
|
||||||
|
mAutoSyncDataPreferenceController.getPreferenceKey()));
|
||||||
|
}
|
||||||
|
if (mAddUserWhenLockedPreferenceController.isAvailable()) {
|
||||||
|
mAddUserWhenLockedPreferenceController.updateState(screen.findPreference(
|
||||||
|
mAddUserWhenLockedPreferenceController.getPreferenceKey()));
|
||||||
|
}
|
||||||
|
if (mAutoSyncPersonalDataPreferenceController.isAvailable()) {
|
||||||
|
mAutoSyncPersonalDataPreferenceController.updateState(screen.findPreference(
|
||||||
|
mAutoSyncPersonalDataPreferenceController.getPreferenceKey()));
|
||||||
|
}
|
||||||
|
if (mAutoSyncWorkDataPreferenceController.isAvailable()) {
|
||||||
|
mAutoSyncWorkDataPreferenceController.updateState(screen.findPreference(
|
||||||
|
mAutoSyncWorkDataPreferenceController.getPreferenceKey()));
|
||||||
|
}
|
||||||
|
|
||||||
if (mShouldUpdateUserList) {
|
if (mShouldUpdateUserList) {
|
||||||
mUserCaps.updateAddUserCapabilities(getActivity());
|
mUserCaps.updateAddUserCapabilities(getActivity());
|
||||||
loadProfile();
|
loadProfile();
|
||||||
@@ -266,7 +306,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
if (!mUserCaps.mEnabled) return;
|
if (!mUserCaps.mEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getActivity().unregisterReceiver(mUserChangeReceiver);
|
getActivity().unregisterReceiver(mUserChangeReceiver);
|
||||||
}
|
}
|
||||||
@@ -285,6 +327,20 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
super.startActivityForResult(intent, requestCode);
|
super.startActivityForResult(intent, requestCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
|
if (mAutoSyncDataPreferenceController.handlePreferenceTreeClick(preference)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (mAutoSyncPersonalDataPreferenceController.handlePreferenceTreeClick(preference)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (mAutoSyncWorkDataPreferenceController.handlePreferenceTreeClick(preference)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onPreferenceTreeClick(preference);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@@ -857,32 +913,24 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
loadIconsAsync(missingIcons);
|
loadIconsAsync(missingIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceScreen preferenceScreen = getPreferenceScreen();
|
// Remove everything from mUserListCategory and add new users.
|
||||||
preferenceScreen.removeAll();
|
mUserListCategory.removeAll();
|
||||||
|
// If profiles are supported, mUserListCategory will have a special title
|
||||||
// If profiles are supported, userPreferences will be added to the category labeled
|
|
||||||
// "User & Profiles", otherwise the category is skipped and elements are added directly
|
|
||||||
// to preferenceScreen
|
|
||||||
PreferenceGroup groupToAddUsers;
|
|
||||||
if (mUserCaps.mCanAddRestrictedProfile) {
|
if (mUserCaps.mCanAddRestrictedProfile) {
|
||||||
mUserListCategory.removeAll();
|
mUserListCategory.setTitle(R.string.user_list_title);
|
||||||
mUserListCategory.setOrder(Preference.DEFAULT_ORDER);
|
|
||||||
preferenceScreen.addPreference(mUserListCategory);
|
|
||||||
groupToAddUsers = mUserListCategory;
|
|
||||||
} else {
|
} else {
|
||||||
groupToAddUsers = preferenceScreen;
|
mUserListCategory.setTitle(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UserPreference userPreference : userPreferences) {
|
for (UserPreference userPreference : userPreferences) {
|
||||||
userPreference.setOrder(Preference.DEFAULT_ORDER);
|
userPreference.setOrder(Preference.DEFAULT_ORDER);
|
||||||
groupToAddUsers.addPreference(userPreference);
|
mUserListCategory.addPreference(userPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append Add user to the end of the list
|
// Append Add user to the end of the list
|
||||||
if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin) &&
|
if ((mUserCaps.mCanAddUser || mUserCaps.mDisallowAddUserSetByAdmin) &&
|
||||||
Utils.isDeviceProvisioned(getActivity())) {
|
Utils.isDeviceProvisioned(getActivity())) {
|
||||||
boolean moreUsers = mUserManager.canAddMoreUsers();
|
boolean moreUsers = mUserManager.canAddMoreUsers();
|
||||||
mAddUser.setOrder(Preference.DEFAULT_ORDER);
|
|
||||||
preferenceScreen.addPreference(mAddUser);
|
|
||||||
mAddUser.setEnabled(moreUsers && !mAddingUser);
|
mAddUser.setEnabled(moreUsers && !mAddingUser);
|
||||||
if (!moreUsers) {
|
if (!moreUsers) {
|
||||||
mAddUser.setSummary(getString(R.string.user_add_max_count, getMaxRealUsers()));
|
mAddUser.setSummary(getString(R.string.user_add_max_count, getMaxRealUsers()));
|
||||||
|
@@ -44,19 +44,19 @@ import static org.mockito.Mockito.when;
|
|||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class UserAndAccountDashboardFragmentTest {
|
public class AccountDashboardFragmentTest {
|
||||||
|
|
||||||
private static final String METADATA_CATEGORY = "com.android.settings.category";
|
private static final String METADATA_CATEGORY = "com.android.settings.category";
|
||||||
private static final String METADATA_ACCOUNT_TYPE = "com.android.settings.ia.account";
|
private static final String METADATA_ACCOUNT_TYPE = "com.android.settings.ia.account";
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
private UserAndAccountDashboardFragment mFragment;
|
private AccountDashboardFragment mFragment;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mFragment = new UserAndAccountDashboardFragment();
|
mFragment = new AccountDashboardFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -85,7 +85,7 @@ public class UserAndAccountDashboardFragmentTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSearchIndexProvider_shouldIndexResource() {
|
public void testSearchIndexProvider_shouldIndexResource() {
|
||||||
final List<SearchIndexableResource> indexRes =
|
final List<SearchIndexableResource> indexRes =
|
||||||
UserAndAccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
AccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||||
ShadowApplication.getInstance().getApplicationContext(),
|
ShadowApplication.getInstance().getApplicationContext(),
|
||||||
true /* enabled */);
|
true /* enabled */);
|
||||||
|
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
||||||
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import android.arch.lifecycle.LifecycleOwner;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
@@ -31,6 +32,7 @@ import android.support.v7.preference.PreferenceScreen;
|
|||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -51,6 +53,8 @@ public class AddUserWhenLockedPreferenceControllerTest {
|
|||||||
@Mock(answer = RETURNS_DEEP_STUBS)
|
@Mock(answer = RETURNS_DEEP_STUBS)
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
|
|
||||||
|
private LifecycleOwner mLifecycleOwner;
|
||||||
|
private Lifecycle mLifecycle;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private AddUserWhenLockedPreferenceController mController;
|
private AddUserWhenLockedPreferenceController mController;
|
||||||
|
|
||||||
@@ -60,7 +64,9 @@ public class AddUserWhenLockedPreferenceControllerTest {
|
|||||||
ShadowApplication shadowContext = ShadowApplication.getInstance();
|
ShadowApplication shadowContext = ShadowApplication.getInstance();
|
||||||
shadowContext.setSystemService(Context.USER_SERVICE, mUserManager);
|
shadowContext.setSystemService(Context.USER_SERVICE, mUserManager);
|
||||||
mContext = shadowContext.getApplicationContext();
|
mContext = shadowContext.getApplicationContext();
|
||||||
mController = new AddUserWhenLockedPreferenceController(mContext, "fake_key");
|
mLifecycleOwner = () -> mLifecycle;
|
||||||
|
mLifecycle = new Lifecycle(mLifecycleOwner);
|
||||||
|
mController = new AddUserWhenLockedPreferenceController(mContext, "fake_key", mLifecycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
* Copyright (C) 2016 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.accounts;
|
package com.android.settings.users;
|
||||||
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
@@ -28,8 +28,8 @@ import android.content.pm.UserInfo;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
|
||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
Reference in New Issue
Block a user