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

Commit dd872c7a authored by Kholoud Mohamed's avatar Kholoud Mohamed
Browse files

Don't enforce policies that has the flag turned off

Bug: 326662716
Test: N/A
Change-Id: I9fcca11eeb2798f05e0b04f907de7d8d03644d24
parent 977ee2d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23389,7 +23389,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                DEFAULT_VALUE_PERMISSION_BASED_ACCESS_FLAG);
    }
    private boolean isUnicornFlagEnabled() {
    static boolean isUnicornFlagEnabled() {
        return false;
    }
+8 −0
Original line number Diff line number Diff line
@@ -66,6 +66,10 @@ final class PolicyEnforcerCallbacks {
    private static final String LOG_TAG = "PolicyEnforcerCallbacks";

    static boolean setAutoTimezoneEnabled(@Nullable Boolean enabled, @NonNull Context context) {
        if (!DevicePolicyManagerService.isUnicornFlagEnabled()) {
            Slogf.w(LOG_TAG, "Trying to enforce setAutoTimezoneEnabled while flag is off.");
            return true;
        }
        return Binder.withCleanCallingIdentity(() -> {
            Objects.requireNonNull(context);

@@ -79,6 +83,10 @@ final class PolicyEnforcerCallbacks {
    static boolean setPermissionGrantState(
            @Nullable Integer grantState, @NonNull Context context, int userId,
            @NonNull PolicyKey policyKey) {
        if (!DevicePolicyManagerService.isUnicornFlagEnabled()) {
            Slogf.w(LOG_TAG, "Trying to enforce setPermissionGrantState while flag is off.");
            return true;
        }
        return Boolean.TRUE.equals(Binder.withCleanCallingIdentity(() -> {
            if (!(policyKey instanceof PackagePermissionPolicyKey)) {
                throw new IllegalArgumentException("policyKey is not of type "