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

Commit 63ca2c3c authored by Elis Elliott's avatar Elis Elliott Committed by Automerger Merge Worker
Browse files

Merge "Assortment of fixes for APIs used by unicorn" into udc-dev am: 504d36ca am: c571820d

parents a28a3b1d c571820d
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -15470,12 +15470,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        int userId = caller.getUserId();
        synchronized (getLockObject()) {
            if (!isPermissionCheckFlagEnabled()) {
                Preconditions.checkCallAuthorization(isUserAffiliatedWithDeviceLocked(userId),
                    "Admin " + who
                            + " is neither the device owner or affiliated user's profile owner.");
                        "Admin " + who + " is neither the device owner or affiliated "
                                + "user's profile owner.");
                if (isManagedProfile(userId)) {
                    throw new SecurityException("Managed profile cannot disable status bar");
                }
            }
            checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_SET_STATUS_BAR_DISABLED);
            DevicePolicyData policy = getUserData(userId);
@@ -15527,17 +15529,24 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    @Override
    public boolean isStatusBarDisabled(String callerPackage) {
        final CallerIdentity caller = getCallerIdentity(callerPackage);
        if (isPermissionCheckFlagEnabled()) {
            enforceCanQuery(
                    MANAGE_DEVICE_POLICY_STATUS_BAR, caller.getPackageName(), caller.getUserId());
        } else {
            Preconditions.checkCallAuthorization(
                    isProfileOwner(caller) || isDefaultDeviceOwner(caller));
        }
        int userId = caller.getUserId();
        synchronized (getLockObject()) {
            if (!isPermissionCheckFlagEnabled()) {
                Preconditions.checkCallAuthorization(isUserAffiliatedWithDeviceLocked(userId),
                        "Admin " + callerPackage
                                + " is neither the device owner or affiliated user's profile owner.");
                if (isManagedProfile(userId)) {
                    throw new SecurityException("Managed profile cannot disable status bar");
                }
            }
            DevicePolicyData policy = getUserData(userId);
            return policy.mStatusBarDisabled;
        }
@@ -22828,7 +22837,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    MANAGE_DEVICE_POLICY_PROFILE_INTERACTION,
                    MANAGE_DEVICE_POLICY_SAFE_BOOT,
                    MANAGE_DEVICE_POLICY_SMS,
                    MANAGE_DEVICE_POLICY_STATUS_BAR,
                    MANAGE_DEVICE_POLICY_SYSTEM_DIALOGS,
                    MANAGE_DEVICE_POLICY_USB_FILE_TRANSFER,
                    MANAGE_DEVICE_POLICY_USERS,
@@ -22849,7 +22857,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
     * All the additional permissions granted to a Profile Owner on an affiliated user.
     */
    private static final List<String> ADDITIONAL_AFFILIATED_PROFILE_OWNER_ON_USER_PERMISSIONS =
            List.of();
            List.of(
                    MANAGE_DEVICE_POLICY_STATUS_BAR
            );
    /**
     * Combination of {@link PROFILE_OWNER_PERMISSIONS} and