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

Commit fee0b5b2 authored by Matthew Ng's avatar Matthew Ng
Browse files

Bringing back assistant on long press home button (1/2)

Triggering assistant should have the home button animations run.
Prevent long press to start quickscrub.

Bug: 70180755
Test: long press home with quick step enabled
Change-Id: I8bb75210b1bd15eeb97a8b2bf9bbe022f1822dfe
parent 93d7d0e5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -580,8 +580,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {

    private boolean shouldDisableNavbarGestures() {
        return !mStatusBar.isDeviceProvisioned()
                || (mDisabledFlags1 & StatusBarManager.DISABLE_SEARCH) != 0
                || mNavigationBarView.getRecentsButton().getVisibility() != View.VISIBLE;
                || (mDisabledFlags1 & StatusBarManager.DISABLE_SEARCH) != 0;
    }

    private void repositionNavigationBar() {
@@ -600,13 +599,10 @@ public class NavigationBarFragment extends Fragment implements Callbacks {

        // Change the cancel pin gesture to home and back if recents button is invisible
        boolean recentsVisible = mNavigationBarView.isRecentsButtonVisible();
        ButtonDispatcher homeButton = mNavigationBarView.getHomeButton();
        ButtonDispatcher backButton = mNavigationBarView.getBackButton();
        if (recentsVisible) {
            homeButton.setOnLongClickListener(this::onHomeLongClick);
            backButton.setOnLongClickListener(this::onLongPressBackRecents);
        } else {
            homeButton.setOnLongClickListener(this::onLongPressBackHome);
            backButton.setOnLongClickListener(this::onLongPressBackHome);
        }
    }
@@ -629,6 +625,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {

        ButtonDispatcher homeButton = mNavigationBarView.getHomeButton();
        homeButton.setOnTouchListener(this::onHomeTouch);
        homeButton.setOnLongClickListener(this::onHomeLongClick);

        ButtonDispatcher accessibilityButton = mNavigationBarView.getAccessibilityButton();
        accessibilityButton.setOnClickListener(this::onAccessibilityClick);
@@ -681,6 +678,9 @@ public class NavigationBarFragment extends Fragment implements Callbacks {

    @VisibleForTesting
    boolean onHomeLongClick(View v) {
        if (!mNavigationBarView.isRecentsButtonVisible() && mNavigationBarView.inScreenPinning()) {
            return onLongPressBackHome(v);
        }
        if (shouldDisableNavbarGestures()) {
            return false;
        }
+4 −1
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene
    }

    private void startQuickScrub() {
        if (!mQuickScrubActive) {
        if (!mQuickScrubActive && mDraggingActive) {
            mQuickScrubActive = true;
            mLightTrackColor = mContext.getColor(R.color.quick_step_track_background_light);
            mDarkTrackColor = mContext.getColor(R.color.quick_step_track_background_dark);
@@ -394,6 +394,9 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to send start of quick scrub.", e);
            }
        } else {
            // After long press do not allow quick scrub/switch
            mTouchDownX = -1;
        }
    }