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

Commit 565d2b1b authored by Ryan Lin's avatar Ryan Lin Committed by Android (Google) Code Review
Browse files

Merge changes from topic "nodebounds" into tm-dev

* changes:
  remove embeddedMatrix usage for PIP menu
  Change node bounds procedure based on SufaceFlinger Callback
parents 9f832f33 e0c8caf1
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import java.lang.ref.WeakReference;
 */
final class AccessibilityEmbeddedConnection extends IAccessibilityEmbeddedConnection.Stub {
    private final WeakReference<ViewRootImpl> mViewRootImpl;
    private final Matrix mTmpScreenMatrix = new Matrix();
    private final Matrix mTmpWindowMatrix = new Matrix();

    AccessibilityEmbeddedConnection(ViewRootImpl viewRootImpl) {
        mViewRootImpl = new WeakReference<>(viewRootImpl);
@@ -70,14 +70,14 @@ final class AccessibilityEmbeddedConnection extends IAccessibilityEmbeddedConnec
    }

    @Override
    public void setScreenMatrix(float[] matrixValues) {
    public void setWindowMatrix(float[] matrixValues) {
        final ViewRootImpl viewRootImpl = mViewRootImpl.get();
        if (viewRootImpl != null) {
            mTmpScreenMatrix.setValues(matrixValues);
            if (viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy == null) {
                viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy = new Matrix();
            mTmpWindowMatrix.setValues(matrixValues);
            if (viewRootImpl.mAttachInfo.mWindowMatrixInEmbeddedHierarchy == null) {
                viewRootImpl.mAttachInfo.mWindowMatrixInEmbeddedHierarchy = new Matrix();
            }
            viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy.set(mTmpScreenMatrix);
            viewRootImpl.mAttachInfo.mWindowMatrixInEmbeddedHierarchy.set(mTmpWindowMatrix);
        }
    }
}
+116 −78

File changed.

Preview size limit exceeded, changes collapsed.

+6 −6
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ class RemoteAccessibilityController {
    private static final String TAG = "RemoteAccessibilityController";
    private int mHostId;
    private RemoteAccessibilityEmbeddedConnection mConnectionWrapper;
    private Matrix mScreenMatrixForEmbeddedHierarchy = new Matrix();
    private Matrix mWindowMatrixForEmbeddedHierarchy = new Matrix();
    private final float[] mMatrixValues = new float[9];
    private View mHostView;

@@ -140,9 +140,9 @@ class RemoteAccessibilityController {
        return mConnectionWrapper;
    }

    void setScreenMatrix(Matrix m) {
        // If the screen matrix is identity or doesn't change, do nothing.
        if (m.isIdentity() || m.equals(mScreenMatrixForEmbeddedHierarchy)) {
    void setWindowMatrix(Matrix m) {
        // If the window matrix is identity or doesn't change, do nothing.
        if (m.isIdentity() || m.equals(mWindowMatrixForEmbeddedHierarchy)) {
            return;
        }

@@ -153,8 +153,8 @@ class RemoteAccessibilityController {
                return;
            }
            m.getValues(mMatrixValues);
            wrapper.getConnection().setScreenMatrix(mMatrixValues);
            mScreenMatrixForEmbeddedHierarchy.set(m);
            wrapper.getConnection().setWindowMatrix(mMatrixValues);
            mWindowMatrixForEmbeddedHierarchy.set(m);
        } catch (RemoteException e) {
            Log.d(TAG, "Error while setScreenMatrix " + e);
        }
+6 −1
Original line number Diff line number Diff line
@@ -1781,11 +1781,16 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
            return;
        }
        getBoundsOnScreen(mTmpRect);

        // To compute the node bounds of the node on the embedded window,
        // apply this matrix to get the bounds in host window-relative coordinates,
        // then using the global transform to get the actual bounds on screen.
        mTmpRect.offset(-mAttachInfo.mWindowLeft, -mAttachInfo.mWindowTop);
        mTmpMatrix.reset();
        mTmpMatrix.setTranslate(mTmpRect.left, mTmpRect.top);
        mTmpMatrix.postScale(mScreenRect.width() / (float) mSurfaceWidth,
                mScreenRect.height() / (float) mSurfaceHeight);
        mRemoteAccessibilityController.setScreenMatrix(mTmpMatrix);
        mRemoteAccessibilityController.setWindowMatrix(mTmpMatrix);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -29938,10 +29938,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        boolean mHandlingPointerEvent;
        /**
         * The screen matrix of this view when it's on a {@link SurfaceControlViewHost} that is
         * The window matrix of this view when it's on a {@link SurfaceControlViewHost} that is
         * embedded within a SurfaceView.
         */
        Matrix mScreenMatrixInEmbeddedHierarchy;
        Matrix mWindowMatrixInEmbeddedHierarchy;
        /**
         * Global to the view hierarchy used as a temporary for dealing with
Loading