Merge "Move Home settings to Default apps"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 096514f..9336fee 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2838,8 +2838,6 @@
<string name="location_title">My Location</string>
<!-- [CHAR LIMIT=30] Title for managed profile location switch -->
<string name="managed_profile_location_switch_title">Location for work profile</string>
- <!-- [CHAR LIMIT=30] Text to show on managed profile location switch if MDM has locked down location access for managed profile-->
- <string name="managed_profile_location_switch_lockdown">Turned off by your company</string>
<!-- [CHAR LIMIT=30] Location settings screen, setting preference screen box label for location mode -->
<string name="location_mode_title">Mode</string>
<!-- [CHAR LIMIT=30] Location settings screen, high accuracy location mode -->
@@ -3824,8 +3822,6 @@
<string name="accessibility_feature_state_on">On</string>
<!-- Summary for the disabled state of an accessibility feature. [CHAR LIMIT=10] -->
<string name="accessibility_feature_state_off">Off</string>
- <!-- Summary when an accessibility feature or ime is not permitted. [CHAR LIMIT=40] -->
- <string name="accessibility_feature_or_input_method_not_allowed">Not allowed by your organization</string>
<!-- Title for the preference category containing the video caption preview. [CHAR LIMIT=35] -->
<string name="captioning_preview_title">Preview</string>
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 4ccc14a..d22d32a 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -27,10 +27,10 @@
android:summary="@string/location_mode_location_off_title" />
<!-- This preference category gets removed if there is no managed profile -->
- <SwitchPreference
+ <com.android.settingslib.RestrictedSwitchPreference
android:key="managed_profile_location_switch"
android:title="@string/managed_profile_location_switch_title"
- android:summary="@string/managed_profile_location_switch_lockdown"
+ settings:useAdminDisabledSummary="true"
android:persistent="false"
android:enabled="false"
android:selectable="true" />
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 5e8d4a3..461d242 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -56,6 +56,7 @@
android:key="network_reset"
android:title="@string/reset_network_title"
settings:keywords="@string/keywords_network_reset"
+ settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.ResetNetwork" />
<!-- Factory reset -->
@@ -64,6 +65,7 @@
android:title="@string/master_clear_title"
settings:keywords="@string/keywords_factory_data_reset"
settings:userRestriction="no_factory_reset"
+ settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.MasterClear" />
</PreferenceScreen>
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 2137490..2b8ae13 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -62,6 +62,7 @@
<com.android.settingslib.RestrictedPreference
android:key="zen_mode"
android:title="@string/zen_mode_settings_title"
+ settings:useAdminDisabledSummary="true"
settings:keywords="@string/keywords_sounds_and_notifications_interruptions"
android:fragment="com.android.settings.notification.ZenModeSettings" />
@@ -91,7 +92,8 @@
<com.android.settingslib.RestrictedPreference
android:key="cell_broadcast_settings"
- android:title="@string/cell_broadcast_settings" >
+ android:title="@string/cell_broadcast_settings"
+ settings:useAdminDisabledSummary="true">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.cellbroadcastreceiver"
diff --git a/res/xml/user_details_settings.xml b/res/xml/user_details_settings.xml
index 96c8ab9..0b0c6d9 100644
--- a/res/xml/user_details_settings.xml
+++ b/res/xml/user_details_settings.xml
@@ -23,6 +23,7 @@
android:persistent="false" />
<com.android.settingslib.RestrictedPreference
android:key="remove_user"
- android:title="@string/user_remove_user" />
+ android:title="@string/user_remove_user"
+ settings:useAdminDisabledSummary="true" />
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index db7e18a..10ec484 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -44,12 +44,14 @@
<com.android.settingslib.RestrictedPreference
android:fragment="com.android.settings.TetherSettings"
android:key="tether_settings"
- android:title="@string/tether_settings_title_all" />
+ android:title="@string/tether_settings_title_all"
+ settings:useAdminDisabledSummary="true" />
<com.android.settingslib.RestrictedPreference
android:fragment="com.android.settings.vpn2.VpnSettings"
android:key="vpn_settings"
- android:title="@string/vpn_settings_title" />
+ android:title="@string/vpn_settings_title"
+ settings:useAdminDisabledSummary="true" />
<PreferenceScreen
android:key="mobile_network_settings"
diff --git a/src/com/android/settings/DimmableIconPreference.java b/src/com/android/settings/DimmableIconPreference.java
index 98bf551..8f09c53 100644
--- a/src/com/android/settings/DimmableIconPreference.java
+++ b/src/com/android/settings/DimmableIconPreference.java
@@ -44,11 +44,13 @@
public DimmableIconPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContentDescription = null;
+ useAdminDisabledSummary(true);
}
public DimmableIconPreference(Context context, @Nullable CharSequence contentDescription) {
super(context);
mContentDescription = contentDescription;
+ useAdminDisabledSummary(true);
}
private void dimIcon(boolean dimmed) {
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index f56ebe0..411256c 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -481,6 +481,7 @@
AccessibilityServiceInfo info = installedServices.get(i);
RestrictedPreference preference = new RestrictedPreference(getActivity());
+ preference.useAdminDisabledSummary(true);
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString();
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
@@ -515,13 +516,9 @@
preference.setEnabled(true);
}
- String summaryString;
if (serviceAllowed) {
- summaryString = serviceEnabledString;
- } else {
- summaryString = getString(R.string.accessibility_feature_or_input_method_not_allowed);
+ preference.setSummary(serviceEnabledString);
}
- preference.setSummary(summaryString);
preference.setOrder(i);
preference.setFragment(ToggleAccessibilityServicePreferenceFragment.class.getName());
diff --git a/src/com/android/settings/accounts/ProviderPreference.java b/src/com/android/settings/accounts/ProviderPreference.java
index 863fef4..31f0c8e 100644
--- a/src/com/android/settings/accounts/ProviderPreference.java
+++ b/src/com/android/settings/accounts/ProviderPreference.java
@@ -39,6 +39,7 @@
setIcon(icon);
setPersistent(false);
setTitle(providerName);
+ useAdminDisabledSummary(true);
}
public String getAccountType() {
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 8c87080..e38f181 100755
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -119,6 +119,7 @@
&& mInputMethodSettingValues.isValidSystemNonAuxAsciiCapableIme(imi, context);
setOnPreferenceClickListener(this);
setOnPreferenceChangeListener(this);
+ useAdminDisabledSummary(true);
if (!isAllowedByOrganization) {
EnforcedAdmin admin =
RestrictedLockUtils.getProfileOrDeviceOwnerOnCallingUser(context);
@@ -194,7 +195,9 @@
// this preference should be disabled to prevent accidentally disabling an input method.
setEnabled(!((isAlwaysChecked && isImeEnabler()) || (!mIsAllowedByOrganization)));
setChecked(mInputMethodSettingValues.isEnabledImi(mImi));
- setSummary(getSummaryString());
+ if (mIsAllowedByOrganization) {
+ setSummary(getSummaryString());
+ }
}
private InputMethodManager getInputMethodManager() {
@@ -203,9 +206,6 @@
private String getSummaryString() {
final Context context = getContext();
- if (!mIsAllowedByOrganization) {
- return context.getString(R.string.accessibility_feature_or_input_method_not_allowed);
- }
final InputMethodManager imm = getInputMethodManager();
final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(mImi, true);
final ArrayList<CharSequence> subtypeLabels = new ArrayList<>();
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 047fcbb..c45de16 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -32,7 +32,6 @@
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
-import android.support.v14.preference.SwitchPreference;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -47,6 +46,7 @@
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.location.RecentLocationApps;
import java.util.ArrayList;
@@ -104,7 +104,7 @@
private Switch mSwitch;
private boolean mValidListener = false;
private UserHandle mManagedProfile;
- private SwitchPreference mManagedProfileSwitch;
+ private RestrictedSwitchPreference mManagedProfileSwitch;
private Preference mLocationMode;
private PreferenceCategory mCategoryRecentLocationRequests;
/** Receives UPDATE_INTENT */
@@ -253,7 +253,7 @@
root.removePreference(root.findPreference(KEY_MANAGED_PROFILE_SWITCH));
mManagedProfileSwitch = null;
} else {
- mManagedProfileSwitch = (SwitchPreference)root
+ mManagedProfileSwitch = (RestrictedSwitchPreference)root
.findPreference(KEY_MANAGED_PROFILE_SWITCH);
mManagedProfileSwitch.setOnPreferenceClickListener(null);
}
@@ -263,26 +263,30 @@
if (mManagedProfileSwitch == null) {
return;
}
- boolean enabled = mainSwitchOn;
- int summaryResId = R.string.switch_off_text;
- if (mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)
- && getAdminRestrictingManagedProfile() != null) {
- summaryResId = R.string.managed_profile_location_switch_lockdown;
- enabled = false;
- }
-
- mManagedProfileSwitch.setEnabled(enabled);
mManagedProfileSwitch.setOnPreferenceClickListener(null);
- if (!enabled) {
+ final EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(getActivity(),
+ UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile.getIdentifier());
+ if (mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)
+ && admin != null) {
+ mManagedProfileSwitch.setDisabledByAdmin(admin);
mManagedProfileSwitch.setChecked(false);
} else {
- final boolean isRestricted = isManagedProfileRestrictedByBase();
- mManagedProfileSwitch.setChecked(!isRestricted);
- summaryResId = (isRestricted ?
- R.string.switch_off_text : R.string.switch_on_text);
- mManagedProfileSwitch.setOnPreferenceClickListener(mManagedProfileSwitchClickListener);
+ boolean enabled = mainSwitchOn;
+ mManagedProfileSwitch.setEnabled(enabled);
+
+ int summaryResId = R.string.switch_off_text;
+ if (!enabled) {
+ mManagedProfileSwitch.setChecked(false);
+ } else {
+ final boolean isRestricted = isManagedProfileRestrictedByBase();
+ mManagedProfileSwitch.setChecked(!isRestricted);
+ summaryResId = (isRestricted ?
+ R.string.switch_off_text : R.string.switch_on_text);
+ mManagedProfileSwitch.setOnPreferenceClickListener(
+ mManagedProfileSwitchClickListener);
+ }
+ mManagedProfileSwitch.setSummary(summaryResId);
}
- mManagedProfileSwitch.setSummary(summaryResId);
}
/**
@@ -418,27 +422,6 @@
}
}
- private ComponentName getAdminRestrictingManagedProfile() {
- if (mManagedProfile == null) {
- return null;
- }
- DevicePolicyManager dpm = (DevicePolicyManager)getActivity().getSystemService(
- Context.DEVICE_POLICY_SERVICE);
- if (dpm == null) {
- return null;
- }
- List<ComponentName> admins = dpm.getActiveAdminsAsUser(mManagedProfile.getIdentifier());
- for (int i = 0; i < admins.size(); ++i) {
- final ComponentName admin = admins.get(i);
- Bundle restrictions = dpm.getUserRestrictions(admin, mManagedProfile.getIdentifier());
- if (restrictions != null && restrictions.getBoolean(UserManager.DISALLOW_SHARE_LOCATION,
- false)) {
- return admin;
- }
- }
- return null;
- }
-
private boolean isManagedProfileRestrictedByBase() {
if (mManagedProfile == null) {
return false;
diff --git a/src/com/android/settings/users/UserPreference.java b/src/com/android/settings/users/UserPreference.java
index 61ad6df..eff8b9a 100644
--- a/src/com/android/settings/users/UserPreference.java
+++ b/src/com/android/settings/users/UserPreference.java
@@ -76,6 +76,7 @@
mDeleteClickListener = deleteListener;
mSettingsClickListener = settingsListener;
mUserId = userId;
+ useAdminDisabledSummary(true);
}
private void dimIcon(boolean dimmed) {