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

Commit aac9f819 authored by Riddle Hsu's avatar Riddle Hsu Committed by Gerrit Code Review
Browse files

Merge changes from topic "cherrypicker-L77300030007239273:N00600030116629593" into main

* changes:
  Consider letterbox offset as size mismatch
  Skip initializing unused system bar painter
parents 1330ec33 139a4479
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -152,10 +152,14 @@ public class SnapshotDrawerUtils {
        @VisibleForTesting
        public void setFrames(Rect frame, Rect systemBarInsets) {
            mFrame.set(frame);
            final Rect letterboxInsets = mSnapshot.getLetterboxInsets();
            mSizeMismatch = (mFrame.width() != mSnapshotW || mFrame.height() != mSnapshotH)
                    || letterboxInsets.left != 0 || letterboxInsets.top != 0;
            if (!Flags.drawSnapshotAspectRatioMatch() && systemBarInsets != null) {
                mSystemBarInsets.set(systemBarInsets);
            mSizeMismatch = (mFrame.width() != mSnapshotW || mFrame.height() != mSnapshotH);
                mSystemBarBackgroundPainter.setInsets(systemBarInsets);
            }
        }

        private void drawSnapshot(boolean releaseAfterDraw) {
            Log.v(TAG, "Drawing snapshot surface sizeMismatch=" + mSizeMismatch);
@@ -396,9 +400,12 @@ public class SnapshotDrawerUtils {
        final ActivityManager.RunningTaskInfo runningTaskInfo = info.taskInfo;
        final ActivityManager.TaskDescription taskDescription =
                getOrCreateTaskDescription(runningTaskInfo);
        Rect systemBarInsets = null;
        if (!Flags.drawSnapshotAspectRatioMatch()) {
            drawSurface.initiateSystemBarPainter(lp.flags, lp.privateFlags,
                    attrs.insetsFlags.appearance, taskDescription, info.requestedVisibleTypes);
        final Rect systemBarInsets = getSystemBarInsets(windowBounds, topWindowInsetsState);
            systemBarInsets = getSystemBarInsets(windowBounds, topWindowInsetsState);
        }
        drawSurface.setFrames(windowBounds, systemBarInsets);
        drawSurface.drawSnapshot(releaseAfterDraw);
    }