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

Commit 943f93a8 authored by Garfield Tan's avatar Garfield Tan Committed by Android (Google) Code Review
Browse files

Merge "Add window focused state to TaskInfo."

parents 3dd9f787 f677d826
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -221,6 +221,12 @@ public class TaskInfo {
     */
    public Rect parentBounds;

    /**
     * Whether this task is focused.
     * @hide
     */
    public boolean isFocused;

    TaskInfo() {
        // Do nothing
    }
@@ -304,7 +310,8 @@ public class TaskInfo {
                && equalsLetterboxParams(that)
                && pictureInPictureParams == that.pictureInPictureParams
                && getWindowingMode() == that.getWindowingMode()
                && Objects.equals(taskDescription, that.taskDescription);
                && Objects.equals(taskDescription, that.taskDescription)
                && isFocused == that.isFocused;
    }

    private boolean equalsLetterboxParams(TaskInfo that) {
@@ -350,6 +357,7 @@ public class TaskInfo {
        positionInParent = source.readTypedObject(Point.CREATOR);
        parentTaskId = source.readInt();
        parentBounds = source.readTypedObject(Rect.CREATOR);
        isFocused = source.readBoolean();
    }

    /**
@@ -385,6 +393,7 @@ public class TaskInfo {
        dest.writeTypedObject(positionInParent, flags);
        dest.writeInt(parentTaskId);
        dest.writeTypedObject(parentBounds, flags);
        dest.writeBoolean(isFocused);
    }

    @Override
@@ -407,8 +416,9 @@ public class TaskInfo {
                + " launchCookies" + launchCookies
                + " letterboxActivityBounds=" + letterboxActivityBounds
                + " positionInParent=" + positionInParent
                + " parentTaskId: " + parentTaskId
                + " parentBounds: " + parentBounds
                + " parentTaskId=" + parentTaskId
                + " parentBounds=" + parentBounds
                + " isFocused=" + isFocused
                + "}";
    }
}
+4 −7
Original line number Diff line number Diff line
@@ -6408,13 +6408,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // The app is just becoming visible, and the parent Task has updated with the
            // orientation request. Update the size compat mode.
            updateSizeCompatMode();
            if (task.isOrganized()) {
            // WM Shell can override WM Core positioning (e.g. for letterboxing) so ensure
            // that WM Shell is called when an activity becomes visible. Without this, WM Core
            // will handle positioning instead of WM Shell when an app is reopened.
                mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(
                        task, /* force= */ true);
            }
            task.dispatchTaskInfoChangedIfNeeded(/* force= */ true);
        }
    }

+3 −6
Original line number Diff line number Diff line
@@ -385,12 +385,9 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
                    mWindowManager.executeAppTransition();

                    final Task rootTask = targetStack.getRootTask();
                    if (rootTask.isOrganized()) {
                    // Client state may have changed during the recents animation, so force
                    // send task info so the client can synchronize its state.
                        mService.mTaskOrganizerController.dispatchTaskInfoChanged(
                                rootTask, true /* force */);
                    }
                    rootTask.dispatchTaskInfoChangedIfNeeded(true /* force */);
                } catch (Exception e) {
                    Slog.e(TAG, "Failed to clean up recents activity", e);
                    throw e;
+14 −13
Original line number Diff line number Diff line
@@ -2041,9 +2041,7 @@ class Task extends WindowContainer<WindowContainer> {
            }
        }

        if (isOrganized()) {
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(this, false /* force */);
        }
        dispatchTaskInfoChangedIfNeeded(false /* force */);
    }

    private static boolean setTaskDescriptionFromActivityAboveRoot(
@@ -2272,8 +2270,8 @@ class Task extends WindowContainer<WindowContainer> {
        }
        // If the task organizer has changed, then it will already be receiving taskAppeared with
        // the latest task-info thus the task-info won't have changed.
        if (!taskOrgChanged && isOrganized()) {
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(this, false /* force */);
        if (!taskOrgChanged) {
            dispatchTaskInfoChangedIfNeeded(false /* force */);
        }
    }

@@ -4100,6 +4098,7 @@ class Task extends WindowContainer<WindowContainer> {
        info.parentTaskId = rootTask == getParent() && rootTask.mCreatedByOrganizer
                ? rootTask.mTaskId
                : INVALID_TASK_ID;
        info.isFocused = isFocused();
    }

    @Nullable PictureInPictureParams getPictureInPictureParams() {
@@ -4120,8 +4119,7 @@ class Task extends WindowContainer<WindowContainer> {
                    letterboxActivityBounds)) {
            mLetterboxActivityBounds = Rect.copyOrNull(letterboxActivityBounds);
            // Forcing update to reduce visual jank during the transition.
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(
                        this, /* force= */ true);
            dispatchTaskInfoChangedIfNeeded(true /* force */);
        }
    }

@@ -5067,12 +5065,11 @@ class Task extends WindowContainer<WindowContainer> {
     */
    void onWindowFocusChanged(boolean hasFocus) {
        updateShadowsRadius(hasFocus, getSyncTransaction());
        dispatchTaskInfoChangedIfNeeded(false /* force */);
    }

    void onPictureInPictureParamsChanged() {
        if (isOrganized()) {
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(this, true /* force */);
        }
        dispatchTaskInfoChangedIfNeeded(true /* force */);
    }

    /**
@@ -7447,9 +7444,7 @@ class Task extends WindowContainer<WindowContainer> {

    @Override
    void onChildPositionChanged(WindowContainer child) {
        if (isOrganized()) {
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(this, false /* force */);
        }
        dispatchTaskInfoChangedIfNeeded(false /* force */);

        if (!mChildren.contains(child)) {
            return;
@@ -7604,6 +7599,12 @@ class Task extends WindowContainer<WindowContainer> {
        return super.getBounds();
    }

    void dispatchTaskInfoChangedIfNeeded(boolean force) {
        if (isOrganized()) {
            mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(this, force);
        }
    }

    @Override
    public void dumpDebug(ProtoOutputStream proto, long fieldId,
            @WindowTraceLogLevel int logLevel) {