diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 134cfa12b0ee7..e1542a8503fc5 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -1578,18 +1578,13 @@ public class StorageManager { } /** {@hide} - * Is this device encryptable or already encrypted? - * @return true for encryptable or encrypted - * false not encrypted and not encryptable - */ - public static boolean isEncryptable() { - return RoSystemProperties.CRYPTO_ENCRYPTABLE; - } - - /** {@hide} - * Is this device already encrypted? - * @return true for encrypted. (Implies isEncryptable() == true) - * false not encrypted + * Is this device encrypted? + *
+ * Note: all devices launching with Android 10 (API level 29) or later are + * required to be encrypted. This should only ever return false for + * in-development devices on which encryption has not yet been configured. + * + * @return true if encrypted, false if not encrypted */ public static boolean isEncrypted() { return RoSystemProperties.CRYPTO_ENCRYPTED; @@ -1598,7 +1593,7 @@ public class StorageManager { /** {@hide} * Is this device file encrypted? * @return true for file encrypted. (Implies isEncrypted() == true) - * false not encrypted or block encrypted + * false not encrypted or using "managed" encryption */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static boolean isFileEncryptedNativeOnly() { @@ -1608,54 +1603,6 @@ public class StorageManager { return RoSystemProperties.CRYPTO_FILE_ENCRYPTED; } - /** {@hide} - * Is this device block encrypted? - * @return true for block encrypted. (Implies isEncrypted() == true) - * false not encrypted or file encrypted - */ - public static boolean isBlockEncrypted() { - return false; - } - - /** {@hide} - * Is this device block encrypted with credentials? - * @return true for crediential block encrypted. - * (Implies isBlockEncrypted() == true) - * false not encrypted, file encrypted or default block encrypted - */ - public static boolean isNonDefaultBlockEncrypted() { - return false; - } - - /** {@hide} - * Is this device in the process of being block encrypted? - * @return true for encrypting. - * false otherwise - * Whether device isEncrypted at this point is undefined - * Note that only system services and CryptKeeper will ever see this return - * true - no app will ever be launched in this state. - * Also note that this state will not change without a teardown of the - * framework, so no service needs to check for changes during their lifespan - */ - public static boolean isBlockEncrypting() { - return false; - } - - /** {@hide} - * Is this device non default block encrypted and in the process of - * prompting for credentials? - * @return true for prompting for credentials. - * (Implies isNonDefaultBlockEncrypted() == true) - * false otherwise - * Note that only system services and CryptKeeper will ever see this return - * true - no app will ever be launched in this state. - * Also note that this state will not change without a teardown of the - * framework, so no service needs to check for changes during their lifespan - */ - public static boolean inCryptKeeperBounce() { - return false; - } - /** {@hide} */ public static boolean isFileEncryptedEmulatedOnly() { return SystemProperties.getBoolean(StorageManager.PROP_EMULATE_FBE, false); diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index 8b659f9276339..98d81c9598b8f 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -60,14 +60,10 @@ public class RoSystemProperties { public static final CryptoProperties.type_values CRYPTO_TYPE = CryptoProperties.type().orElse(CryptoProperties.type_values.NONE); // These are pseudo-properties - public static final boolean CRYPTO_ENCRYPTABLE = - CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED; public static final boolean CRYPTO_ENCRYPTED = CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED; public static final boolean CRYPTO_FILE_ENCRYPTED = CRYPTO_TYPE == CryptoProperties.type_values.FILE; - public static final boolean CRYPTO_BLOCK_ENCRYPTED = - CRYPTO_TYPE == CryptoProperties.type_values.BLOCK; public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG = "log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 1748f5b3d3eab..5e95a785a3e5c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -1497,23 +1497,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return StorageManager.isFileEncryptedNativeOnly(); } - boolean storageManagerIsNonDefaultBlockEncrypted() { - final long identity = Binder.clearCallingIdentity(); - try { - return StorageManager.isNonDefaultBlockEncrypted(); - } finally { - Binder.restoreCallingIdentity(identity); - } - } - - boolean storageManagerIsEncrypted() { - return StorageManager.isEncrypted(); - } - - boolean storageManagerIsEncryptable() { - return StorageManager.isEncryptable(); - } - Looper getMyLooper() { return Looper.myLooper(); } @@ -7673,21 +7656,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { /** * Hook to low-levels: Reporting the current status of encryption. - * @return A value such as {@link DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED}, - * {@link DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE}, - * {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY}, - * {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER}, or - * {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE}. + * @return Either {@link DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED} + * or {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE_PER_USER}. */ private int getEncryptionStatus() { if (mInjector.storageManagerIsFileBasedEncryptionEnabled()) { return DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER; - } else if (mInjector.storageManagerIsNonDefaultBlockEncrypted()) { - return DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE; - } else if (mInjector.storageManagerIsEncrypted()) { - return DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY; - } else if (mInjector.storageManagerIsEncryptable()) { - return DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE; } else { return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED; } diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java index 61d7ede98f45d..59236dccda4b9 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java @@ -254,21 +254,6 @@ public class DevicePolicyManagerServiceTestable extends DevicePolicyManagerServi return services.storageManager.isFileBasedEncryptionEnabled(); } - @Override - boolean storageManagerIsNonDefaultBlockEncrypted() { - return services.storageManager.isNonDefaultBlockEncrypted(); - } - - @Override - boolean storageManagerIsEncrypted() { - return services.storageManager.isEncrypted(); - } - - @Override - boolean storageManagerIsEncryptable() { - return services.storageManager.isEncryptable(); - } - @Override String getDevicePolicyFilePathForSystemUser() { return services.systemUserDataDir.getAbsolutePath() + "/"; diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java b/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java index 8a2919d552167..248af0e9025da 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java @@ -492,18 +492,6 @@ public class MockSystemServices { public boolean isFileBasedEncryptionEnabled() { return false; } - - public boolean isNonDefaultBlockEncrypted() { - return false; - } - - public boolean isEncrypted() { - return false; - } - - public boolean isEncryptable() { - return false; - } } // We have to keep track of broadcast receivers registered for a given intent ourselves as the