diff options
author | Amith Yamasani <yamasani@google.com> | 2013-07-02 14:15:29 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2013-07-18 11:37:32 -0700 |
commit | 7eedcf4a5012fabff69bab08a8efc9146e7607dc (patch) | |
tree | 71394cf489b4cf3fa4be866828138588c6c06785 /src/com/android/settings/users/RestrictionSettings.java | |
parent | 8e3405d85a334565e262f41c9a23740c043f83a4 (diff) | |
download | packages_apps_Settings-7eedcf4a5012fabff69bab08a8efc9146e7607dc.tar.gz packages_apps_Settings-7eedcf4a5012fabff69bab08a8efc9146e7607dc.tar.bz2 packages_apps_Settings-7eedcf4a5012fabff69bab08a8efc9146e7607dc.zip |
Apply restrictions right away instead of on exit
Use usermanager to clear restrictions, as it needs to do a bunch of
book keeping.
Apply PIN restriction to master clear button.
Changing existing PIN now includes verifying the PIN, so it doesn't
need to be cleared here in Settings.
Removed automatic persisting of restrictions on receiving them unless
it is a restricted profile.
Make apps that are signed with platform certs immutable and ON.
Change-Id: Iffd1bf2eb0d18202fb66ddcf80668baa8e6b84ed
Diffstat (limited to 'src/com/android/settings/users/RestrictionSettings.java')
-rw-r--r-- | src/com/android/settings/users/RestrictionSettings.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/com/android/settings/users/RestrictionSettings.java b/src/com/android/settings/users/RestrictionSettings.java index 789cee424..6ffea16a3 100644 --- a/src/com/android/settings/users/RestrictionSettings.java +++ b/src/com/android/settings/users/RestrictionSettings.java @@ -29,6 +29,8 @@ import android.view.MenuItem; import com.android.settings.R; +import org.junit.internal.matchers.IsCollectionContaining; + import java.util.List; /** @@ -41,6 +43,7 @@ public class RestrictionSettings extends AppRestrictionsFragment { private static final int MENU_RESET = Menu.FIRST + 1; private static final int MENU_CHANGE_PIN = Menu.FIRST + 2; + private static final String KEY_CHALLENGE_SUCCEEDED = "chsc"; private static final String KEY_CHALLENGE_REQUESTED = "chrq"; private boolean mChallengeSucceeded; @@ -50,16 +53,19 @@ public class RestrictionSettings extends AppRestrictionsFragment { super.onCreate(icicle); init(icicle); - mChallengeSucceeded = false; - mChallengeRequested = icicle != null - ? icicle.getBoolean(KEY_CHALLENGE_REQUESTED, false) - : false; + if (icicle != null) { + mChallengeSucceeded = icicle.getBoolean(KEY_CHALLENGE_SUCCEEDED, false); + mChallengeRequested = icicle.getBoolean(KEY_CHALLENGE_REQUESTED, false); + } setHasOptionsMenu(true); } public void onResume() { super.onResume(); + ensurePin(); + } + private void ensurePin() { if (!mChallengeSucceeded) { getListView().setEnabled(false); final UserManager um = UserManager.get(getActivity()); @@ -81,24 +87,13 @@ public class RestrictionSettings extends AppRestrictionsFragment { private void resetAndRemovePin() { final UserManager um = UserManager.get(getActivity()); - final PackageManager pm = getActivity().getPackageManager(); - List<ApplicationInfo> installedApps = pm.getInstalledApplications( - PackageManager.GET_UNINSTALLED_PACKAGES); - UserHandle user = android.os.Process.myUserHandle(); - for (ApplicationInfo info: installedApps) { - if ((info.flags & ApplicationInfo.FLAG_BLOCKED) != 0 - && (info.flags & ApplicationInfo.FLAG_INSTALLED) != 0) { - pm.setApplicationBlockedSettingAsUser(info.packageName, false, user); - } - } - um.changeRestrictionsPin(null); + um.removeRestrictions(); clearSelectedApps(); finishFragment(); } private void changePin() { final UserManager um = UserManager.get(getActivity()); - um.changeRestrictionsPin(null); Intent requestPin = new Intent("android.intent.action.RESTRICTIONS_PIN_CREATE"); startActivityForResult(requestPin, REQUEST_PIN_CHALLENGE); } @@ -120,7 +115,11 @@ public class RestrictionSettings extends AppRestrictionsFragment { public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); + outState.putBoolean(KEY_CHALLENGE_REQUESTED, mChallengeRequested); + if (getActivity().isChangingConfigurations()) { + outState.putBoolean(KEY_CHALLENGE_SUCCEEDED, mChallengeSucceeded); + } } @Override |