Merge changes Idc218e5f,I26c3fafc
* changes: Remove more FDE methods from StorageManager Drop FDE status checks from DevicePolicyManagerService
This commit is contained in:
@@ -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?
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() + "/";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user