diff options
| author | 2024-06-06 21:48:36 +0000 | |
|---|---|---|
| committer | 2024-06-06 21:48:36 +0000 | |
| commit | 86bc0b4e4e5e9feb6301b8f8de5afcafad767ca5 (patch) | |
| tree | 3e8d67a57ecca4d446332a6e34569e873207711b | |
| parent | e4f46b411dc656be998ebdad9cd0fa9dca683937 (diff) | |
| parent | da661016087ebc8041ac777e044b6876b76519af (diff) | |
Merge "Add a boolean variable to signal whether we use deadzone with nav bar, and use that signal in our existing logic." into main
| -rw-r--r-- | packages/SystemUI/res/values/config.xml | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java | 22 |
2 files changed, 22 insertions, 3 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index fb883640c9a9..f8762f0a98d5 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -37,6 +37,9 @@ <item>400</item> </integer-array> + <!-- Whether to use deadzone with nav bar --> + <bool name="config_useDeadZone">true</bool> + <!-- decay duration (from size_max -> size), in ms --> <integer name="navigation_bar_deadzone_hold">333</integer> <integer name="navigation_bar_deadzone_decay">333</integer> diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java index 326830600635..8177fdec86e6 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/DeadZone.java @@ -61,6 +61,7 @@ public class DeadZone { } }; + private final boolean mUseDeadZone; private final NavigationBarController mNavBarController; private final NavigationBarView mNavigationBarView; @@ -86,9 +87,12 @@ public class DeadZone { @Inject public DeadZone(NavigationBarView view) { + mUseDeadZone = view.getResources().getBoolean(R.bool.config_useDeadZone); + mNavigationBarView = view; mNavBarController = Dependency.get(NavigationBarController.class); mDisplayId = view.getContext().getDisplayId(); + onConfigurationChanged(HORIZONTAL); } @@ -108,12 +112,20 @@ public class DeadZone { } public void setFlashOnTouchCapture(boolean dbg) { + if (!mUseDeadZone) { + return; + } + mShouldFlash = dbg; mFlashFrac = 0f; mNavigationBarView.postInvalidate(); } public void onConfigurationChanged(int rotation) { + if (!mUseDeadZone) { + return; + } + mDisplayRotation = rotation; final Resources res = mNavigationBarView.getResources(); @@ -134,6 +146,10 @@ public class DeadZone { // I made you a touch event... public boolean onTouchEvent(MotionEvent event) { + if (!mUseDeadZone) { + return false; + } + if (DEBUG) { Slog.v(TAG, this + " onTouch: " + MotionEvent.actionToString(event.getAction())); } @@ -187,17 +203,17 @@ public class DeadZone { if (mShouldFlash) mNavigationBarView.postInvalidate(); } - public void setFlash(float f) { + private void setFlash(float f) { mFlashFrac = f; mNavigationBarView.postInvalidate(); } - public float getFlash() { + private float getFlash() { return mFlashFrac; } public void onDraw(Canvas can) { - if (!mShouldFlash || mFlashFrac <= 0f) { + if (!mUseDeadZone || !mShouldFlash || mFlashFrac <= 0f) { return; } |