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

Commit a47df282 authored by Ben Lin's avatar Ben Lin
Browse files

DesktopModeVisualIndicator: use taskInfo's display's bounds instead.

Previously we use the resource's metric's bounds, which seems to be
always pulling from the primary display's bounds. Update this so that it
uses the TaskInfo's display bounds.

Bug: 382023296
Test: Manually check how indicators look on ext displays
Flag: com.android.window.flags.enable_bug_fixes_for_secondary_display
Change-Id: I1a506d02c47b8c8ec1bc6d2706ae2f64f405b573
parent 81217d12
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.view.animation.DecelerateInterpolator;
import androidx.annotation.VisibleForTesting;

import com.android.internal.policy.SystemBarUtils;
import com.android.window.flags.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.RootTaskDisplayAreaOrganizer;
import com.android.wm.shell.common.DisplayController;
@@ -245,9 +246,17 @@ public class DesktopModeVisualIndicator {
        final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
        final Resources resources = mContext.getResources();
        final DisplayMetrics metrics = resources.getDisplayMetrics();
        final int screenWidth = metrics.widthPixels;
        final int screenHeight = metrics.heightPixels;

        final int screenWidth;
        final int screenHeight;
        if (Flags.enableBugFixesForSecondaryDisplay()) {
            final DisplayLayout displayLayout =
                    mDisplayController.getDisplayLayout(mTaskInfo.displayId);
            screenWidth = displayLayout.width();
            screenHeight = displayLayout.height();
        } else {
            screenWidth = metrics.widthPixels;
            screenHeight = metrics.heightPixels;
        }
        mView = new View(mContext);
        final SurfaceControl.Builder builder = new SurfaceControl.Builder();
        mRootTdaOrganizer.attachToDisplayArea(mTaskInfo.displayId, builder);