Bug 1213921 - Only check application restrictions to determine whether the user is on a restricted profprofile. r=ally

--HG--
extra : commitid : H9Pc5CaMXHf
extra : rebase_source : e224982841f87052d751a7fa7cabeac4d6b9a93f
This commit is contained in:
Sebastian Kaspari 2015-10-14 12:46:51 +02:00
parent 3db060bf68
commit 78e59ca46f

View File

@ -74,19 +74,9 @@ public class RestrictedProfiles {
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) {