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

Commit 15c346f7 authored by Kholoud Mohamed's avatar Kholoud Mohamed Committed by Android (Google) Code Review
Browse files

Merge "Add getter API for statusBarDisabled policy"

parents b7b428cc 4aded5d3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7901,6 +7901,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
@@ -12585,6 +12585,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
@@ -13776,6 +13776,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