From ceceb2ab07aab457a4229d051de222ad88ed62a1 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 11 Nov 2014 15:36:15 -0800 Subject: [PATCH] Fix a regression in enabling unknown sources toggle In Security Settings, allow unknown sources to be toggled for primary and secondary users unless it is a restricted profile or there is a device policy restriction to disallow installing apps or installing from unknown sources. Bug: 18277370 Change-Id: I9f0b6cd603c4c8deb77d36af1b82cace43ba195f --- src/com/android/settings/SecuritySettings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index aa27e3bdbc5..ab085539187 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -336,7 +336,8 @@ public class SecuritySettings extends SettingsPreferenceFragment KEY_TOGGLE_INSTALL_APPLICATIONS); mToggleAppInstallation.setChecked(isNonMarketAppsAllowed()); // Side loading of apps. - mToggleAppInstallation.setEnabled(mIsPrimary); + // Disable for restricted profiles. For others, check if policy disallows it. + mToggleAppInstallation.setEnabled(!um.getUserInfo(UserHandle.myUserId()).isRestricted()); if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES) || um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) { mToggleAppInstallation.setEnabled(false);