Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 14 Oct 2015 12:46:51 +0200
changeset 267602 0d6ceca760064871246118cf0b6f9a9bcb9b37d3
parent 267601 dc3f5e4b8f31f4ecf0cc4404e8604e493273c52d
child 267603 dcba4948ef86f0930ea9c273c205e8c85f76d16f
push id29524
push usercbook@mozilla.com
push dateWed, 14 Oct 2015 14:18:49 +0000
treeherdermozilla-central@833c3c37daa6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally
bugs1213921
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally
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()) {