Merge "Tentative attempt at disabling ASECs."
This commit is contained in:
@@ -211,6 +211,9 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
// Disable this since it messes up long-running cryptfs operations.
|
||||
private static final boolean WATCHDOG_ENABLE = false;
|
||||
|
||||
/** Flag to enable ASECs */
|
||||
private static final boolean ASEC_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
|
||||
@@ -1064,7 +1067,9 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
// Let package manager load internal ASECs.
|
||||
mPms.scanAvailableAsecs();
|
||||
if (ASEC_ENABLE) {
|
||||
mPms.scanAvailableAsecs();
|
||||
}
|
||||
|
||||
// Notify people waiting for ASECs to be scanned that it's done.
|
||||
mAsecsScanned.countDown();
|
||||
@@ -2314,6 +2319,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public String[] getSecureContainerList() {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_ACCESS);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2328,6 +2334,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
|
||||
public int createSecureContainer(String id, int sizeMb, String fstype, String key,
|
||||
int ownerUid, boolean external) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_CREATE);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2350,6 +2357,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
|
||||
@Override
|
||||
public int resizeSecureContainer(String id, int sizeMb, String key) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_CREATE);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2364,6 +2372,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int finalizeSecureContainer(String id) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_CREATE);
|
||||
warnOnNotMounted();
|
||||
|
||||
@@ -2381,6 +2390,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int fixPermissionsSecureContainer(String id, int gid, String filename) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_CREATE);
|
||||
warnOnNotMounted();
|
||||
|
||||
@@ -2398,6 +2408,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int destroySecureContainer(String id, boolean force) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_DESTROY);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2438,6 +2449,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int mountSecureContainer(String id, String key, int ownerUid, boolean readOnly) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_MOUNT_UNMOUNT);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2468,6 +2480,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int unmountSecureContainer(String id, boolean force) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_MOUNT_UNMOUNT);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2511,6 +2524,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public boolean isSecureContainerMounted(String id) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_ACCESS);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2521,6 +2535,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public int renameSecureContainer(String oldId, String newId) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_RENAME);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2546,6 +2561,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public String getSecureContainerPath(String id) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_ACCESS);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
@@ -2567,6 +2583,7 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
|
||||
public String getSecureContainerFilesystemPath(String id) {
|
||||
if (!ASEC_ENABLE) throw new UnsupportedOperationException();
|
||||
enforcePermission(android.Manifest.permission.ASEC_ACCESS);
|
||||
waitForReady();
|
||||
warnOnNotMounted();
|
||||
|
||||
Reference in New Issue
Block a user