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

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

Added setprop to go back after gesture end

Added a new setprop to perform back when home swipe gesture ends, after
touch up event. This will disable the ability to have multiple back
events over a period of time. Also shortened the pulling home button
distance.

Usage: setprop persist.quickstepcontroller.homegoesbackwhenend true

Bug: 112934365
Test: go/home-back-gesture
Change-Id: I49b91ef09e0b35f971e76173cbf163daead66746
parent 44dcfc39
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -955,7 +955,7 @@
    <dimen name="nav_content_padding">0dp</dimen>
    <dimen name="nav_quick_scrub_track_edge_padding">24dp</dimen>
    <dimen name="nav_quick_scrub_track_thickness">10dp</dimen>
    <dimen name="nav_home_back_gesture_drag_limit">60dp</dimen>
    <dimen name="nav_home_back_gesture_drag_limit">40dp</dimen>

    <!-- Navigation bar shadow params. -->
    <dimen name="nav_key_button_shadow_offset_x">0dp</dimen>
+14 −6
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ public class QuickStepController implements GestureHelper {
    /** Experiment to swipe home button left to execute a back key press */
    private static final String PULL_HOME_GO_BACK_PROP = "persist.quickstepcontroller.homegoesback";
    private static final String HIDE_BACK_BUTTON_PROP = "persist.quickstepcontroller.hideback";
    private static final String BACK_AFTER_END_PROP
            = "persist.quickstepcontroller.homegoesbackwhenend";
    private static final long BACK_BUTTON_FADE_OUT_ALPHA = 60;
    private static final long BACK_BUTTON_FADE_IN_ALPHA = 150;
    private static final long BACK_GESTURE_POLL_TIMEOUT = 1000;
@@ -84,9 +86,6 @@ public class QuickStepController implements GestureHelper {
    /** When the home-swipe-back gesture is disallowed, make it harder to pull */
    private static final float DISALLOW_GESTURE_DAMPING_FACTOR = 0.16f;

    /** When dragging the home button too far during back gesture, make it harder to pull */
    private static final float EXCEED_DRAG_HOME_DAMPING_FACTOR = 0.33f;

    private NavigationBarView mNavigationBarView;

    private boolean mQuickScrubActive;
@@ -361,7 +360,7 @@ public class QuickStepController implements GestureHelper {
                        // Once the user drags the home button past a certain limit, the distance
                        // will lessen as the home button dampens showing that it was pulled too far
                        float distanceAfterDragLimit = (Math.abs(diff) - mHomeBackGestureDragLimit)
                                * EXCEED_DRAG_HOME_DAMPING_FACTOR;
                                * DISALLOW_GESTURE_DAMPING_FACTOR;
                        diff = (int)(distanceAfterDragLimit + mHomeBackGestureDragLimit);
                        if (mDragPositive) {
                            diff *= -1;
@@ -580,17 +579,23 @@ public class QuickStepController implements GestureHelper {
        if (!mBackGestureActive) {
            mBackGestureActive = true;
            mNavigationBarView.getHomeButton().abortCurrentGesture();
            final boolean runBackMidGesture
                    = !SystemProperties.getBoolean(BACK_AFTER_END_PROP, false);
            if (mCanPerformBack) {
                if (!shouldhideBackButton()) {
                    mNavigationBarView.getBackButton().setAlpha(0 /* alpha */, true /* animate */,
                            BACK_BUTTON_FADE_OUT_ALPHA);
                }
                if (runBackMidGesture) {
                    performBack();
                }
            }
            mHandler.removeCallbacks(mExecuteBackRunnable);
            if (runBackMidGesture) {
                mHandler.postDelayed(mExecuteBackRunnable, BACK_GESTURE_POLL_TIMEOUT);
            }
        }
    }

    private void endBackGesture() {
        if (mBackGestureActive) {
@@ -609,6 +614,9 @@ public class QuickStepController implements GestureHelper {
                mNavigationBarView.getBackButton().setAlpha(
                        mOverviewEventSender.getBackButtonAlpha(), true /* animate */);
            }
            if (SystemProperties.getBoolean(BACK_AFTER_END_PROP, false)) {
                performBack();
            }
        }
    }