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

Commit d2c41457 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Let's reinvent storage, yet again!" into mnc-dev

parents b84ace51 9527b223
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -504,4 +504,5 @@ interface IPackageManager {

    void grantDefaultPermissions(int userId);
    void setCarrierAppPackagesProvider(in IPackagesProvider provider);
    int getMountExternalMode(int uid);
}
+10 −1
Original line number Diff line number Diff line
@@ -643,6 +643,10 @@ public class Process {
            }
            if (mountExternal == Zygote.MOUNT_EXTERNAL_DEFAULT) {
                argsForZygote.add("--mount-external-default");
            } else if (mountExternal == Zygote.MOUNT_EXTERNAL_READ) {
                argsForZygote.add("--mount-external-read");
            } else if (mountExternal == Zygote.MOUNT_EXTERNAL_WRITE) {
                argsForZygote.add("--mount-external-write");
            }
            argsForZygote.add("--target-sdk-version=" + targetSdkVersion);

@@ -802,7 +806,12 @@ public class Process {
     * @hide
     */
    public static final boolean isIsolated() {
        int uid = UserHandle.getAppId(myUid());
        return isIsolated(myUid());
    }

    /** {@hide} */
    public static final boolean isIsolated(int uid) {
        uid = UserHandle.getAppId(uid);
        return uid >= FIRST_ISOLATED_UID && uid <= LAST_ISOLATED_UID;
    }

+26 −0
Original line number Diff line number Diff line
@@ -1177,6 +1177,21 @@ public interface IMountService extends IInterface {
                    _data.recycle();
                }
            }

            @Override
            public void remountUid(int uid) throws RemoteException {
                Parcel _data = Parcel.obtain();
                Parcel _reply = Parcel.obtain();
                try {
                    _data.writeInterfaceToken(DESCRIPTOR);
                    _data.writeInt(uid);
                    mRemote.transact(Stub.TRANSACTION_remountUid, _data, _reply, 0);
                    _reply.readException();
                } finally {
                    _reply.recycle();
                    _data.recycle();
                }
            }
        }

        private static final String DESCRIPTOR = "IMountService";
@@ -1292,6 +1307,8 @@ public interface IMountService extends IInterface {
        static final int TRANSACTION_benchmark = IBinder.FIRST_CALL_TRANSACTION + 59;
        static final int TRANSACTION_setDebugFlags = IBinder.FIRST_CALL_TRANSACTION + 60;

        static final int TRANSACTION_remountUid = IBinder.FIRST_CALL_TRANSACTION + 61;

        /**
         * Cast an IBinder object into an IMountService interface, generating a
         * proxy if needed.
@@ -1845,6 +1862,13 @@ public interface IMountService extends IInterface {
                    reply.writeNoException();
                    return true;
                }
                case TRANSACTION_remountUid: {
                    data.enforceInterface(DESCRIPTOR);
                    int uid = data.readInt();
                    remountUid(uid);
                    reply.writeNoException();
                    return true;
                }
            }
            return super.onTransact(code, data, reply, flags);
        }
@@ -2154,4 +2178,6 @@ public interface IMountService extends IInterface {
    public String getPrimaryStorageUuid() throws RemoteException;
    public void setPrimaryStorageUuid(String volumeUuid, IPackageMoveObserver callback)
            throws RemoteException;

    public void remountUid(int uid) throws RemoteException;
}
+9 −0
Original line number Diff line number Diff line
@@ -870,6 +870,15 @@ public class StorageManager {
        throw new IllegalStateException("Missing primary storage");
    }

    /** {@hide} */
    public void remountUid(int uid) {
        try {
            mMountService.remountUid(uid);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /** {@hide} */
    private static final int DEFAULT_THRESHOLD_PERCENTAGE = 10;
    private static final long DEFAULT_THRESHOLD_MAX_BYTES = 500 * MB_IN_BYTES;
+5 −1
Original line number Diff line number Diff line
@@ -46,8 +46,12 @@ public final class Zygote {

    /** No external storage should be mounted. */
    public static final int MOUNT_EXTERNAL_NONE = 0;
    /** Default user-specific external storage should be mounted. */
    /** Default external storage should be mounted. */
    public static final int MOUNT_EXTERNAL_DEFAULT = 1;
    /** Read-only external storage should be mounted. */
    public static final int MOUNT_EXTERNAL_READ = 2;
    /** Read-write external storage should be mounted. */
    public static final int MOUNT_EXTERNAL_WRITE = 3;

    private static final ZygoteHooks VM_HOOKS = new ZygoteHooks();

Loading