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

Commit a9868fbd authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android Git Automerger
Browse files

am 2749a5e6: am e54553c8: am d54b578e: Fix issue #17305377: Don\'t kill...

am 2749a5e6: am e54553c8: am d54b578e: Fix issue #17305377: Don\'t kill process if it still has tasks.

* commit '2749a5e6':
  Fix issue #17305377: Don't kill process if it still has tasks.
parents daccecb2 2749a5e6
Loading
Loading
Loading
Loading
+2 −12
Original line number Original line Diff line number Diff line
@@ -1242,27 +1242,17 @@ public class ActivityManager {
        }
        }
    }
    }


    /**
     * If set, the process of the root activity of the task will be killed
     * as part of removing the task.
     * @hide
     */
    public static final int REMOVE_TASK_KILL_PROCESS = 0x0001;

    /**
    /**
     * Completely remove the given task.
     * Completely remove the given task.
     *
     *
     * @param taskId Identifier of the task to be removed.
     * @param taskId Identifier of the task to be removed.
     * @param flags Additional operational flags.  May be 0 or
     * {@link #REMOVE_TASK_KILL_PROCESS}.
     * @return Returns true if the given task was found and removed.
     * @return Returns true if the given task was found and removed.
     *
     *
     * @hide
     * @hide
     */
     */
    public boolean removeTask(int taskId, int flags)
    public boolean removeTask(int taskId) throws SecurityException {
            throws SecurityException {
        try {
        try {
            return ActivityManagerNative.getDefault().removeTask(taskId, flags);
            return ActivityManagerNative.getDefault().removeTask(taskId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            // System dead, we will be dead too soon!
            return false;
            return false;
+2 −4
Original line number Original line Diff line number Diff line
@@ -1884,8 +1884,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        {
        {
            data.enforceInterface(IActivityManager.descriptor);
            data.enforceInterface(IActivityManager.descriptor);
            int taskId = data.readInt();
            int taskId = data.readInt();
            int fl = data.readInt();
            boolean result = removeTask(taskId);
            boolean result = removeTask(taskId, fl);
            reply.writeNoException();
            reply.writeNoException();
            reply.writeInt(result ? 1 : 0);
            reply.writeInt(result ? 1 : 0);
            return true;
            return true;
@@ -4778,12 +4777,11 @@ class ActivityManagerProxy implements IActivityManager
        return result;
        return result;
    }
    }


    public boolean removeTask(int taskId, int flags) throws RemoteException {
    public boolean removeTask(int taskId) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(taskId);
        data.writeInt(flags);
        mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
        mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
        reply.readException();
        reply.readException();
        boolean result = reply.readInt() != 0;
        boolean result = reply.readInt() != 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -373,7 +373,7 @@ public interface IActivityManager extends IInterface {
    public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException;
    public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException;
    public int[] getRunningUserIds() throws RemoteException;
    public int[] getRunningUserIds() throws RemoteException;


    public boolean removeTask(int taskId, int flags) throws RemoteException;
    public boolean removeTask(int taskId) throws RemoteException;


    public void registerProcessObserver(IProcessObserver observer) throws RemoteException;
    public void registerProcessObserver(IProcessObserver observer) throws RemoteException;
    public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException;
    public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException;
+1 −1
Original line number Original line Diff line number Diff line
@@ -728,7 +728,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
        final ActivityManager am = (ActivityManager)
        final ActivityManager am = (ActivityManager)
                getContext().getSystemService(Context.ACTIVITY_SERVICE);
                getContext().getSystemService(Context.ACTIVITY_SERVICE);
        if (am != null) {
        if (am != null) {
            am.removeTask(ad.persistentTaskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
            am.removeTask(ad.persistentTaskId);


            // Accessibility feedback
            // Accessibility feedback
            setContentDescription(
            setContentDescription(
+5 −5
Original line number Original line Diff line number Diff line
@@ -291,13 +291,13 @@ public class SystemServicesProxy {
        }
        }
    }
    }


    /** Removes the task and kills the process */
    /** Removes the task */
    public void removeTask(int taskId, boolean isDocument) {
    public void removeTask(int taskId) {
        if (mAm == null) return;
        if (mAm == null) return;
        if (Constants.DebugFlags.App.EnableSystemServicesProxy) return;
        if (Constants.DebugFlags.App.EnableSystemServicesProxy) return;


        // Remove the task, and only kill the process if it is not a document
        // Remove the task.
        mAm.removeTask(taskId, isDocument ? 0 : ActivityManager.REMOVE_TASK_KILL_PROCESS);
        mAm.removeTask(taskId);
    }
    }


    /**
    /**
Loading