Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.statusbar.phone; |
| 18 | |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 19 | import static android.view.WindowManagerPolicyConstants.NAV_BAR_BOTTOM; |
| 20 | import static android.view.WindowManagerPolicyConstants.NAV_BAR_LEFT; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 21 | import static android.view.WindowManagerPolicyConstants.NAV_BAR_RIGHT; |
| 22 | |
Winson Chung | 2dbcf09 | 2018-10-24 13:00:41 -0700 | [diff] [blame] | 23 | import static com.android.systemui.recents.OverviewProxyService.DEBUG_OVERVIEW_PROXY; |
| 24 | import static com.android.systemui.recents.OverviewProxyService.TAG_OPS; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 25 | import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_BACK; |
Matthew Ng | 472d3e4 | 2018-06-14 15:16:55 -0700 | [diff] [blame] | 26 | import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_DEAD_ZONE; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 27 | import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_HOME; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 28 | import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_NONE; |
| 29 | import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_OVERVIEW; |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 30 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 31 | import android.annotation.Nullable; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 32 | import android.content.Context; |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 33 | import android.content.res.Resources; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 34 | import android.graphics.Canvas; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 35 | import android.graphics.Matrix; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 36 | import android.os.RemoteException; |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 37 | import android.provider.Settings; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 38 | import android.util.Log; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 39 | import android.view.MotionEvent; |
| 40 | import android.view.View; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 41 | import android.view.ViewPropertyAnimator; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 42 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 43 | import com.android.systemui.Dependency; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 44 | import com.android.systemui.Interpolators; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 45 | import com.android.systemui.R; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 46 | import com.android.systemui.SysUiServiceProvider; |
Gus Prevas | ab33679 | 2018-11-14 13:52:20 -0500 | [diff] [blame] | 47 | import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper; |
| 48 | import com.android.systemui.recents.OverviewProxyService; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 49 | import com.android.systemui.shared.recents.IOverviewProxy; |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 50 | import com.android.systemui.shared.recents.utilities.Utilities; |
Matthew Ng | f29ad75 | 2018-04-26 11:24:05 -0700 | [diff] [blame] | 51 | import com.android.systemui.shared.system.NavigationBarCompat; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 52 | |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 53 | import java.io.PrintWriter; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 54 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 55 | /** |
Matthew Ng | fba3969 | 2018-03-13 18:08:34 -0700 | [diff] [blame] | 56 | * Class to detect gestures on the navigation bar and implement quick scrub. |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 57 | * Note that the variables in this class horizontal and vertical represents horizontal always |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 58 | * aligned with along the navigation bar. |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 59 | */ |
Matthew Ng | fba3969 | 2018-03-13 18:08:34 -0700 | [diff] [blame] | 60 | public class QuickStepController implements GestureHelper { |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 61 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 62 | private static final String TAG = "QuickStepController"; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 63 | |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 64 | /** Experiment to swipe home button left to execute a back key press */ |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 65 | private static final String HIDE_BACK_BUTTON_PROP = "quickstepcontroller_hideback"; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 66 | private static final long BACK_BUTTON_FADE_IN_ALPHA = 150; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 67 | |
| 68 | /** When the home-swipe-back gesture is disallowed, make it harder to pull */ |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 69 | private static final float HORIZONTAL_GESTURE_DAMPING = 0.3f; |
| 70 | private static final float VERTICAL_GESTURE_DAMPING = 0.15f; |
| 71 | private static final float HORIZONTAL_DISABLED_GESTURE_DAMPING = 0.16f; |
| 72 | private static final float VERTICAL_DISABLED_GESTURE_DAMPING = 0.06f; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 73 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 74 | private static final int ACTION_SWIPE_UP_INDEX = 0; |
| 75 | private static final int ACTION_SWIPE_DOWN_INDEX = 1; |
| 76 | private static final int ACTION_SWIPE_LEFT_INDEX = 2; |
| 77 | private static final int ACTION_SWIPE_RIGHT_INDEX = 3; |
| 78 | private static final int MAX_GESTURES = 4; |
| 79 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 80 | private NavigationBarView mNavigationBarView; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 81 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 82 | private boolean mAllowGestureDetection; |
Matthew Ng | 90ef063 | 2018-08-15 13:53:15 -0700 | [diff] [blame] | 83 | private boolean mNotificationsVisibleOnDown; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 84 | private int mTouchDownX; |
| 85 | private int mTouchDownY; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 86 | private boolean mDragHPositive; |
| 87 | private boolean mDragVPositive; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 88 | private boolean mIsRTL; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 89 | private int mNavBarPosition; |
Matthew Ng | 7090a80 | 2018-01-19 13:36:22 -0800 | [diff] [blame] | 90 | private float mDarkIntensity; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 91 | private ViewPropertyAnimator mDragBtnAnimator; |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 92 | private ButtonDispatcher mHitTarget; |
Matthew Ng | 20136e6 | 2018-05-30 12:20:31 -0700 | [diff] [blame] | 93 | private boolean mIsInScreenPinning; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 94 | private boolean mGestureHorizontalDragsButton; |
| 95 | private boolean mGestureVerticalDragsButton; |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 96 | private float mMaxDragLimit; |
| 97 | private float mMinDragLimit; |
| 98 | private float mDragDampeningFactor; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 99 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 100 | private NavigationGestureAction mCurrentAction; |
| 101 | private NavigationGestureAction[] mGestureActions = new NavigationGestureAction[MAX_GESTURES]; |
| 102 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 103 | private final OverviewProxyService mOverviewEventSender; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 104 | private final Context mContext; |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 105 | private final StatusBar mStatusBar; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 106 | private final Matrix mTransformGlobalMatrix = new Matrix(); |
| 107 | private final Matrix mTransformLocalMatrix = new Matrix(); |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 108 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 109 | public QuickStepController(Context context) { |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 110 | final Resources res = context.getResources(); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 111 | mContext = context; |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 112 | mStatusBar = SysUiServiceProvider.getComponent(context, StatusBar.class); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 113 | mOverviewEventSender = Dependency.get(OverviewProxyService.class); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | public void setComponents(NavigationBarView navigationBarView) { |
| 117 | mNavigationBarView = navigationBarView; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 118 | |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 119 | mNavigationBarView.getBackButton().setVisibility(shouldhideBackButton(mContext) |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 120 | ? View.GONE |
| 121 | : View.VISIBLE); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Winson Chung | 4faf38a | 2018-02-06 08:53:37 -0800 | [diff] [blame] | 124 | /** |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 125 | * Set each gesture an action. After set the gestures triggered will run the actions attached. |
| 126 | * @param swipeUpAction action after swiping up |
| 127 | * @param swipeDownAction action after swiping down |
| 128 | * @param swipeLeftAction action after swiping left |
| 129 | * @param swipeRightAction action after swiping right |
| 130 | */ |
| 131 | public void setGestureActions(@Nullable NavigationGestureAction swipeUpAction, |
| 132 | @Nullable NavigationGestureAction swipeDownAction, |
| 133 | @Nullable NavigationGestureAction swipeLeftAction, |
| 134 | @Nullable NavigationGestureAction swipeRightAction) { |
| 135 | mGestureActions[ACTION_SWIPE_UP_INDEX] = swipeUpAction; |
| 136 | mGestureActions[ACTION_SWIPE_DOWN_INDEX] = swipeDownAction; |
| 137 | mGestureActions[ACTION_SWIPE_LEFT_INDEX] = swipeLeftAction; |
| 138 | mGestureActions[ACTION_SWIPE_RIGHT_INDEX] = swipeRightAction; |
| 139 | |
| 140 | // Set the current state to all actions |
| 141 | for (NavigationGestureAction action: mGestureActions) { |
| 142 | if (action != null) { |
| 143 | action.setBarState(true, mNavBarPosition, mDragHPositive, mDragVPositive); |
| 144 | action.onDarkIntensityChange(mDarkIntensity); |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | /** |
Matthew Ng | fba3969 | 2018-03-13 18:08:34 -0700 | [diff] [blame] | 150 | * @return true if we want to intercept touch events for quick scrub and prevent proxying the |
| 151 | * event to the overview service. |
Winson Chung | 4faf38a | 2018-02-06 08:53:37 -0800 | [diff] [blame] | 152 | */ |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 153 | @Override |
| 154 | public boolean onInterceptTouchEvent(MotionEvent event) { |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 155 | if (mStatusBar.isKeyguardShowing()) { |
| 156 | // Disallow any handling when the keyguard is showing |
| 157 | return false; |
| 158 | } |
Winson Chung | de2a124 | 2018-02-07 15:59:43 -0800 | [diff] [blame] | 159 | return handleTouchEvent(event); |
| 160 | } |
| 161 | |
| 162 | /** |
Matthew Ng | fba3969 | 2018-03-13 18:08:34 -0700 | [diff] [blame] | 163 | * @return true if we want to handle touch events for quick scrub or if down event (that will |
| 164 | * get consumed and ignored). No events will be proxied to the overview service. |
Winson Chung | de2a124 | 2018-02-07 15:59:43 -0800 | [diff] [blame] | 165 | */ |
| 166 | @Override |
| 167 | public boolean onTouchEvent(MotionEvent event) { |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 168 | if (mStatusBar.isKeyguardShowing()) { |
| 169 | // Disallow any handling when the keyguard is showing |
| 170 | return false; |
| 171 | } |
| 172 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 173 | // The same down event was just sent on intercept and therefore can be ignored here |
| 174 | final boolean ignoreProxyDownEvent = event.getAction() == MotionEvent.ACTION_DOWN |
| 175 | && mOverviewEventSender.getProxy() != null; |
| 176 | return ignoreProxyDownEvent || handleTouchEvent(event); |
Winson Chung | de2a124 | 2018-02-07 15:59:43 -0800 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | private boolean handleTouchEvent(MotionEvent event) { |
Matthew Ng | 472d3e4 | 2018-06-14 15:16:55 -0700 | [diff] [blame] | 180 | final boolean deadZoneConsumed = |
| 181 | mNavigationBarView.getDownHitTarget() == HIT_TARGET_DEAD_ZONE; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 182 | |
| 183 | // Requires proxy and an active gesture or able to perform any gesture to continue |
| 184 | if (mOverviewEventSender.getProxy() == null |
| 185 | || (mCurrentAction == null && !canPerformAnyAction())) { |
Matthew Ng | 2cbe8cd | 2018-08-20 11:27:40 -0700 | [diff] [blame] | 186 | return deadZoneConsumed; |
Matthew Ng | 22cf514 | 2018-03-14 12:26:14 -0700 | [diff] [blame] | 187 | } |
| 188 | mNavigationBarView.requestUnbufferedDispatch(event); |
| 189 | |
Matthew Ng | 9a22363 | 2018-03-30 16:47:22 -0700 | [diff] [blame] | 190 | int action = event.getActionMasked(); |
| 191 | switch (action) { |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 192 | case MotionEvent.ACTION_DOWN: { |
| 193 | int x = (int) event.getX(); |
| 194 | int y = (int) event.getY(); |
Matthew Ng | 20136e6 | 2018-05-30 12:20:31 -0700 | [diff] [blame] | 195 | mIsInScreenPinning = mNavigationBarView.inScreenPinning(); |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 196 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 197 | for (NavigationGestureAction gestureAction: mGestureActions) { |
| 198 | if (gestureAction != null) { |
| 199 | gestureAction.reset(); |
| 200 | } |
Winson Chung | 0be8f08 | 2018-02-15 15:52:49 -0800 | [diff] [blame] | 201 | } |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 202 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 203 | // Valid buttons to drag over |
| 204 | switch (mNavigationBarView.getDownHitTarget()) { |
| 205 | case HIT_TARGET_BACK: |
| 206 | mHitTarget = mNavigationBarView.getBackButton(); |
| 207 | break; |
| 208 | case HIT_TARGET_HOME: |
| 209 | mHitTarget = mNavigationBarView.getHomeButton(); |
| 210 | break; |
| 211 | case HIT_TARGET_OVERVIEW: |
| 212 | mHitTarget = mNavigationBarView.getRecentsButton(); |
| 213 | break; |
| 214 | default: |
| 215 | mHitTarget = null; |
| 216 | break; |
| 217 | } |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 218 | if (mHitTarget != null) { |
| 219 | // Pre-emptively delay the touch feedback for the button that we just touched |
| 220 | mHitTarget.setDelayTouchFeedback(true); |
| 221 | } |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 222 | mTouchDownX = x; |
| 223 | mTouchDownY = y; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 224 | mGestureHorizontalDragsButton = false; |
| 225 | mGestureVerticalDragsButton = false; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 226 | mTransformGlobalMatrix.set(Matrix.IDENTITY_MATRIX); |
| 227 | mTransformLocalMatrix.set(Matrix.IDENTITY_MATRIX); |
| 228 | mNavigationBarView.transformMatrixToGlobal(mTransformGlobalMatrix); |
| 229 | mNavigationBarView.transformMatrixToLocal(mTransformLocalMatrix); |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 230 | mAllowGestureDetection = true; |
Matthew Ng | 90ef063 | 2018-08-15 13:53:15 -0700 | [diff] [blame] | 231 | mNotificationsVisibleOnDown = !mNavigationBarView.isNotificationsFullyCollapsed(); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 232 | break; |
| 233 | } |
| 234 | case MotionEvent.ACTION_MOVE: { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 235 | if (!mAllowGestureDetection) { |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 236 | break; |
| 237 | } |
| 238 | int x = (int) event.getX(); |
| 239 | int y = (int) event.getY(); |
| 240 | int xDiff = Math.abs(x - mTouchDownX); |
| 241 | int yDiff = Math.abs(y - mTouchDownY); |
Matthew Ng | 9a22363 | 2018-03-30 16:47:22 -0700 | [diff] [blame] | 242 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 243 | boolean exceededSwipeHorizontalTouchSlop, exceededSwipeVerticalTouchSlop; |
| 244 | int posH, touchDownH, posV, touchDownV; |
Matthew Ng | e0903c9 | 2018-01-17 15:32:41 -0800 | [diff] [blame] | 245 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 246 | if (isNavBarVertical()) { |
| 247 | exceededSwipeHorizontalTouchSlop = |
Matthew Ng | f29ad75 | 2018-04-26 11:24:05 -0700 | [diff] [blame] | 248 | yDiff > NavigationBarCompat.getQuickScrubTouchSlopPx() && yDiff > xDiff; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 249 | exceededSwipeVerticalTouchSlop = |
Matthew Ng | f29ad75 | 2018-04-26 11:24:05 -0700 | [diff] [blame] | 250 | xDiff > NavigationBarCompat.getQuickStepTouchSlopPx() && xDiff > yDiff; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 251 | posH = y; |
| 252 | touchDownH = mTouchDownY; |
| 253 | posV = x; |
| 254 | touchDownV = mTouchDownX; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 255 | } else { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 256 | exceededSwipeHorizontalTouchSlop = |
Matthew Ng | f29ad75 | 2018-04-26 11:24:05 -0700 | [diff] [blame] | 257 | xDiff > NavigationBarCompat.getQuickScrubTouchSlopPx() && xDiff > yDiff; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 258 | exceededSwipeVerticalTouchSlop = |
Matthew Ng | f29ad75 | 2018-04-26 11:24:05 -0700 | [diff] [blame] | 259 | yDiff > NavigationBarCompat.getQuickStepTouchSlopPx() && yDiff > xDiff; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 260 | posH = x; |
| 261 | touchDownH = mTouchDownX; |
| 262 | posV = y; |
| 263 | touchDownV = mTouchDownY; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 264 | } |
Winson Chung | 0e490d92 | 2018-03-14 16:08:43 +0000 | [diff] [blame] | 265 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 266 | if (mCurrentAction != null) { |
| 267 | // Gesture started, provide positions to the current action |
| 268 | mCurrentAction.onGestureMove(x, y); |
| 269 | } else { |
| 270 | // Detect gesture and try to execute an action, only one can run at a time |
| 271 | if (exceededSwipeVerticalTouchSlop) { |
| 272 | if (mDragVPositive ? (posV < touchDownV) : (posV > touchDownV)) { |
| 273 | // Swiping up gesture |
| 274 | tryToStartGesture(mGestureActions[ACTION_SWIPE_UP_INDEX], |
| 275 | false /* alignedWithNavBar */, false /* positiveDirection */, |
| 276 | event); |
| 277 | } else { |
| 278 | // Swiping down gesture |
| 279 | tryToStartGesture(mGestureActions[ACTION_SWIPE_DOWN_INDEX], |
| 280 | false /* alignedWithNavBar */, true /* positiveDirection */, |
| 281 | event); |
Winson Chung | 0e490d92 | 2018-03-14 16:08:43 +0000 | [diff] [blame] | 282 | } |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 283 | } else if (exceededSwipeHorizontalTouchSlop) { |
| 284 | if (mDragHPositive ? (posH < touchDownH) : (posH > touchDownH)) { |
| 285 | // Swiping left (ltr) gesture |
| 286 | tryToStartGesture(mGestureActions[ACTION_SWIPE_LEFT_INDEX], |
| 287 | true /* alignedWithNavBar */, false /* positiveDirection */, |
| 288 | event); |
| 289 | } else { |
| 290 | // Swiping right (ltr) gesture |
| 291 | tryToStartGesture(mGestureActions[ACTION_SWIPE_RIGHT_INDEX], |
| 292 | true /* alignedWithNavBar */, true /* positiveDirection */, |
| 293 | event); |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 294 | } |
| 295 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 296 | } |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 297 | |
| 298 | handleDragHitTarget(mGestureHorizontalDragsButton ? posH : posV, |
| 299 | mGestureHorizontalDragsButton ? touchDownH : touchDownV); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 300 | break; |
| 301 | } |
| 302 | case MotionEvent.ACTION_CANCEL: |
| 303 | case MotionEvent.ACTION_UP: |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 304 | if (mCurrentAction != null) { |
| 305 | mCurrentAction.endGesture(); |
| 306 | mCurrentAction = null; |
| 307 | } |
| 308 | |
| 309 | // Return the hit target back to its original position |
| 310 | if (mHitTarget != null) { |
| 311 | final View button = mHitTarget.getCurrentView(); |
| 312 | if (mGestureHorizontalDragsButton || mGestureVerticalDragsButton) { |
| 313 | mDragBtnAnimator = button.animate().setDuration(BACK_BUTTON_FADE_IN_ALPHA) |
| 314 | .setInterpolator(Interpolators.FAST_OUT_SLOW_IN); |
| 315 | if (mGestureVerticalDragsButton ^ isNavBarVertical()) { |
| 316 | mDragBtnAnimator.translationY(0); |
| 317 | } else { |
| 318 | mDragBtnAnimator.translationX(0); |
| 319 | } |
| 320 | mDragBtnAnimator.start(); |
| 321 | } |
| 322 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 323 | break; |
| 324 | } |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 325 | |
Matthew Ng | 90ef063 | 2018-08-15 13:53:15 -0700 | [diff] [blame] | 326 | if (shouldProxyEvents(action)) { |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 327 | proxyMotionEvents(event); |
| 328 | } |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 329 | return mCurrentAction != null || deadZoneConsumed; |
| 330 | } |
| 331 | |
| 332 | private void handleDragHitTarget(int position, int touchDown) { |
| 333 | // Drag the hit target if gesture action requires it |
| 334 | if (mHitTarget != null && (mGestureVerticalDragsButton || mGestureHorizontalDragsButton)) { |
| 335 | final View button = mHitTarget.getCurrentView(); |
| 336 | if (mDragBtnAnimator != null) { |
| 337 | mDragBtnAnimator.cancel(); |
| 338 | mDragBtnAnimator = null; |
| 339 | } |
| 340 | |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 341 | // Clamp drag to the bounding box of the navigation bar |
| 342 | float diff = (position - touchDown) * mDragDampeningFactor; |
| 343 | diff = Utilities.clamp(diff, mMinDragLimit, mMaxDragLimit); |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 344 | if (mGestureVerticalDragsButton ^ isNavBarVertical()) { |
| 345 | button.setTranslationY(diff); |
| 346 | } else { |
| 347 | button.setTranslationX(diff); |
| 348 | } |
| 349 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 350 | } |
| 351 | |
Matthew Ng | 90ef063 | 2018-08-15 13:53:15 -0700 | [diff] [blame] | 352 | private boolean shouldProxyEvents(int action) { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 353 | final boolean actionValid = (mCurrentAction == null |
| 354 | || (mGestureActions[ACTION_SWIPE_UP_INDEX] != null |
| 355 | && mGestureActions[ACTION_SWIPE_UP_INDEX].isActive())); |
| 356 | if (actionValid && !mIsInScreenPinning) { |
Matthew Ng | 90ef063 | 2018-08-15 13:53:15 -0700 | [diff] [blame] | 357 | // Allow down, cancel and up events, move and other events are passed if notifications |
| 358 | // are not showing and disabled gestures (such as long press) are not executed |
| 359 | switch (action) { |
| 360 | case MotionEvent.ACTION_DOWN: |
| 361 | case MotionEvent.ACTION_CANCEL: |
| 362 | case MotionEvent.ACTION_UP: |
| 363 | return true; |
| 364 | default: |
| 365 | return !mNotificationsVisibleOnDown && mAllowGestureDetection; |
| 366 | } |
| 367 | } |
| 368 | return false; |
| 369 | } |
| 370 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 371 | @Override |
| 372 | public void onDraw(Canvas canvas) { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 373 | if (mCurrentAction != null) { |
| 374 | mCurrentAction.onDraw(canvas); |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 375 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 376 | } |
| 377 | |
| 378 | @Override |
| 379 | public void onLayout(boolean changed, int left, int top, int right, int bottom) { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 380 | for (NavigationGestureAction action: mGestureActions) { |
| 381 | if (action != null) { |
| 382 | action.onLayout(changed, left, top, right, bottom); |
| 383 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 384 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public void onDarkIntensityChange(float intensity) { |
Matthew Ng | 4fa3a9d | 2018-06-12 16:42:11 -0700 | [diff] [blame] | 389 | final float oldIntensity = mDarkIntensity; |
Matthew Ng | 7090a80 | 2018-01-19 13:36:22 -0800 | [diff] [blame] | 390 | mDarkIntensity = intensity; |
Matthew Ng | 4fa3a9d | 2018-06-12 16:42:11 -0700 | [diff] [blame] | 391 | |
| 392 | // When in quick scrub, invalidate gradient if changing intensity from black to white and |
| 393 | // vice-versa |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 394 | if (mCurrentAction != null && mNavigationBarView.isQuickScrubEnabled() |
Matthew Ng | 4fa3a9d | 2018-06-12 16:42:11 -0700 | [diff] [blame] | 395 | && Math.round(intensity) != Math.round(oldIntensity)) { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 396 | mCurrentAction.onDarkIntensityChange(mDarkIntensity); |
Matthew Ng | 4fa3a9d | 2018-06-12 16:42:11 -0700 | [diff] [blame] | 397 | } |
Matthew Ng | 7090a80 | 2018-01-19 13:36:22 -0800 | [diff] [blame] | 398 | mNavigationBarView.invalidate(); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | @Override |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 402 | public void setBarState(boolean isRTL, int navBarPosition) { |
| 403 | final boolean changed = (mIsRTL != isRTL) || (mNavBarPosition != navBarPosition); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 404 | mIsRTL = isRTL; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 405 | mNavBarPosition = navBarPosition; |
| 406 | |
| 407 | // Determine the drag directions depending on location of nav bar |
| 408 | switch (navBarPosition) { |
| 409 | case NAV_BAR_LEFT: |
| 410 | mDragHPositive = !isRTL; |
| 411 | mDragVPositive = false; |
| 412 | break; |
| 413 | case NAV_BAR_RIGHT: |
| 414 | mDragHPositive = isRTL; |
| 415 | mDragVPositive = true; |
| 416 | break; |
| 417 | case NAV_BAR_BOTTOM: |
| 418 | mDragHPositive = !isRTL; |
| 419 | mDragVPositive = true; |
| 420 | break; |
| 421 | } |
| 422 | |
| 423 | for (NavigationGestureAction action: mGestureActions) { |
| 424 | if (action != null) { |
| 425 | action.setBarState(changed, mNavBarPosition, mDragHPositive, mDragVPositive); |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 426 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 427 | } |
| 428 | } |
| 429 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 430 | @Override |
| 431 | public void onNavigationButtonLongPress(View v) { |
| 432 | mAllowGestureDetection = false; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 433 | } |
| 434 | |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 435 | @Override |
| 436 | public void dump(PrintWriter pw) { |
| 437 | pw.println("QuickStepController {"); |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 438 | pw.print(" "); pw.println("mAllowGestureDetection=" + mAllowGestureDetection); |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 439 | pw.print(" "); pw.println("mNotificationsVisibleOnDown=" + mNotificationsVisibleOnDown); |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 440 | pw.print(" "); pw.println("mNavBarPosition=" + mNavBarPosition); |
Winson Chung | 0d3815d | 2018-09-25 18:11:54 -0700 | [diff] [blame] | 441 | pw.print(" "); pw.println("mIsRTL=" + mIsRTL); |
| 442 | pw.print(" "); pw.println("mIsInScreenPinning=" + mIsInScreenPinning); |
| 443 | pw.println("}"); |
| 444 | } |
| 445 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 446 | public NavigationGestureAction getCurrentAction() { |
| 447 | return mCurrentAction; |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 448 | } |
| 449 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 450 | private void tryToStartGesture(NavigationGestureAction action, boolean alignedWithNavBar, |
| 451 | boolean positiveDirection, MotionEvent event) { |
| 452 | if (action == null) { |
| 453 | return; |
| 454 | } |
Matthew Ng | 20136e6 | 2018-05-30 12:20:31 -0700 | [diff] [blame] | 455 | if (mIsInScreenPinning) { |
| 456 | mNavigationBarView.showPinningEscapeToast(); |
| 457 | mAllowGestureDetection = false; |
| 458 | return; |
| 459 | } |
| 460 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 461 | // Start new action from gesture if is able to start and depending on notifications |
| 462 | // visibility and starting touch down target. If the action is enabled, then also check if |
| 463 | // can perform the action so that if action requires the button to be dragged, then the |
| 464 | // gesture will have a large dampening factor and prevent action from running. |
| 465 | final boolean validHitTarget = action.requiresTouchDownHitTarget() == HIT_TARGET_NONE |
| 466 | || action.requiresTouchDownHitTarget() == mNavigationBarView.getDownHitTarget(); |
| 467 | if (mCurrentAction == null && validHitTarget && action.isEnabled() |
| 468 | && (!mNotificationsVisibleOnDown || action.canRunWhenNotificationsShowing())) { |
| 469 | if (action.canPerformAction()) { |
| 470 | mCurrentAction = action; |
| 471 | event.transform(mTransformGlobalMatrix); |
| 472 | action.startGesture(event); |
| 473 | event.transform(mTransformLocalMatrix); |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 474 | |
| 475 | // Calculate the bounding limits of drag to avoid dragging off nav bar's window |
| 476 | if (action.requiresDragWithHitTarget() && mHitTarget != null) { |
| 477 | final int[] buttonCenter = new int[2]; |
| 478 | View button = mHitTarget.getCurrentView(); |
| 479 | button.getLocationInWindow(buttonCenter); |
| 480 | buttonCenter[0] += button.getWidth() / 2; |
| 481 | buttonCenter[1] += button.getHeight() / 2; |
| 482 | final int x = isNavBarVertical() ? buttonCenter[1] : buttonCenter[0]; |
| 483 | final int y = isNavBarVertical() ? buttonCenter[0] : buttonCenter[1]; |
| 484 | final int iconHalfSize = mContext.getResources() |
| 485 | .getDimensionPixelSize(R.dimen.navigation_icon_size) / 2; |
| 486 | |
| 487 | if (alignedWithNavBar) { |
| 488 | mMinDragLimit = iconHalfSize - x; |
| 489 | mMaxDragLimit = -x - iconHalfSize + (isNavBarVertical() |
| 490 | ? mNavigationBarView.getHeight() : mNavigationBarView.getWidth()); |
| 491 | } else { |
| 492 | mMinDragLimit = iconHalfSize - y; |
| 493 | mMaxDragLimit = -y - iconHalfSize + (isNavBarVertical() |
| 494 | ? mNavigationBarView.getWidth() : mNavigationBarView.getHeight()); |
| 495 | } |
| 496 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 497 | } |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 498 | |
| 499 | // Handle direction of the hit target drag from the axis that started the gesture |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 500 | // Also calculate the dampening factor, weaker dampening if there is an active action |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 501 | if (action.requiresDragWithHitTarget()) { |
| 502 | if (alignedWithNavBar) { |
| 503 | mGestureHorizontalDragsButton = true; |
| 504 | mGestureVerticalDragsButton = false; |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 505 | mDragDampeningFactor = action.isActive() |
| 506 | ? HORIZONTAL_GESTURE_DAMPING : HORIZONTAL_DISABLED_GESTURE_DAMPING; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 507 | } else { |
| 508 | mGestureVerticalDragsButton = true; |
| 509 | mGestureHorizontalDragsButton = false; |
Matthew Ng | f1f8a43 | 2018-11-08 18:03:29 -0800 | [diff] [blame] | 510 | mDragDampeningFactor = action.isActive() |
| 511 | ? VERTICAL_GESTURE_DAMPING : VERTICAL_DISABLED_GESTURE_DAMPING; |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 512 | } |
| 513 | } |
Winson Chung | 661d5f9 | 2018-05-21 18:41:39 -0700 | [diff] [blame] | 514 | |
| 515 | if (mHitTarget != null) { |
| 516 | mHitTarget.abortCurrentGesture(); |
| 517 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 518 | } |
| 519 | } |
| 520 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 521 | private boolean canPerformAnyAction() { |
| 522 | for (NavigationGestureAction action: mGestureActions) { |
| 523 | if (action != null && action.isEnabled()) { |
| 524 | return true; |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 525 | } |
Matthew Ng | ed166f9 | 2018-02-20 16:22:09 -0800 | [diff] [blame] | 526 | } |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 527 | return false; |
Matthew Ng | c83b989 | 2018-08-21 16:31:13 -0700 | [diff] [blame] | 528 | } |
| 529 | |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 530 | private boolean proxyMotionEvents(MotionEvent event) { |
| 531 | final IOverviewProxy overviewProxy = mOverviewEventSender.getProxy(); |
| 532 | event.transform(mTransformGlobalMatrix); |
| 533 | try { |
| 534 | if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
| 535 | overviewProxy.onPreMotionEvent(mNavigationBarView.getDownHitTarget()); |
| 536 | } |
| 537 | overviewProxy.onMotionEvent(event); |
| 538 | if (DEBUG_OVERVIEW_PROXY) { |
| 539 | Log.d(TAG_OPS, "Send MotionEvent: " + event.toString()); |
| 540 | } |
| 541 | return true; |
| 542 | } catch (RemoteException e) { |
| 543 | Log.e(TAG, "Callback failed", e); |
| 544 | } finally { |
| 545 | event.transform(mTransformLocalMatrix); |
Matthew Ng | db2734c | 2018-02-16 16:02:20 -0800 | [diff] [blame] | 546 | } |
Matthew Ng | 2ea93b7 | 2018-03-14 19:43:18 +0000 | [diff] [blame] | 547 | return false; |
Matthew Ng | db2734c | 2018-02-16 16:02:20 -0800 | [diff] [blame] | 548 | } |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 549 | |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 550 | protected boolean isNavBarVertical() { |
| 551 | return mNavBarPosition == NAV_BAR_LEFT || mNavBarPosition == NAV_BAR_RIGHT; |
| 552 | } |
| 553 | |
| 554 | static boolean getBoolGlobalSetting(Context context, String key) { |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 555 | return Settings.Global.getInt(context.getContentResolver(), key, 0) != 0; |
| 556 | } |
| 557 | |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 558 | public static boolean shouldhideBackButton(Context context) { |
Matthew Ng | 86a436e | 2018-10-26 16:00:53 -0700 | [diff] [blame] | 559 | return getBoolGlobalSetting(context, HIDE_BACK_BUTTON_PROP); |
Matthew Ng | b687c8a | 2018-10-02 11:31:38 -0700 | [diff] [blame] | 560 | } |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 561 | } |