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

Commit 17dccf54 authored by David Nelloms's avatar David Nelloms Committed by android-build-merger
Browse files

Merge "Notify on task display change." into qt-dev

am: 22a5e4e5

Change-Id: Ia0ae853122ff3acb755abfebb88dda863ee61080
parents c32a8c70 22a5e4e5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -169,4 +169,12 @@ oneway interface ITaskStackListener {
     * @param taskInfo info about the task which received the back press
     */
    void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);

    /**
     * Called when a task is reparented to a stack on a different display.
     *
     * @param taskId id of the task which was moved to a different display.
     * @param newDisplayId id of the new display.
     */
    void onTaskDisplayChanged(int taskId, int newDisplayId);
}
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.RemoteException;
/**
 * Classes interested in observing only a subset of changes using ITaskStackListener can extend
 * this class to avoid having to implement all the methods.
 *
 * @hide
 */
public abstract class TaskStackListener extends ITaskStackListener.Stub {
@@ -173,4 +174,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo taskInfo)
            throws RemoteException {
    }

    @Override
    public void onTaskDisplayChanged(int taskId, int newDisplayId) throws RemoteException {
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -925,6 +925,16 @@ public class CarStatusBar extends StatusBar implements
                Log.e(TAG, "Getting StackInfo from activity manager failed", e);
            }
        }

        @Override
        public void onTaskDisplayChanged(int taskId, int newDisplayId) {
            try {
                mCarFacetButtonController.taskChanged(
                        ActivityTaskManager.getService().getAllStackInfos());
            } catch (Exception e) {
                Log.e(TAG, "Getting StackInfo from activity manager failed", e);
            }
        }
    }

    private void onDrivingStateChanged(CarDrivingStateEvent notUsed) {
+8 −0
Original line number Diff line number Diff line
@@ -78,6 +78,14 @@ public abstract class TaskStackChangeListener {

    public void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) { }

    /**
     * Called when a task is reparented to a stack on a different display.
     *
     * @param taskId id of the task which was moved to a different display.
     * @param newDisplayId id of the new display.
     */
    public void onTaskDisplayChanged(int taskId, int newDisplayId) { }

    /**
     * Checks that the current user matches the process. Since
     * {@link android.app.ITaskStackListener} is not multi-user aware, handlers of
+15 −3
Original line number Diff line number Diff line
@@ -201,6 +201,11 @@ public class TaskStackChangeListeners extends TaskStackListener {
                activityToken).sendToTarget();
    }

    @Override
    public void onTaskDisplayChanged(int taskId, int newDisplayId) throws RemoteException {
        mHandler.obtainMessage(H.ON_TASK_DISPLAY_CHANGED, taskId, newDisplayId).sendToTarget();
    }

    private final class H extends Handler {
        private static final int ON_TASK_STACK_CHANGED = 1;
        private static final int ON_TASK_SNAPSHOT_CHANGED = 2;
@@ -220,6 +225,7 @@ public class TaskStackChangeListeners extends TaskStackListener {
        private static final int ON_ACTIVITY_LAUNCH_ON_SECONDARY_DISPLAY_REROUTED = 16;
        private static final int ON_SIZE_COMPAT_MODE_ACTIVITY_CHANGED = 17;
        private static final int ON_BACK_PRESSED_ON_TASK_ROOT = 18;
        private static final int ON_TASK_DISPLAY_CHANGED = 19;


        public H(Looper looper) {
@@ -356,6 +362,12 @@ public class TaskStackChangeListeners extends TaskStackListener {
                        }
                        break;
                    }
                    case ON_TASK_DISPLAY_CHANGED: {
                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                            mTaskStackListeners.get(i).onTaskDisplayChanged(msg.arg1, msg.arg2);
                        }
                        break;
                    }
                }
            }
        }
Loading