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

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

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

* commit 'd54b578e':
  Fix issue #17305377: Don't kill process if it still has tasks.
parents 13e4928a d54b578e
Loading
Loading
Loading
Loading
+2 −12
Original line number 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.
     *
     * @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.
     *
     * @hide
     */
    public boolean removeTask(int taskId, int flags)
            throws SecurityException {
    public boolean removeTask(int taskId) throws SecurityException {
        try {
            return ActivityManagerNative.getDefault().removeTask(taskId, flags);
            return ActivityManagerNative.getDefault().removeTask(taskId);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return false;
+2 −4
Original line number Diff line number Diff line
@@ -1884,8 +1884,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        {
            data.enforceInterface(IActivityManager.descriptor);
            int taskId = data.readInt();
            int fl = data.readInt();
            boolean result = removeTask(taskId, fl);
            boolean result = removeTask(taskId);
            reply.writeNoException();
            reply.writeInt(result ? 1 : 0);
            return true;
@@ -4778,12 +4777,11 @@ class ActivityManagerProxy implements IActivityManager
        return result;
    }

    public boolean removeTask(int taskId, int flags) throws RemoteException {
    public boolean removeTask(int taskId) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(taskId);
        data.writeInt(flags);
        mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
        reply.readException();
        boolean result = reply.readInt() != 0;
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public interface IActivityManager extends IInterface {
    public boolean isUserRunning(int userid, boolean orStopping) 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 unregisterProcessObserver(IProcessObserver observer) throws RemoteException;
+1 −1
Original line number Diff line number Diff line
@@ -728,7 +728,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
        final ActivityManager am = (ActivityManager)
                getContext().getSystemService(Context.ACTIVITY_SERVICE);
        if (am != null) {
            am.removeTask(ad.persistentTaskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
            am.removeTask(ad.persistentTaskId);

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

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

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

    /**
Loading