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

Commit 9a575efb authored by Tracy Zhou's avatar Tracy Zhou Committed by Automerger Merge Worker
Browse files

Merge "[Reland] Fix touch focus not updated correctly after launching overview...

Merge "[Reland] Fix touch focus not updated correctly after launching overview with live tile." into udc-dev am: 3711aa64

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23149867



Change-Id: Ia5983b2dcf18510a4942bd6401f0482ac74119ed
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 251b33fd 3711aa64
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ public class OverviewInputConsumer<S extends BaseState<S>, T extends StatefulAct


    private final boolean mStartingInActivityBounds;
    private final boolean mStartingInActivityBounds;
    private boolean mTargetHandledTouch;
    private boolean mTargetHandledTouch;
    private boolean mHasSetTouchModeForFirstDPadEvent;


    public OverviewInputConsumer(GestureState gestureState, T activity,
    public OverviewInputConsumer(GestureState gestureState, T activity,
            @Nullable InputMonitorCompat inputMonitor, boolean startingInActivityBounds) {
            @Nullable InputMonitorCompat inputMonitor, boolean startingInActivityBounds) {
@@ -95,6 +96,9 @@ public class OverviewInputConsumer<S extends BaseState<S>, T extends StatefulAct
                mInputMonitor.pilferPointers();
                mInputMonitor.pilferPointers();
            }
            }
        }
        }
        if (mHasSetTouchModeForFirstDPadEvent) {
            mActivity.getRootView().clearFocus();
        }
    }
    }


    @Override
    @Override
@@ -112,6 +116,19 @@ public class OverviewInputConsumer<S extends BaseState<S>, T extends StatefulAct
                mgr.dispatchVolumeKeyEventAsSystemService(ev,
                mgr.dispatchVolumeKeyEventAsSystemService(ev,
                        AudioManager.USE_DEFAULT_STREAM_TYPE);
                        AudioManager.USE_DEFAULT_STREAM_TYPE);
                break;
                break;
            case KeyEvent.KEYCODE_DPAD_LEFT:
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (!mHasSetTouchModeForFirstDPadEvent) {
                    // When Overview is launched via meta+tab or swipe up from an app, the touch
                    // mode somehow is not changed to false by the Android framework. The subsequent
                    // key events (e.g. DPAD_LEFT, DPAD_RIGHT) can only be dispatched to focused
                    // views, while focus can only be requested in
                    // {@link View#requestFocusNoSearch(int, Rect)} when touch mode is false. To
                    // note, here we launch overview with live tile.
                    mHasSetTouchModeForFirstDPadEvent = true;
                    mActivity.getRootView().getViewRootImpl().touchModeChanged(false);
                }
                break;
            default:
            default:
                break;
                break;
        }
        }