Remove storage sandboxes related code.

Bug: 131115422
Test: manual
Test: atest --test-mapping packages/providers/MediaProvider
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
Test: atest DownloadProviderTests
Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java
Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java
Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java
Change-Id: Ib3272a47a901ed106474039e72f123b11f5443ff
Merged-In: Ib3272a47a901ed106474039e72f123b11f5443ff
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index eb40d84..84c06f1 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -147,69 +147,6 @@
     return ok();
 }
 
-binder::Status checkArgumentPackageName(const std::string& packageName) {
-    // This logic is borrowed from PackageParser.java
-    bool hasSep = false;
-    bool front = true;
-
-    for (size_t i = 0; i < packageName.length(); ++i) {
-        char c = packageName[i];
-        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
-            front = false;
-            continue;
-        }
-        if (!front) {
-            if ((c >= '0' && c <= '9') || c == '_') {
-                continue;
-            }
-        }
-        if (c == '.') {
-            hasSep = true;
-            front = true;
-            continue;
-        }
-        return exception(binder::Status::EX_ILLEGAL_ARGUMENT,
-                         StringPrintf("Bad package character %c in %s", c, packageName.c_str()));
-    }
-
-    if (front) {
-        return exception(binder::Status::EX_ILLEGAL_ARGUMENT,
-                         StringPrintf("Missing separator in %s", packageName.c_str()));
-    }
-
-    return ok();
-}
-
-binder::Status checkArgumentPackageNames(const std::vector<std::string>& packageNames) {
-    for (size_t i = 0; i < packageNames.size(); ++i) {
-        binder::Status status = checkArgumentPackageName(packageNames[i]);
-        if (!status.isOk()) {
-            return status;
-        }
-    }
-    return ok();
-}
-
-binder::Status checkArgumentSandboxId(const std::string& sandboxId) {
-    // sandboxId will be in either the format shared-<shared-user-id> or <package-name>
-    // and <shared-user-id> name has same requirements as <package-name>.
-    std::size_t nameStartIndex = 0;
-    if (android::base::StartsWith(sandboxId, "shared-")) {
-        nameStartIndex = 7;  // len("shared-")
-    }
-    return checkArgumentPackageName(sandboxId.substr(nameStartIndex));
-}
-
-binder::Status checkArgumentSandboxIds(const std::vector<std::string>& sandboxIds) {
-    for (size_t i = 0; i < sandboxIds.size(); ++i) {
-        binder::Status status = checkArgumentSandboxId(sandboxIds[i]);
-        if (!status.isOk()) {
-            return status;
-        }
-    }
-    return ok();
-}
-
 #define ENFORCE_UID(uid)                         \
     {                                            \
         binder::Status status = checkUid((uid)); \
@@ -242,38 +179,6 @@
         }                                                \
     }
 
-#define CHECK_ARGUMENT_PACKAGE_NAMES(packageNames)                         \
-    {                                                                      \
-        binder::Status status = checkArgumentPackageNames((packageNames)); \
-        if (!status.isOk()) {                                              \
-            return status;                                                 \
-        }                                                                  \
-    }
-
-#define CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds)                         \
-    {                                                                  \
-        binder::Status status = checkArgumentSandboxIds((sandboxIds)); \
-        if (!status.isOk()) {                                          \
-            return status;                                             \
-        }                                                              \
-    }
-
-#define CHECK_ARGUMENT_PACKAGE_NAME(packageName)                         \
-    {                                                                    \
-        binder::Status status = checkArgumentPackageName((packageName)); \
-        if (!status.isOk()) {                                            \
-            return status;                                               \
-        }                                                                \
-    }
-
-#define CHECK_ARGUMENT_SANDBOX_ID(sandboxId)                         \
-    {                                                                \
-        binder::Status status = checkArgumentSandboxId((sandboxId)); \
-        if (!status.isOk()) {                                        \
-            return status;                                           \
-        }                                                            \
-    }
-
 #define ACQUIRE_LOCK                                                        \
     std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock()); \
     ATRACE_CALL();
@@ -357,17 +262,11 @@
     return translate(VolumeManager::Instance()->onUserRemoved(userId));
 }
 
-binder::Status VoldNativeService::onUserStarted(int32_t userId,
-                                                const std::vector<std::string>& packageNames,
-                                                const std::vector<int>& appIds,
-                                                const std::vector<std::string>& sandboxIds) {
+binder::Status VoldNativeService::onUserStarted(int32_t userId) {
     ENFORCE_UID(AID_SYSTEM);
-    CHECK_ARGUMENT_PACKAGE_NAMES(packageNames);
-    CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds);
     ACQUIRE_LOCK;
 
-    return translate(
-        VolumeManager::Instance()->onUserStarted(userId, packageNames, appIds, sandboxIds));
+    return translate(VolumeManager::Instance()->onUserStarted(userId));
 }
 
 binder::Status VoldNativeService::onUserStopped(int32_t userId) {
@@ -379,20 +278,12 @@
 
 binder::Status VoldNativeService::addAppIds(const std::vector<std::string>& packageNames,
                                             const std::vector<int32_t>& appIds) {
-    ENFORCE_UID(AID_SYSTEM);
-    CHECK_ARGUMENT_PACKAGE_NAMES(packageNames);
-    ACQUIRE_LOCK;
-
-    return translate(VolumeManager::Instance()->addAppIds(packageNames, appIds));
+    return ok();
 }
 
 binder::Status VoldNativeService::addSandboxIds(const std::vector<int32_t>& appIds,
                                                 const std::vector<std::string>& sandboxIds) {
-    ENFORCE_UID(AID_SYSTEM);
-    CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds);
-    ACQUIRE_LOCK;
-
-    return translate(VolumeManager::Instance()->addSandboxIds(appIds, sandboxIds));
+    return ok();
 }
 
 binder::Status VoldNativeService::onSecureKeyguardStateChanged(bool isShowing) {
@@ -916,25 +807,13 @@
 binder::Status VoldNativeService::prepareSandboxForApp(const std::string& packageName,
                                                        int32_t appId, const std::string& sandboxId,
                                                        int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
-    CHECK_ARGUMENT_PACKAGE_NAME(packageName);
-    CHECK_ARGUMENT_SANDBOX_ID(sandboxId);
-    ACQUIRE_LOCK;
-
-    return translate(
-        VolumeManager::Instance()->prepareSandboxForApp(packageName, appId, sandboxId, userId));
+    return ok();
 }
 
 binder::Status VoldNativeService::destroySandboxForApp(const std::string& packageName,
                                                        const std::string& sandboxId,
                                                        int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
-    CHECK_ARGUMENT_PACKAGE_NAME(packageName);
-    CHECK_ARGUMENT_SANDBOX_ID(sandboxId);
-    ACQUIRE_LOCK;
-
-    return translate(
-        VolumeManager::Instance()->destroySandboxForApp(packageName, sandboxId, userId));
+    return ok();
 }
 
 binder::Status VoldNativeService::startCheckpoint(int32_t retry) {