Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e73ae32b authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

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: Ib8a10d3a9097c1dc4132a71782d622e9e3c3747d
parent 29ff304e
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -511,7 +511,6 @@ public class Process {
     * @param appDataDir null-ok the data directory of the app.
     * @param invokeWith null-ok the command to invoke with.
     * @param packageName null-ok the name of the package this process belongs to.
     * @param packagesForUid null-ok all the packages with the same uid as this process.
     * @param useSystemGraphicsDriver whether the process uses system graphics driver.
     *
     * @param zygoteArgs Additional arguments to supply to the zygote process.
@@ -532,14 +531,12 @@ public class Process {
                                           @Nullable String appDataDir,
                                           @Nullable String invokeWith,
                                           @Nullable String packageName,
                                           @Nullable String[] packagesForUid,
                                           @Nullable String sandboxId,
                                           boolean useSystemGraphicsDriver,
                                           @Nullable String[] zygoteArgs) {
        return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids,
                    runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                    abi, instructionSet, appDataDir, invokeWith, packageName,
                    packagesForUid, sandboxId, /*useUsapPool=*/ true,
                    /*useUsapPool=*/ true,
                    useSystemGraphicsDriver, zygoteArgs);
    }

@@ -556,14 +553,12 @@ public class Process {
                                                  @Nullable String appDataDir,
                                                  @Nullable String invokeWith,
                                                  @Nullable String packageName,
                                                  @Nullable String[] packagesForUid,
                                                  @Nullable String sandboxId,
                                                  boolean useSystemGraphicsDriver,
                                                  @Nullable String[] zygoteArgs) {
        return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
                    runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                    abi, instructionSet, appDataDir, invokeWith, packageName,
                    packagesForUid, sandboxId, /*useUsapPool=*/ false,
                    /*useUsapPool=*/ false,
                    useSystemGraphicsDriver, zygoteArgs);
    }

