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

Commit d25fe2e5 authored by Rafael Prado's avatar Rafael Prado Committed by Android (Google) Code Review
Browse files

Merge "Allow callers that have SET_TIME and SET_TIME_ZONE permissions to call...

Merge "Allow callers that have SET_TIME and SET_TIME_ZONE permissions to call getAutoTimeEnabled and getAutoTimeZoneEnabled respectively." into main
parents 4dba1a5c 93b4e725
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -9085,11 +9085,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        CallerIdentity caller = getCallerIdentity(who);
        if (!Flags.setAutoTimeEnabledCoexistence()) {
        if (Flags.setAutoTimeEnabledCoexistence()) {
            Preconditions.checkCallAuthorization(hasPermission(SET_TIME, caller.getPackageName()));
        } else {
            Objects.requireNonNull(who, "ComponentName is null");
        }
            Preconditions.checkCallAuthorization(isProfileOwnerOnUser0(caller)
                || isProfileOwnerOfOrganizationOwnedDevice(caller) || isDefaultDeviceOwner(caller));
        }
        return mInjector.settingsGlobalGetInt(Global.AUTO_TIME, 0) > 0;
    }
@@ -9166,10 +9168,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        CallerIdentity caller = getCallerIdentity(who);
        if (!Flags.setAutoTimeZoneEnabledCoexistence()) {
        Objects.requireNonNull(who, "ComponentName is null");
        }
        Preconditions.checkCallAuthorization(isProfileOwnerOnUser0(caller)
                || isProfileOwnerOfOrganizationOwnedDevice(caller) || isDefaultDeviceOwner(
                caller));
@@ -9193,10 +9192,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        CallerIdentity caller = getCallerIdentity(who);
        if (Flags.setAutoTimeZoneEnabledCoexistence()) {
            Preconditions.checkCallAuthorization(
                hasPermission(SET_TIME_ZONE, caller.getPackageName()));
        } else {
            Objects.requireNonNull(who, "ComponentName is null");
            Preconditions.checkCallAuthorization(isProfileOwnerOnUser0(caller)
                || isProfileOwnerOfOrganizationOwnedDevice(caller) || isDefaultDeviceOwner(
                caller));
        }
        return mInjector.settingsGlobalGetInt(Global.AUTO_TIME_ZONE, 0) > 0;
    }