Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37cf1851 authored by Jonathan Scott's avatar Jonathan Scott
Browse files

Make user restriction failures clearer.

Test: btest a.d.c.BluetoothTest
Bug: 274710659
Change-Id: I7709810d1df1fdc459c953e1a8f9a8f399bc8309
parent 0f6ed614
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2641,6 +2641,7 @@ public class UserManagerService extends IUserManager.Stub {

    private void setUserRestrictionInner(int userId, @NonNull String key, boolean value) {
        if (!UserRestrictionsUtils.isValidRestriction(key)) {
            Slog.e(LOG_TAG, "Setting invalid restriction " + key);
            return;
        }
        synchronized (mRestrictionsLock) {
+38 −37
Original line number Diff line number Diff line
@@ -13264,6 +13264,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                            ? getProfileParentId(caller.getUserId()) : caller.getUserId();
                    setLocalUserRestrictionInternal(admin, key, enabled, affectedUserId);
                }
            } else {
                throw new IllegalStateException("Non-DO/Non-PO cannot set restriction " + key
                        + " while targetSdkVersion is less than UPSIDE_DOWN_CAKE");
            }
        }
    }
@@ -13299,7 +13302,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        logUserRestrictionCall(key, /* enabled= */ true, /* parent= */ false, caller);
    }
    private void setLocalUserRestrictionInternal(
            EnforcingAdmin admin, String key, boolean enabled, int userId) {
        PolicyDefinition<Boolean> policyDefinition =
@@ -13317,7 +13319,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    userId);
        }
    }
    private void setGlobalUserRestrictionInternal(
            EnforcingAdmin admin, String key, boolean enabled) {
        PolicyDefinition<Boolean> policyDefinition =