diff options
author | Rashed Abdel-Tawab <rashed@linux.com> | 2017-10-03 17:17:37 -0400 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-05-07 00:20:58 +0800 |
commit | b22a41ebeb8fc9bf9093bf5a713edf2abb47f838 (patch) | |
tree | ad527567d4a76857e7ac91e3209275acd105697e /packages | |
parent | 613b6be4e17b52da8c9991cb8ec92b1b22c90438 (diff) |
SystemUI: Add double tap to sleep gesture
Author: Roman Birg <roman@cyngn.com>
Date: Sun Nov 23 06:54:06 2014 -0800
SystemUI: double tap to sleep improvements
* Make it more reliable
* Add it to keyguard
* Add a content observer to not always query Settings.System on every
touch event
Change-Id: I292c4d9d9f810843590b7a9ec6e15b99ac44009d
Signed-off-by: Roman Birg <roman@cyngn.com>
Author: Adnan Begovic <adnan@cyngn.com>
Date: Wed Nov 11 12:05:59 2015 -0800
fw: Move DOUBLE_TAP_SLEEP_GESTURE to CMSettings.
Change-Id: I8274b7c241cef6835a1114a702e68c95b6d2e036
Author: Zhao Wei Liew <zhaoweiliew@gmail.com>
Date: Fri Oct 7 08:56:25 2016 +0800
SystemUI: Use Tuner API for CM settings
Get rid of all the excess code by implementing TunerService.Tunable
and observing any changes made to the settings through it.
Remove UserContentObserver as the Tuner API handles user switches.
Also remove some unused imports that were introduced in earlier
CM commits, but were never removed since.
Change-Id: Iecafafabdaec82b3b3c72293bea865de48f0e90a
Author: Altaf-Mahdi <altaf.mahdi@gmail.com>
Date: Wed Nov 11 16:07:49 2015 -0500
Double tap to sleep anywhere on the lock screen [1/3]
Change-Id: I7dd46f3fafeb2e629974c0f32083d4d9774fb1de
[neo: Using Tuner API.]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Author: dianlujitao <dianlujitao@lineageos.org>
Date: Thu Feb 27 12:57:07 2020 +0800
SystemUI: Don't sleep on double tap below status bar
Change-Id: Ic64c29eae63e96f34dc37cda355401b7e2cd2d39
[Pig]: Forward port to R
[bgcngm]: Forward port to S
POSP edit: keep the lockscreen part only
also add dozing and ambient pulsing checks
Change-Id: I0281d23cb3ad5f8f2b67d08ae431e8a962a60927
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 0dda75b6bfd9..11a0c7e93488 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -74,6 +74,7 @@ import android.transition.ChangeBounds; import android.transition.TransitionManager; import android.util.Log; import android.util.MathUtils; +import android.view.GestureDetector; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -185,6 +186,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcherController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; +import com.android.systemui.tuner.TunerService; import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.util.Utils; import com.android.systemui.util.settings.SecureSettings; @@ -277,6 +279,9 @@ public class NotificationPanelViewController extends PanelViewController { private static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs"; private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek"; + private static final String DOUBLE_TAP_SLEEP_GESTURE = + Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE; + private static final Rect M_DUMMY_DIRTY_RECT = new Rect(0, 0, 1, 1); private static final Rect EMPTY_RECT = new Rect(); @@ -291,6 +296,7 @@ public class NotificationPanelViewController extends PanelViewController { private final AuthController mAuthController; private final MediaHierarchyManager mMediaHierarchyManager; private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; + private final TunerService mTunerService; private final KeyguardStatusViewComponent.Factory mKeyguardStatusViewComponentFactory; private final KeyguardQsUserSwitchComponent.Factory mKeyguardQsUserSwitchComponentFactory; private final KeyguardUserSwitcherComponent.Factory mKeyguardUserSwitcherComponentFactory; @@ -497,6 +503,8 @@ public class NotificationPanelViewController extends PanelViewController { private NotificationShadeDepthController mDepthController; private int mDisplayId; + private boolean mDoubleTapToSleepEnabled; + private GestureDetector mDoubleTapGesture; /** * Cache the resource id of the theme to avoid unnecessary work in onThemeChanged. @@ -681,6 +689,7 @@ public class NotificationPanelViewController extends PanelViewController { ConversationNotificationManager conversationNotificationManager, MediaHierarchyManager mediaHierarchyManager, StatusBarKeyguardViewManager statusBarKeyguardViewManager, + TunerService tunerService, NotificationsQSContainerController notificationsQSContainerController, NotificationStackScrollLayoutController notificationStackScrollLayoutController, KeyguardStatusViewComponent.Factory keyguardStatusViewComponentFactory, @@ -742,6 +751,7 @@ public class NotificationPanelViewController extends PanelViewController { mFlingAnimationUtilsBuilder = flingAnimationUtilsBuilder; mMediaHierarchyManager = mediaHierarchyManager; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; + mTunerService = tunerService; mNotificationsQSContainerController = notificationsQSContainerController; mNotificationsQSContainerController.init(); mNotificationStackScrollLayoutController = notificationStackScrollLayoutController; @@ -807,6 +817,16 @@ public class NotificationPanelViewController extends PanelViewController { }); mBottomAreaShadeAlphaAnimator.setDuration(160); mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT); + mDoubleTapGesture = new GestureDetector(mView.getContext(), + new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onDoubleTap(MotionEvent e) { + if (mPowerManager != null) { + mPowerManager.goToSleep(e.getEventTime()); + } + return true; + } + }); mLockscreenUserManager = notificationLockscreenUserManager; mEntryManager = notificationEntryManager; mConversationNotificationManager = conversationNotificationManager; @@ -3896,6 +3916,10 @@ public class NotificationPanelViewController extends PanelViewController { return false; } + if (mDoubleTapToSleepEnabled && !mPulsing && !mDozing && mBarState == StatusBarState.KEYGUARD) { + mDoubleTapGesture.onTouchEvent(event); + } + // Make sure the next touch won't the blocked after the current ends. if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { @@ -4566,13 +4590,15 @@ public class NotificationPanelViewController extends PanelViewController { positionClockAndNotifications(true /* forceUpdate */); } - private class OnAttachStateChangeListener implements View.OnAttachStateChangeListener { + private class OnAttachStateChangeListener implements View.OnAttachStateChangeListener, + TunerService.Tunable { @Override public void onViewAttachedToWindow(View v) { mFragmentService.getFragmentHostManager(mView) .addTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.addCallback(mStatusBarStateListener); mConfigurationController.addCallback(mConfigurationListener); + mTunerService.addTunable(this, DOUBLE_TAP_SLEEP_GESTURE); // Theme might have changed between inflating this view and attaching it to the // window, so // force a call to onThemeChanged @@ -4590,6 +4616,14 @@ public class NotificationPanelViewController extends PanelViewController { mStatusBarStateController.removeCallback(mStatusBarStateListener); mConfigurationController.removeCallback(mConfigurationListener); mFalsingManager.removeTapListener(mFalsingTapListener); + mTunerService.removeTunable(this); + } + + @Override + public void onTuningChanged(String key, String newValue) { + if (DOUBLE_TAP_SLEEP_GESTURE.equals(key)) { + mDoubleTapToSleepEnabled = TunerService.parseIntegerSwitch(newValue, true); + } } } |