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

Commit 67187f75 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "New sm command to unmount app data and obb app visibility mount" am:...

Merge "New sm command to unmount app data and obb app visibility mount" am: 3299d00b am: 40c7e3d1 am: 05af40c4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552534

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie35b99efa56faaf4339a7c344743092a5b5d540b
parents bfcc7e5f 05af40c4
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -105,6 +105,8 @@ public final class Sm {
            runStartCheckpoint();
            runStartCheckpoint();
        } else if ("supports-checkpoint".equals(op)) {
        } else if ("supports-checkpoint".equals(op)) {
            runSupportsCheckpoint();
            runSupportsCheckpoint();
        } else if ("unmount-app-data-dirs".equals(op)) {
            runDisableAppDataIsolation();
        } else {
        } else {
            throw new IllegalArgumentException();
            throw new IllegalArgumentException();
        }
        }
@@ -251,6 +253,13 @@ public final class Sm {
        System.out.println(result.get());
        System.out.println(result.get());
    }
    }


    public void runDisableAppDataIsolation() throws RemoteException {
        final String pkgName = nextArg();
        final int pid = Integer.parseInt(nextArg());
        final int userId = Integer.parseInt(nextArg());
        mSm.disableAppDataIsolation(pkgName, pid, userId);
    }

    public void runForget() throws RemoteException {
    public void runForget() throws RemoteException {
        final String fsUuid = nextArg();
        final String fsUuid = nextArg();
        if ("all".equals(fsUuid)) {
        if ("all".equals(fsUuid)) {
@@ -347,6 +356,8 @@ public final class Sm {
        System.err.println("");
        System.err.println("");
        System.err.println("       sm supports-checkpoint");
        System.err.println("       sm supports-checkpoint");
        System.err.println("");
        System.err.println("");
        System.err.println("       sm unmount-app-data-dirs PACKAGE_NAME PID USER_ID");
        System.err.println("");
        return 1;
        return 1;
    }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -195,4 +195,5 @@ interface IStorageManager {
    void abortChanges(in String message, boolean retry) = 87;
    void abortChanges(in String message, boolean retry) = 87;
    void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88;
    void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88;
    void fixupAppDir(in String path) = 89;
    void fixupAppDir(in String path) = 89;
    void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90;
}
}
+21 −1
Original line number Original line Diff line number Diff line
@@ -1526,7 +1526,6 @@ class StorageManagerService extends IStorageManager.Stub
        }
        }
    }
    }



    private void onVolumeStateChangedAsync(VolumeInfo vol, int oldState, int newState) {
    private void onVolumeStateChangedAsync(VolumeInfo vol, int oldState, int newState) {
        synchronized (mLock) {
        synchronized (mLock) {
            // Remember that we saw this volume so we're ready to accept user
            // Remember that we saw this volume so we're ready to accept user
@@ -3275,6 +3274,27 @@ class StorageManagerService extends IStorageManager.Stub
        }
        }
    }
    }


    /*
     * Disable storage's app data isolation for testing.
     */
    @Override
    public void disableAppDataIsolation(String pkgName, int pid, int userId) {
        final int callingUid = Binder.getCallingUid();
        if (callingUid != Process.ROOT_UID && callingUid != Process.SHELL_UID) {
            throw new SecurityException("no permission to enable app visibility");
        }
        final String[] sharedPackages =
                mPmInternal.getSharedUserPackagesForPackage(pkgName, userId);
        final int uid = mPmInternal.getPackageUid(pkgName, 0, userId);
        final String[] packages =
                sharedPackages.length != 0 ? sharedPackages : new String[]{pkgName};
        try {
            mVold.unmountAppStorageDirs(uid, pid, packages);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /** Not thread safe */
    /** Not thread safe */
    class AppFuseMountScope extends AppFuseBridge.MountScope {
    class AppFuseMountScope extends AppFuseBridge.MountScope {
        private boolean mMounted = false;
        private boolean mMounted = false;