Give easy flag to disable Direct Boot emulation.

Direct Boot emulation is encouraged to help developers test their
apps, but it's not required.

Test: cts-tradefed run cts-dev --module CtsAppSecurityHostTestCases --test android.appsecurity.cts.DirectBootHostTest#testDirectBootEmulated
Bug: 30686636
Change-Id: I3bb2dd42c0f71e52d8b7cf8da7e50568f41aafb7
This commit is contained in:
Jeff Sharkey
2016-11-04 14:45:24 -06:00
parent 99449eea6c
commit 00455bf0fe

View File

@@ -201,6 +201,15 @@ class MountService extends IMountService.Stub
// Disable this since it messes up long-running cryptfs operations.
private static final boolean WATCHDOG_ENABLE = false;
/**
* Our goal is for all Android devices to be usable as development devices,
* which includes the new Direct Boot mode added in N. For devices that
* don't have native FBE support, we offer an emulation mode for developer
* testing purposes, but if it's prohibitively difficult to support this
* mode, it can be disabled for specific products using this flag.
*/
private static final boolean EMULATE_FBE_SUPPORTED = true;
private static final String TAG = "MountService";
private static final String TAG_STORAGE_BENCHMARK = "storage_benchmark";
@@ -1978,9 +1987,13 @@ class MountService extends IMountService.Stub
waitForReady();
if ((mask & StorageManager.DEBUG_EMULATE_FBE) != 0) {
if (!EMULATE_FBE_SUPPORTED) {
throw new IllegalStateException(
"Emulation not supported on this device");
}
if (StorageManager.isFileEncryptedNativeOnly()) {
throw new IllegalStateException(
"Emulation not available on device with native FBE");
"Emulation not supported on device with native FBE");
}
if (mLockPatternUtils.isCredentialRequiredToDecrypt(false)) {
throw new IllegalStateException(