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

Commit c4457268 authored by Alex Kershaw's avatar Alex Kershaw Committed by android-build-merger
Browse files

Merge "Fix Javadoc of DevicePolicyManager#setStorageEncryption to reflect that...

Merge "Fix Javadoc of DevicePolicyManager#setStorageEncryption to reflect that it's a no-op (and silent fail) when called from a non-system user." into pi-dev
am: 56be97ed

Change-Id: I26c48173f62c19c437a6f24bd63159f80e3f6fb1
parents 3276d94b 56be97ed
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
@@ -6465,8 +6465,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) {
@@ -6481,7 +6484,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,