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

Commit 1abb683a authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Notify task description change to system UI (4/N)

The TaskStackChangeListener will take the task description chagne event
and notify the listeners. It will be able to let system UI handle the
theme change of the task correctly.

Bug: 113253712
Bug: 122726344
Test: go/wm-smoke
Test: Test with an app with theme, the listener will receive the
      background color.
Test: Manually registered a listener from system UI and the event is
      correctly received.

Change-Id: I087cc112be73cf421fa124cd0d6b238f91970a0c
parent 4a0b1750
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -89,6 +89,14 @@ public abstract class TaskStackChangeListener {
        onTaskMovedToFront(taskInfo.taskId);
    }

    /**
     * Called when a task’s description is changed due to an activity calling
     * ActivityManagerService.setTaskDescription
     *
     * @param taskInfo info about the task which changed, with {@link TaskInfo#taskDescription}
     */
    public void onTaskDescriptionChanged(RunningTaskInfo taskInfo) { }

    public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) { }
    public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) { }

+13 −0
Original line number Diff line number Diff line
@@ -230,6 +230,11 @@ public class TaskStackChangeListeners extends TaskStackListener {
                .sendToTarget();
    }

    @Override
    public void onTaskDescriptionChanged(RunningTaskInfo taskInfo) {
        mHandler.obtainMessage(H.ON_TASK_DESCRIPTION_CHANGED, taskInfo).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;
@@ -254,6 +259,7 @@ public class TaskStackChangeListeners extends TaskStackListener {
        private static final int ON_TASK_LIST_UPDATED = 21;
        private static final int ON_SINGLE_TASK_DISPLAY_EMPTY = 22;
        private static final int ON_TASK_LIST_FROZEN_UNFROZEN = 23;
        private static final int ON_TASK_DESCRIPTION_CHANGED = 24;


        public H(Looper looper) {
@@ -421,6 +427,13 @@ public class TaskStackChangeListeners extends TaskStackListener {
                        }
                        break;
                    }
                    case ON_TASK_DESCRIPTION_CHANGED: {
                        final RunningTaskInfo info = (RunningTaskInfo) msg.obj;
                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                            mTaskStackListeners.get(i).onTaskDescriptionChanged(info);
                        }
                        break;
                    }
                }
            }
        }