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

Commit 4aded5d3 authored by Kholoud Mohamed's avatar Kholoud Mohamed
Browse files

Add getter API for statusBarDisabled policy

Bug: 232918480
Test: btest android.devicepolicy.cts.StatusBarTest
Change-Id: Ie4c7f28510d34450a94b132a41ba727b22c506dd
parent 65dff07e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7848,6 +7848,7 @@ package android.app.admin {
    method public boolean isResetPasswordTokenActive(android.content.ComponentName);
    method public boolean isSafeOperation(int);
    method public boolean isSecurityLoggingEnabled(@Nullable android.content.ComponentName);
    method public boolean isStatusBarDisabled();
    method public boolean isUninstallBlocked(@Nullable android.content.ComponentName, String);
    method public boolean isUniqueDeviceAttestationSupported();
    method public boolean isUsbDataSignalingEnabled();
+27 −0
Original line number Diff line number Diff line
@@ -12570,6 +12570,33 @@ public class DevicePolicyManager {
        }
    }
    /**
     * Returns whether the status bar is disabled/enabled, see {@link #setStatusBarDisabled}.
     *
     * <p>Callable by device owner or profile owner of secondary users that is affiliated with the
     * device owner.
     *
     * <p>This policy has no effect in LockTask mode. The behavior of the
     * status bar in LockTask mode can be configured with
     * {@link #setLockTaskFeatures(ComponentName, int)}.
     *
     * <p>This policy also does not have any effect while on the lock screen, where the status bar
     * will not be disabled.
     *
     * @throws SecurityException if the caller is not the device owner, or a profile owner of
     * secondary user that is affiliated with the device.
     * @see #isAffiliatedUser
     * @see #getSecondaryUsers
     */
    public boolean isStatusBarDisabled() {
        throwIfParentInstance("isStatusBarDisabled");
        try {
            return mService.isStatusBarDisabled(mContext.getPackageName());
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }
    /**
     * Called by the system update service to notify device and profile owners of pending system
     * updates.
+1 −0
Original line number Diff line number Diff line
@@ -379,6 +379,7 @@ interface IDevicePolicyManager {

    boolean setKeyguardDisabled(in ComponentName admin, boolean disabled);
    boolean setStatusBarDisabled(in ComponentName who, boolean disabled);
    boolean isStatusBarDisabled(in String callerPackage);
    boolean getDoNotAskCredentialsOnBoot();

    void notifyPendingSystemUpdate(in SystemUpdateInfo info);
+20 −0
Original line number Diff line number Diff line
@@ -13771,6 +13771,26 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        return false;
    }
    @Override
    public boolean isStatusBarDisabled(String callerPackage) {
        final CallerIdentity caller = getCallerIdentity(callerPackage);
        Preconditions.checkCallAuthorization(
                isProfileOwner(caller) || isDefaultDeviceOwner(caller));
        int userId = caller.getUserId();
        synchronized (getLockObject()) {
            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;
        }
    }
    /**
     * We need to update the internal state of whether a user has completed setup or a
     * device has paired once. After that, we ignore any changes that reset the