Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally, a=sylvestre
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 14 Oct 2015 12:46:51 +0200
changeset 289578 135164c79784
parent 289577 968735b8ea8d
child 289579 2c138fbc9513
push id5196
push usercbook@mozilla.com
push date2015-10-19 07:20 +0000
treeherdermozilla-beta@135164c79784 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally, sylvestre
bugs1213921
milestone42.0
Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally, a=sylvestre
mobile/android/base/RestrictedProfiles.java
--- a/mobile/android/base/RestrictedProfiles.java
+++ b/mobile/android/base/RestrictedProfiles.java
@@ -61,29 +61,19 @@ public class RestrictedProfiles {
 
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
     public static boolean isRestrictedProfile(Context context) {
         if (Versions.preJBMR2) {
             // Early versions don't support restrictions at all
             return false;
         }
 
+        // The user is on a restricted profile if, and only if, we injected application restrictions during account setup.
         final UserManager mgr = (UserManager) context.getSystemService(Context.USER_SERVICE);
-        final Bundle restrictions = new Bundle();
-        restrictions.putAll(mgr.getApplicationRestrictions(context.getPackageName()));
-        restrictions.putAll(mgr.getUserRestrictions());
-
-        for (String key : restrictions.keySet()) {
-            if (restrictions.getBoolean(key)) {
-                // At least one restriction is enabled -> We are a restricted profile
-                return true;
-            }
-        }
-
-        return false;
+        return !mgr.getApplicationRestrictions(context.getPackageName()).isEmpty();
     }
 
     private static Restriction geckoActionToRestriction(int action) {
         for (Restriction rest : Restriction.values()) {
             if (rest.id == action) {
                 return rest;
             }
         }