+1 −17
Original line number Diff line number Diff line
@@ -306,7 +306,6 @@ public class ZygoteProcess {
     * @param appDataDir null-ok the data directory of the app.
     * @param invokeWith null-ok the command to invoke with.
     * @param packageName null-ok the name of the package this process belongs to.
     * @param packagesForUid null-ok all the packages with the same uid as this process.
     * @param zygoteArgs Additional arguments to supply to the zygote process.
     * @param useSystemGraphicsDriver whether the process uses system graphics driver.
     *
@@ -324,8 +323,6 @@ public class ZygoteProcess {
                                                  @Nullable String appDataDir,
                                                  @Nullable String invokeWith,
                                                  @Nullable String packageName,
                                                  @Nullable String[] packagesForUid,
                                                  @Nullable String sandboxId,
                                                  boolean useUsapPool,
                                                  boolean useSystemGraphicsDriver,
                                                  @Nullable String[] zygoteArgs) {
@@ -338,8 +335,7 @@ public class ZygoteProcess {
            return startViaZygote(processClass, niceName, uid, gid, gids,
                    runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                    abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false,
                    packageName, packagesForUid, sandboxId,
                    useUsapPool, useSystemGraphicsDriver, zygoteArgs);
                    packageName, useUsapPool, useSystemGraphicsDriver, zygoteArgs);
        } catch (ZygoteStartFailedEx ex) {
            Log.e(LOG_TAG,
                    "Starting VM process through Zygote failed");
@@ -532,7 +528,6 @@ public class ZygoteProcess {
     * @param startChildZygote Start a sub-zygote. This creates a new zygote process
     * that has its state cloned from this zygote process.
     * @param packageName null-ok the name of the package this process belongs to.
     * @param packagesForUid null-ok all the packages with the same uid as this process.
     * @param extraArgs Additional arguments to supply to the zygote process.
     * @return An object that describes the result of the attempt to start the process.
     * @throws ZygoteStartFailedEx if process start failed for any reason
@@ -550,8 +545,6 @@ public class ZygoteProcess {
                                                      @Nullable String invokeWith,
                                                      boolean startChildZygote,
                                                      @Nullable String packageName,
                                                      @Nullable String[] packagesForUid,
                                                      @Nullable String sandboxId,
                                                      boolean useUsapPool,
                                                      boolean useSystemGraphicsDriver,
                                                      @Nullable String[] extraArgs)
@@ -625,14 +618,6 @@ public class ZygoteProcess {
            argsForZygote.add("--package-name=" + packageName);
        }

        if (packagesForUid != null && packagesForUid.length > 0) {
            argsForZygote.add("--packages-for-uid=" + String.join(",", packagesForUid));
        }

        if (sandboxId != null) {
            argsForZygote.add("--sandbox-id=" + sandboxId);
        }

        argsForZygote.add(processClass);

        if (extraArgs != null) {
@@ -1147,7 +1132,6 @@ public class ZygoteProcess {
                    gids, runtimeFlags, 0 /* mountExternal */, 0 /* targetSdkVersion */, seInfo,
                    abi, instructionSet, null /* appDataDir */, null /* invokeWith */,
                    true /* startChildZygote */, null /* packageName */,
                    null /* packagesForUid */, null /* sandboxId */,
                    false /* useUsapPool */, false /*useSystemGraphicsDriver*/,
                    extraArgs);
        } catch (ZygoteStartFailedEx ex) {
+0 −2
Original line number Diff line number Diff line
@@ -188,8 +188,6 @@ interface IStorageManager {
    void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78;
    void runIdleMaintenance() = 79;
    void abortIdleMaintenance() = 80;
    String translateAppToSystem(String path, int pid, int uid) = 81;
    String translateSystemToApp(String path, int pid, int uid) = 82;
    void commitChanges() = 83;
    boolean supportsCheckpoint() = 84;
    void startCheckpoint(int numTries) = 85;
+2 −21
Original line number Diff line number Diff line
@@ -291,9 +291,6 @@ public class StorageManager {
    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;
@@ -1618,15 +1615,7 @@ public class StorageManager {
     * @hide
     */
    public File translateAppToSystem(File file, int pid, int uid) {
        // We can only translate absolute paths
        if (!file.isAbsolute()) return file;

        try {
            return new File(mStorageManager.translateAppToSystem(file.getAbsolutePath(),
                    pid, uid));
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
        return file;
    }

    /**
@@ -1636,15 +1625,7 @@ public class StorageManager {
     * @hide
     */
    public File translateSystemToApp(File file, int pid, int uid) {
        // We can only translate absolute paths
        if (!file.isAbsolute()) return file;

        try {
            return new File(mStorageManager.translateSystemToApp(file.getAbsolutePath(),
                    pid, uid));
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
        return file;
    }

    /**
+0 −31
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.os.storage;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.IVold;

/**
@@ -84,30 +82,6 @@ public abstract class StorageManagerInternal {
     */
    public abstract int getExternalStorageMountMode(int uid, String packageName);

    /**
     * Create storage sandbox for the given package.
     *
     * <p> This will involve calling into vold to setup appropriate bind mounts.
     *
     * @param packageName The package for which the sandbox needs to be created.
     * @param appId The appId for the given package.
     * @param sharedUserId The sharedUserId for given package if it specified
     *      {@code android:sharedUserId} in the manifest, otherwise {@code null}
     * @param userId The userId in which the sandbox needs to be created.
     */
    public abstract void prepareSandboxForApp(@NonNull String packageName, int appId,
            @Nullable String sharedUserId, int userId);

    /**
     * Delete storage sandbox for the given package.
     *
     * @param packageName The package for which the sandbox needs to be destroyed.
     * @param sharedUserId The sharedUserId if specified by the package.
     * @param userId The userId in which the sandbox needs to be destroyed.
     */
    public abstract void destroySandboxForApp(@NonNull String packageName,
            @Nullable String sharedUserId, int userId);

    /**
     * A listener for reset events in the StorageManagerService.
     */
@@ -127,9 +101,4 @@ public abstract class StorageManagerInternal {
     * @param listener The listener that will be notified on reset events.
     */
    public abstract void addResetListener(ResetListener listener);

    /**
     * Return the sandboxId for the given package on external storage.
     */
    public abstract String getSandboxId(String packageName);
}
Loading