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

Commit 61ec8255 authored by Alex Kershaw's avatar Alex Kershaw
Browse files

Fix Javadoc of DevicePolicyManager#setStorageEncryption to reflect that

it's a no-op (and silent fail) when called from a non-system user.

DevicePolicyManagerService#setStorageEncryption also has its Javadoc
fixed.

Bug: 74591983
Change-Id: Ie191ad255cbfcade921d172641f134d6c49a17b1
Fixes: 74591983
Test: N/A - just javadoc changed
parent d65bb202
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -3769,7 +3769,7 @@ public class DevicePolicyManager {

    /**
     * Called by an application that is administering the device to request that the storage system
     * be encrypted.
     * be encrypted. Does nothing if the caller is on a secondary user or a managed profile.
     * <p>
     * When multiple device administrators attempt to control device encryption, the most secure,
     * supported setting will always be used. If any device administrator requests device
@@ -3791,10 +3791,13 @@ public class DevicePolicyManager {
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param encrypt true to request encryption, false to release any previous request
     * @return the new request status (for all active admins) - will be one of
     *         {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE}, or
     *         {@link #ENCRYPTION_STATUS_ACTIVE}. This is the value of the requests; Use
     *         {@link #getStorageEncryptionStatus()} to query the actual device state.
     * @return the new total request status (for all active admins), or {@link
     *         DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED} if called for a non-system user.
     *         Will be one of {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link
     *         #ENCRYPTION_STATUS_INACTIVE}, or {@link #ENCRYPTION_STATUS_ACTIVE}. This is the value
     *         of the requests; use {@link #getStorageEncryptionStatus()} to query the actual device
     *         state.
     *
     * @throws SecurityException if {@code admin} is not an active administrator or does not use
     *             {@link DeviceAdminInfo#USES_ENCRYPTED_STORAGE}
     */
+6 −3
Original line number Diff line number Diff line
@@ -6466,8 +6466,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    /**
     * Set the storage encryption request for a single admin.  Returns the new total request
     * status (for all admins).
     * Called by an application that is administering the device to request that the storage system
     * be encrypted. Does nothing if the caller is on a secondary user or a managed profile.
     *
     * @return the new total request status (for all admins), or {@link
     *         DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED} if called for a non-system user
     */
    @Override
    public int setStorageEncryption(ComponentName who, boolean encrypt) {
@@ -6482,7 +6485,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            if (userHandle != UserHandle.USER_SYSTEM) {
                Slog.w(LOG_TAG, "Only owner/system user is allowed to set storage encryption. User "
                        + UserHandle.getCallingUserId() + " is not permitted.");
                return 0;
                return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
            }
            ActiveAdmin ap = getActiveAdminForCallerLocked(who,