Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally, a=lizzard
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 14 Oct 2015 12:46:51 +0200
changeset 296495 67a206fb7107626477e8d7acc73dace82bbf8925
parent 296494 c252d305abf6f0209ae1692420b180a76c384f79
child 296496 fd7effbe6559f60601e22b6846c52f004bbbb328
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally, lizzard
bugs1213921
milestone43.0a2
Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally, a=lizzard
mobile/android/base/RestrictedProfiles.java
--- a/mobile/android/base/RestrictedProfiles.java
+++ b/mobile/android/base/RestrictedProfiles.java
@@ -69,29 +69,19 @@ public class RestrictedProfiles {
             return configuration instanceof RestrictedProfileConfiguration;
         }
 
         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();
     }
 
     public static void update(Context context) {
         getConfiguration(context).update();
     }
 
     private static Restriction geckoActionToRestriction(int action) {
         for (Restriction rest : Restriction.values()) {