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

Commit e0c8caf1 authored by ryanlwlin's avatar ryanlwlin
Browse files

remove embeddedMatrix usage for PIP menu

We used to use the embedded matrix to correct the node bounds.
It is not necessary anymore because we now use the transform from
InputWindowHandle to comput the node bounds.

Test: manual test the pip menu buttons when talkback is enabled.
Bug: 200797785
Change-Id: Ie3be64b48735577139e66d34f0db367e16c26b88
parent 7bdc82af
Loading
Loading
Loading
Loading
+0 −21
Original line number Original line Diff line number Diff line
@@ -38,7 +38,6 @@ import android.graphics.Region;
import android.graphics.Region.Op;
import android.graphics.Region.Op;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Slog;
import android.util.Slog;
import android.view.Choreographer;
import android.view.Choreographer;
@@ -243,22 +242,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
        }
        }
    };
    };


    private Runnable mUpdateEmbeddedMatrix = () -> {
        if (getViewRootImpl() == null) {
            return;
        }
        if (isHorizontalDivision()) {
            mTmpMatrix.setTranslate(0, mDividerPositionY - mDividerInsets);
        } else {
            mTmpMatrix.setTranslate(mDividerPositionX - mDividerInsets, 0);
        }
        mTmpMatrix.getValues(mTmpValues);
        try {
            getViewRootImpl().getAccessibilityEmbeddedConnection().setWindowMatrix(mTmpValues);
        } catch (RemoteException e) {
        }
    };

    public DividerView(Context context) {
    public DividerView(Context context) {
        this(context, null);
        this(context, null);
    }
    }
@@ -1052,10 +1035,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
                t.setPosition(dividerCtrl, mDividerPositionX - mDividerInsets, 0);
                t.setPosition(dividerCtrl, mDividerPositionX - mDividerInsets, 0);
            }
            }
        }
        }
        if (getViewRootImpl() != null) {
            getHandler().removeCallbacks(mUpdateEmbeddedMatrix);
            getHandler().post(mUpdateEmbeddedMatrix);
        }
    }
    }


    void setResizeDimLayer(Transaction t, boolean primary, float alpha) {
    void setResizeDimLayer(Transaction t, boolean primary, float alpha) {
+0 −18
Original line number Original line Diff line number Diff line
@@ -135,19 +135,6 @@ 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()
                    .setWindowMatrix(mTmpValues);
        } catch (RemoteException e) {
        }
    };

    public PhonePipMenuController(Context context, PipBoundsState pipBoundsState,
    public PhonePipMenuController(Context context, PipBoundsState pipBoundsState,
            PipMediaController mediaController, SystemWindows systemWindows,
            PipMediaController mediaController, SystemWindows systemWindows,
            Optional<SplitScreenController> splitScreenOptional,
            Optional<SplitScreenController> splitScreenOptional,
@@ -348,11 +335,6 @@ public class PhonePipMenuController implements PipMenuController {
        } else {
        } else {
            mApplier.scheduleApply(params);
            mApplier.scheduleApply(params);
        }
        }

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


    /**
    /**
+0 −19
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@ import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.os.Handler;
import android.os.Handler;
import android.os.RemoteException;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
import android.view.SyncRtSurfaceTransactionApplier;
import android.view.SyncRtSurfaceTransactionApplier;
@@ -88,19 +87,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
    RectF mTmpDestinationRectF = new RectF();
    RectF mTmpDestinationRectF = new RectF();
    Matrix mMoveTransform = new Matrix();
    Matrix mMoveTransform = new Matrix();


    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()
                    .setWindowMatrix(mTmpValues);
        } catch (RemoteException e) {
            if (DEBUG) e.printStackTrace();
        }
    };
    private final Runnable mCloseEduTextRunnable = this::closeEduText;
    private final Runnable mCloseEduTextRunnable = this::closeEduText;


    public TvPipMenuController(Context context, TvPipBoundsState tvPipBoundsState,
    public TvPipMenuController(Context context, TvPipBoundsState tvPipBoundsState,
@@ -525,11 +511,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
            mApplier.scheduleApply(frontParams);
            mApplier.scheduleApply(frontParams);
        }
        }


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

        updateMenuBounds(pipDestBounds);
        updateMenuBounds(pipDestBounds);
    }
    }