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

Commit 1f62ad35 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Report non-match parent window bounds in TaskInfo" into main

parents 7027dce7 38f03c23
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -345,6 +345,15 @@ public class TaskInfo {
     */
    public AppCompatTaskInfo appCompatTaskInfo = AppCompatTaskInfo.create();

    /**
     * The top activity's main window frame if it doesn't match the top activity bounds.
     * {@code null}, otherwise.
     *
     * @hide
     */
    @Nullable
    public Rect topActivityMainWindowFrame;

    TaskInfo() {
        // Do nothing
    }
@@ -477,7 +486,8 @@ public class TaskInfo {
                && Objects.equals(capturedLink, that.capturedLink)
                && capturedLinkTimestamp == that.capturedLinkTimestamp
                && requestedVisibleTypes == that.requestedVisibleTypes
                && appCompatTaskInfo.equalsForTaskOrganizer(that.appCompatTaskInfo);
                && appCompatTaskInfo.equalsForTaskOrganizer(that.appCompatTaskInfo)
                && Objects.equals(topActivityMainWindowFrame, that.topActivityMainWindowFrame);
    }

    /**
@@ -553,6 +563,7 @@ public class TaskInfo {
        capturedLinkTimestamp = source.readLong();
        requestedVisibleTypes = source.readInt();
        appCompatTaskInfo = source.readTypedObject(AppCompatTaskInfo.CREATOR);
        topActivityMainWindowFrame = source.readTypedObject(Rect.CREATOR);
    }

    /**
@@ -606,6 +617,7 @@ public class TaskInfo {
        dest.writeLong(capturedLinkTimestamp);
        dest.writeInt(requestedVisibleTypes);
        dest.writeTypedObject(appCompatTaskInfo, flags);
        dest.writeTypedObject(topActivityMainWindowFrame, flags);
    }

    @Override
@@ -649,6 +661,7 @@ public class TaskInfo {
                + " capturedLinkTimestamp=" + capturedLinkTimestamp
                + " requestedVisibleTypes=" + requestedVisibleTypes
                + " appCompatTaskInfo=" + appCompatTaskInfo
                + " topActivityMainWindowFrame=" + topActivityMainWindowFrame
                + "}";
    }
}
+30 −0
Original line number Diff line number Diff line
@@ -3410,6 +3410,36 @@ class Task extends TaskFragment {
        info.requestedVisibleTypes = (windowState != null && Flags.enableFullyImmersiveInDesktop())
                ? windowState.getRequestedVisibleTypes() : WindowInsets.Type.defaultVisible();
        AppCompatUtils.fillAppCompatTaskInfo(this, info, top);
        info.topActivityMainWindowFrame = calculateTopActivityMainWindowFrameForTaskInfo(top);
    }

    /**
     * Returns the top activity's main window frame if it doesn't match
     * {@link ActivityRecord#getBounds() the top activity bounds}, or {@code null}, otherwise.
     *
     * @param top The top running activity of the task
     */
    @Nullable
    private static Rect calculateTopActivityMainWindowFrameForTaskInfo(
            @Nullable ActivityRecord top) {
        if (!Flags.betterSupportNonMatchParentActivity()) {
            return null;
        }
        if (top == null) {
            return null;
        }
        final WindowState mainWindow = top.findMainWindow();
        if (mainWindow == null) {
            return null;
        }
        if (!mainWindow.mHaveFrame) {
            return null;
        }
        final Rect windowFrame = mainWindow.getFrame();
        if (top.getBounds().equals(windowFrame)) {
            return null;
        }
        return windowFrame;
    }

    /**