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

Commit 3bdb4cbc authored by Eric Biggers's avatar Eric Biggers
Browse files

Deprecate FDE constants from DevicePolicyManager

Deprecate the DevicePolicyManager.ENCRYPTION_STATUS_* constants that can
no longer be returned by
DevicePolicyManager.getStorageEncryptionStatus() due to them being
specific to Full Disk Encryption.

Also update DevicePolicyManagerService.getEncryptionStatusName() to stop
referring to the deprecated constants when it doesn't need to.

This is a follow-up from "Drop FDE status checks from
DevicePolicyManagerService" (https://r.android.com/2052073).

Bug: 208476087
Change-Id: I7110711dfc3d32045ee443dc1ae00e8efb4f8d6e
parent 8da02ad3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -7673,11 +7673,11 @@ package android.app.admin {
    field public static final String DELEGATION_PACKAGE_ACCESS = "delegation-package-access";
    field public static final String DELEGATION_PERMISSION_GRANT = "delegation-permission-grant";
    field public static final String DELEGATION_SECURITY_LOGGING = "delegation-security-logging";
    field public static final int ENCRYPTION_STATUS_ACTIVATING = 2; // 0x2
    field public static final int ENCRYPTION_STATUS_ACTIVE = 3; // 0x3
    field public static final int ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY = 4; // 0x4
    field @Deprecated public static final int ENCRYPTION_STATUS_ACTIVATING = 2; // 0x2
    field @Deprecated public static final int ENCRYPTION_STATUS_ACTIVE = 3; // 0x3
    field @Deprecated public static final int ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY = 4; // 0x4
    field public static final int ENCRYPTION_STATUS_ACTIVE_PER_USER = 5; // 0x5
    field public static final int ENCRYPTION_STATUS_INACTIVE = 1; // 0x1
    field @Deprecated public static final int ENCRYPTION_STATUS_INACTIVE = 1; // 0x1
    field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0
    field public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
    field public static final String EXTRA_DELEGATION_SCOPES = "android.app.extra.DELEGATION_SCOPES";
+20 −0
Original line number Diff line number Diff line
@@ -6472,12 +6472,22 @@ public class DevicePolicyManager {
    public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0;
    /**
     * @deprecated {@link #getStorageEncryptionStatus} could only return this value on devices that
     * use Full Disk Encryption.  However, support for Full Disk Encryption was entirely removed in
     * API level 33, being replaced by File Based Encryption.  {@link #setStorageEncryption} can
     * return this value for an unrelated reason, but {@link #setStorageEncryption} is deprecated
     * since it doesn't do anything useful.
     *
     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
     * indicating that encryption is supported, but is not currently active.
     */
    public static final int ENCRYPTION_STATUS_INACTIVE = 1;
    /**
     * @deprecated {@link #getStorageEncryptionStatus} could only return this value on devices that
     * use Full Disk Encryption.  However, support for Full Disk Encryption was entirely removed in
     * API level 33, being replaced by File Based Encryption.
     *
     * Result code for {@link #getStorageEncryptionStatus}:
     * indicating that encryption is not currently active, but is currently
     * being activated.  This is only reported by devices that support
@@ -6488,6 +6498,12 @@ public class DevicePolicyManager {
    public static final int ENCRYPTION_STATUS_ACTIVATING = 2;
    /**
     * @deprecated {@link #getStorageEncryptionStatus} could only return this value for apps
     * targeting API level 23 or lower, or on devices that use Full Disk Encryption.  However,
     * support for Full Disk Encryption was entirely removed in API level 33, being replaced by File
     * Based Encryption.  {@link #setStorageEncryption} can return this value for an unrelated
     * reason, but {@link #setStorageEncryption} is deprecated since it doesn't do anything useful.
     *
     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
     * indicating that encryption is active.
     * <p>
@@ -6496,6 +6512,10 @@ public class DevicePolicyManager {
    public static final int ENCRYPTION_STATUS_ACTIVE = 3;
    /**
     * @deprecated {@link #getStorageEncryptionStatus} could only return this value on devices that
     * use Full Disk Encryption.  However, support for Full Disk Encryption was entirely removed in
     * API level 33, being replaced by File Based Encryption.
     *
     * Result code for {@link #getStorageEncryptionStatus}:
     * indicating that encryption is active, but an encryption key has not
     * been set by the user.
+0 −8
Original line number Diff line number Diff line
@@ -9861,18 +9861,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private String getEncryptionStatusName(int encryptionStatus) {
        switch (encryptionStatus) {
            case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
                return "inactive";
            case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY:
                return "block default key";
            case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
                return "block";
            case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER:
                return "per-user";
            case DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED:
                return "unsupported";
            case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING:
                return "activating";
            default:
                return "unknown";
        }