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

Commit f0a4f5ca authored by Jorge Gil's avatar Jorge Gil Committed by Automerger Merge Worker
Browse files

Merge "Update PIP menu accessiblity bounds when it is moved" into sc-dev am: fa63935a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13819636

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifea626ffb5729e9bf3944b19c73d7e23b36cd54f
parents 39fe4d24 fa63935a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -121,6 +121,19 @@ public class PhonePipMenuController implements PipMenuController {
        }
    };

    private final float[] mTmpValues = new float[9];
    private final Runnable mUpdateEmbeddedMatrix = () -> {
        if (mPipMenuView == null || mPipMenuView.getViewRootImpl() == null) {
            return;
        }
        mMoveTransform.getValues(mTmpValues);
        try {
            mPipMenuView.getViewRootImpl().getAccessibilityEmbeddedConnection()
                    .setScreenMatrix(mTmpValues);
        } catch (RemoteException e) {
        }
    };

    public PhonePipMenuController(Context context, PipMediaController mediaController,
            SystemWindows systemWindows, ShellExecutor mainExecutor,
            Handler mainHandler) {
@@ -306,6 +319,11 @@ public class PhonePipMenuController implements PipMenuController {
        } else {
            mApplier.scheduleApply(params);
        }

        if (mPipMenuView.getViewRootImpl() != null) {
            mPipMenuView.getHandler().removeCallbacks(mUpdateEmbeddedMatrix);
            mPipMenuView.getHandler().post(mUpdateEmbeddedMatrix);
        }
    }

    /**
+2 −6
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.flicker.helpers

import android.app.Instrumentation
import android.graphics.Point
import android.media.session.MediaController
import android.media.session.MediaSessionManager
import android.os.SystemClock
@@ -135,11 +134,8 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
            expandPipWindow(wmHelper)
            val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss"))
            requireNotNull(exitPipObject) { "PIP window dismiss button not found" }
            val coordinatesInWindow = exitPipObject.visibleBounds
            val windowOffset = wmHelper.getWindowRegion(component).bounds
            val newCoordinates = Point(windowOffset.left + coordinatesInWindow.centerX(),
                windowOffset.top + coordinatesInWindow.centerY())
            uiDevice.click(newCoordinates.x, newCoordinates.y)
            val dismissButtonBounds = exitPipObject.visibleBounds
            uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY())
        }

        // Wait for animation to complete.