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

Commit e99bb5f1 authored by Suchi Amalapurapu's avatar Suchi Amalapurapu
Browse files

Add new method call back in MountService.

PackageManager invokes this call back when its done handling
the media status update.
Add new uid check for updateExternalMediaStatus
Change killPids method in ActivityManager.
Remove mountsd command in Pm.java We cannot arbitrarily enable/disable
packages in PackageManager now.

Change-Id: I28dcba4afd2b4486f68abdaa1628a31b66544c91
parent cbf953ed
Loading
Loading
Loading
Loading
+0 −37
Original line number Diff line number Diff line
@@ -92,11 +92,6 @@ public final class Pm {
            return;
        }

        if ("mountsd".equals(op)) {
            runMountSd();
            return;
        }

        if ("uninstall".equals(op)) {
            runUninstall();
            return;
@@ -646,37 +641,6 @@ public final class Pm {
        }
    }

    private void runMountSd() {
        String opt;
        boolean mount = false;
        while ((opt=nextOption()) != null) {
            if (opt.equals("-m")) {
                String mountStr = nextOptionData();
                if (mountStr == null) {
                    System.err.println("Error: no value specified for -m");
                    showUsage();
                    return;
                }
                if ("true".equalsIgnoreCase(mountStr)) {
                    mount = true;
                } else if ("false".equalsIgnoreCase(mountStr)) {
                    mount = false;
                } else {
                    System.err.println("Error: no value specified for -m");
                    showUsage();
                    return;
                }
            }
        }

        try {
            mPm.updateExternalMediaStatus(mount);
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(PM_NOT_RUNNING_ERR);
        }
    }

    class PackageDeleteObserver extends IPackageDeleteObserver.Stub {
        boolean finished;
        boolean result;
@@ -866,7 +830,6 @@ public final class Pm {
        System.err.println("       pm path PACKAGE");
        System.err.println("       pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH");
        System.err.println("       pm uninstall [-k] PACKAGE");
        System.err.println("       pm mountsd [-m true/false]");
        System.err.println("       pm enable PACKAGE_OR_COMPONENT");
        System.err.println("       pm disable PACKAGE_OR_COMPONENT");
        System.err.println("");
+6 −4
Original line number Diff line number Diff line
@@ -980,10 +980,11 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case KILL_PIDS_FOR_MEMORY_TRANSACTION: {
        case KILL_PIDS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            int[] pids = data.createIntArray();
            boolean res = killPidsForMemory(pids);
            String reason = data.readString();
            boolean res = killPids(pids, reason);
            reply.writeNoException();
            reply.writeInt(res ? 1 : 0);
            return true;
@@ -2393,12 +2394,13 @@ class ActivityManagerProxy implements IActivityManager
        mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
        data.recycle();
    }
    public boolean killPidsForMemory(int[] pids) throws RemoteException {
    public boolean killPids(int[] pids, String reason) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeIntArray(pids);
        mRemote.transact(KILL_PIDS_FOR_MEMORY_TRANSACTION, data, reply, 0);
        data.writeString(reason);
        mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
        boolean res = reply.readInt() != 0;
        data.recycle();
        reply.recycle();
+2 −2
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ public interface IActivityManager extends IInterface {
    
    public void noteWakeupAlarm(IIntentSender sender) throws RemoteException;
    
    public boolean killPidsForMemory(int[] pids) throws RemoteException;
    public boolean killPids(int[] pids, String reason) throws RemoteException;
    
    public void reportPss(IApplicationThread caller, int pss) throws RemoteException;
    
@@ -476,7 +476,7 @@ public interface IActivityManager extends IInterface {
    int GET_PROCESSES_IN_ERROR_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+76;
    int CLEAR_APP_DATA_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+77;
    int FORCE_STOP_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+78;
    int KILL_PIDS_FOR_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79;
    int KILL_PIDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79;
    int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80;
    int REPORT_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81;
    int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82;
+1 −1
Original line number Diff line number Diff line
@@ -309,7 +309,7 @@ interface IPackageManager {
     * MountService uses this to call into the package manager to update
     * status of sdcard.
     */
    boolean updateExternalMediaStatus(boolean mounted);
    void updateExternalMediaStatus(boolean mounted, boolean reportStatus);

    String nextPackageToClean(String lastPackage);

+6 −0
Original line number Diff line number Diff line
@@ -146,4 +146,10 @@ interface IMountService
     * Invokes call back once the shutdown is complete.
     */
    void shutdown(IMountShutdownObserver observer);

    /**
     * Call into MountService by PackageManager to notify that its done
     * processing the media status update request.
     */
    void finishMediaUpdate();
}
Loading