Merge "Update shared sandbox prefix to "shared-"."
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index d679fc7..423ce77 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -268,6 +268,9 @@
public static final int ENCRYPTION_STATE_ERROR_CORRUPT =
IVold.ENCRYPTION_STATE_ERROR_CORRUPT;
+ /** @hide Prefix used in sandboxIds for apps with sharedUserIds */
+ public static final String SHARED_SANDBOX_PREFIX = "shared-";
+
private static volatile IStorageManager sStorageManager = null;
private final Context mContext;
diff --git a/core/tests/packagemanagertests/src/android/content/pm/KernelPackageMappingTests.java b/core/tests/packagemanagertests/src/android/content/pm/KernelPackageMappingTests.java
index 01382aa..4e0f2a8 100644
--- a/core/tests/packagemanagertests/src/android/content/pm/KernelPackageMappingTests.java
+++ b/core/tests/packagemanagertests/src/android/content/pm/KernelPackageMappingTests.java
@@ -81,7 +81,7 @@
@Test
public void testSharedInstalledPrimary() throws Exception {
- assertEquals("1001", getContent(getKernelPackageFile("shared:android.uid.phone", "appid")));
+ assertEquals("1001", getContent(getKernelPackageFile("shared-android.uid.phone", "appid")));
}
@Test
@@ -92,7 +92,7 @@
@Test
public void testSharedInstalledAll() throws Exception {
- assertEquals("", getContent(getKernelPackageFile("shared:android.uid.phone",
+ assertEquals("", getContent(getKernelPackageFile("shared-android.uid.phone",
"excluded_userids")));
}
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 78e82b6..923ac00 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -186,8 +186,6 @@
private static final boolean ENABLE_ISOLATED_STORAGE = SystemProperties
.getBoolean(StorageManager.PROP_ISOLATED_STORAGE, false);
- private static final String SHARED_SANDBOX_ID_PREFIX = "shared:";
-
public static class Lifecycle extends SystemService {
private StorageManagerService mStorageManagerService;
@@ -1501,7 +1499,8 @@
}
private static String getSandboxId(String packageName, String sharedUserId) {
- return sharedUserId == null ? packageName : SHARED_SANDBOX_ID_PREFIX + sharedUserId;
+ return sharedUserId == null
+ ? packageName : StorageManager.SHARED_SANDBOX_PREFIX + sharedUserId;
}
private void connect() {
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 4c93441..6009bd3 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -2637,7 +2637,7 @@
}
for (final SharedUserSetting sus : mSharedUsers.values()) {
- knownSet.remove(sus.getSandboxName());
+ knownSet.remove(sus.getStorageSandboxName());
}
// Remove any unclaimed mappings
@@ -2653,7 +2653,8 @@
void writeKernelMappingLPr(SharedUserSetting sus) {
if (mKernelMappingFilename == null || sus == null || sus.name == null) return;
- writeKernelMappingLPr(sus.getSandboxName(), sus.userId, sus.getNotInstalledUserIds());
+ writeKernelMappingLPr(sus.getStorageSandboxName(),
+ sus.userId, sus.getNotInstalledUserIds());
}
void writeKernelMappingLPr(PackageSetting ps) {
diff --git a/services/core/java/com/android/server/pm/SharedUserSetting.java b/services/core/java/com/android/server/pm/SharedUserSetting.java
index 32826e5..d67144e 100644
--- a/services/core/java/com/android/server/pm/SharedUserSetting.java
+++ b/services/core/java/com/android/server/pm/SharedUserSetting.java
@@ -19,6 +19,7 @@
import android.annotation.Nullable;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageParser;
+import android.os.storage.StorageManager;
import android.service.pm.PackageServiceDumpProto;
import android.util.ArraySet;
import android.util.proto.ProtoOutputStream;
@@ -166,8 +167,8 @@
return excludedUserIds == null ? EmptyArray.INT : excludedUserIds;
}
- public String getSandboxName() {
- return "shared:" + name;
+ public String getStorageSandboxName() {
+ return StorageManager.SHARED_SANDBOX_PREFIX + name;
}
/** Updates all fields in this shared user setting from another. */
diff --git a/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java
index ee42ce8..e6b328a 100644
--- a/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java
@@ -125,7 +125,7 @@
"/storage/emulated/0/foo.jpg",
PID_GREY, UID_GREY);
assertTranslation(
- "/storage/emulated/0/Android/sandbox/shared:colors/foo.jpg",
+ "/storage/emulated/0/Android/sandbox/shared-colors/foo.jpg",
"/storage/emulated/0/foo.jpg",
PID_RED, UID_COLORS);
}
@@ -137,7 +137,7 @@
"/storage/0000-0000/foo/bar.jpg",
PID_GREY, UID_GREY);
assertTranslation(
- "/storage/0000-0000/Android/sandbox/shared:colors/foo/bar.jpg",
+ "/storage/0000-0000/Android/sandbox/shared-colors/foo/bar.jpg",
"/storage/0000-0000/foo/bar.jpg",
PID_RED, UID_COLORS);
}
@@ -152,7 +152,7 @@
// Accessing other package paths goes into sandbox
assertTranslation(
- "/storage/emulated/0/Android/sandbox/shared:colors/"
+ "/storage/emulated/0/Android/sandbox/shared-colors/"
+ "Android/data/com.grey/foo.jpg",
"/storage/emulated/0/Android/data/com.grey/foo.jpg",
PID_RED, UID_COLORS);
@@ -201,7 +201,7 @@
// Sandboxes can't see paths in other sandboxes
try {
mService.translateSystemToApp(
- "/storage/emulated/0/Android/sandbox/shared:colors/foo.jpg",
+ "/storage/emulated/0/Android/sandbox/shared-colors/foo.jpg",
PID_GREY, UID_GREY);
fail();
} catch (SecurityException expected) {