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

Commit 2a1120fa authored by Charles Chen's avatar Charles Chen
Browse files

Workaround to use System UI Context

... for SystemGesturesPointerEventListener

This CL passes System UI Context to SystemGesturesPointerEventListener
instead of System Context's DisplayContext because DisplayContext is
not a UI context and violates IncorrectContextViolation when trying
to access GestureDetector.

Note that we should still migrate the usage to window context because it
may still an issue if device can change its display metrics at runtime.
[1] attempted to do so but hit performance issue b/181814478.

[1]: 68c30247

Bug: 177650348
Test: atest WmTests
Change-Id: Ie7695270d2e2dd15c749c07c2bde2f6f98bc5b59
parent a7ee1a9a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -448,7 +448,8 @@ public class DisplayPolicy {


        final Looper looper = UiThread.getHandler().getLooper();
        final Looper looper = UiThread.getHandler().getLooper();
        mHandler = new PolicyHandler(looper);
        mHandler = new PolicyHandler(looper);
        mSystemGestures = new SystemGesturesPointerEventListener(mContext, mHandler,
        // TODO(b/181821798) Migrate SystemGesturesPointerEventListener to use window context.
        mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler,
                new SystemGesturesPointerEventListener.Callbacks() {
                new SystemGesturesPointerEventListener.Callbacks() {
                    @Override
                    @Override
                    public void onSwipeFromTop() {
                    public void onSwipeFromTop() {