Loading packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +15 −2 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ public class NotificationShadeWindowViewController { step.getTransitionState() == TransitionState.RUNNING; }; private GestureDetector mQQSGestureHandler; private final QQSGestureListener mQQSGestureListener; @Inject public NotificationShadeWindowViewController( LockscreenShadeTransitionController transitionController, Loading @@ -135,7 +138,8 @@ public class NotificationShadeWindowViewController { KeyguardBouncerComponent.Factory keyguardBouncerComponentFactory, AlternateBouncerInteractor alternateBouncerInteractor, KeyguardTransitionInteractor keyguardTransitionInteractor, PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel, QQSGestureListener qqsGestureListener ) { mLockscreenShadeTransitionController = transitionController; mFalsingCollector = falsingCollector; Loading @@ -156,6 +160,7 @@ public class NotificationShadeWindowViewController { mPulsingGestureListener = pulsingGestureListener; mNotificationInsetsController = notificationInsetsController; mAlternateBouncerInteractor = alternateBouncerInteractor; mQQSGestureListener = qqsGestureListener; // This view is not part of the newly inflated expanded status bar. mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container); Loading Loading @@ -188,6 +193,8 @@ public class NotificationShadeWindowViewController { mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller); mPulsingWakeupGestureHandler = new GestureDetector(mView.getContext(), mPulsingGestureListener); mQQSGestureHandler = new GestureDetector(mView.getContext(), mQQSGestureListener); mView.setLayoutInsetsController(mNotificationInsetsController); mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() { Loading Loading @@ -239,7 +246,13 @@ public class NotificationShadeWindowViewController { } mFalsingCollector.onTouchEvent(ev); mQQSGestureHandler.onTouchEvent(ev); // Pass touch events to the pulsing gesture listener only if it's dozing, // otherwise lockscreen DT2S and AOD DT2W will conflict. if (mStatusBarStateController.isDozing()) { mPulsingWakeupGestureHandler.onTouchEvent(ev); } if (mStatusBarKeyguardViewManager.onTouch(ev)) { return true; } Loading packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt +13 −37 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.shade import android.content.Context import android.hardware.display.AmbientDisplayConfiguration import android.os.PowerManager import android.os.SystemClock Loading @@ -34,7 +33,6 @@ import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent import com.android.systemui.tuner.TunerService import com.android.systemui.tuner.TunerService.Tunable import lineageos.providers.LineageSettings; import java.io.PrintWriter import javax.inject.Inject Loading @@ -56,23 +54,14 @@ class PulsingGestureListener @Inject constructor( private val ambientDisplayConfiguration: AmbientDisplayConfiguration, private val statusBarStateController: StatusBarStateController, private val shadeLogger: ShadeLogger, private val powerManager: PowerManager, userTracker: UserTracker, tunerService: TunerService, dumpManager: DumpManager, context: Context dumpManager: DumpManager ) : GestureDetector.SimpleOnGestureListener(), Dumpable { private var doubleTapEnabled = false private var singleTapEnabled = false private var doubleTapEnabledNative = false companion object { internal val DOUBLE_TAP_SLEEP_GESTURE = "lineagesystem:" + LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE } private var doubleTapToSleepEnabled = false private val quickQsOffsetHeight: Int init { val tunable = Tunable { key: String?, value: String? -> when (key) { Loading @@ -84,20 +73,14 @@ class PulsingGestureListener @Inject constructor( Settings.Secure.DOZE_TAP_SCREEN_GESTURE -> singleTapEnabled = ambientDisplayConfiguration.tapGestureEnabled( userTracker.userId) DOUBLE_TAP_SLEEP_GESTURE -> doubleTapToSleepEnabled = TunerService.parseIntegerSwitch(value, true) } } tunerService.addTunable(tunable, Settings.Secure.DOUBLE_TAP_TO_WAKE, Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, Settings.Secure.DOZE_TAP_SCREEN_GESTURE, DOUBLE_TAP_SLEEP_GESTURE) Settings.Secure.DOZE_TAP_SCREEN_GESTURE) dumpManager.registerDumpable(this) quickQsOffsetHeight = context.getResources().getDimensionPixelSize( com.android.internal.R.dimen.quick_qs_offset_height) } override fun onSingleTapUp(e: MotionEvent): Boolean { Loading Loading @@ -129,10 +112,11 @@ class PulsingGestureListener @Inject constructor( override fun onDoubleTapEvent(e: MotionEvent): Boolean { // React to the [MotionEvent.ACTION_UP] event after double tap is detected. Falsing // checks MUST be on the ACTION_UP event. if (e.actionMasked == MotionEvent.ACTION_UP && !falsingManager.isFalseDoubleTap) { if (statusBarStateController.isDozing && if (e.actionMasked == MotionEvent.ACTION_UP && statusBarStateController.isDozing && (doubleTapEnabled || singleTapEnabled || doubleTapEnabledNative) && !falsingManager.isProximityNear !falsingManager.isProximityNear && !falsingManager.isFalseDoubleTap ) { centralSurfaces.wakeUpIfDozing( SystemClock.uptimeMillis(), Loading @@ -140,13 +124,6 @@ class PulsingGestureListener @Inject constructor( "PULSING_DOUBLE_TAP", PowerManager.WAKE_REASON_TAP) return true } else if (!statusBarStateController.isDozing && doubleTapToSleepEnabled && e.getY() < quickQsOffsetHeight ) { powerManager.goToSleep(e.getEventTime()) return true } } return false } Loading @@ -155,7 +132,6 @@ class PulsingGestureListener @Inject constructor( pw.println("singleTapEnabled=$singleTapEnabled") pw.println("doubleTapEnabled=$doubleTapEnabled") pw.println("doubleTapEnabledNative=$doubleTapEnabledNative") pw.println("doubleTapToSleepEnabled=$doubleTapToSleepEnabled") pw.println("isDocked=${dockManager.isDocked}") pw.println("isProxCovered=${falsingManager.isProximityNear}") } Loading packages/SystemUI/src/com/android/systemui/shade/QQSGestureListener.kt 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shade import android.content.res.Resources import android.os.PowerManager import android.view.GestureDetector import android.view.MotionEvent import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent import com.android.systemui.tuner.TunerService import com.android.systemui.tuner.TunerService.Tunable import lineageos.providers.LineageSettings import javax.inject.Inject @CentralSurfacesComponent.CentralSurfacesScope class QQSGestureListener @Inject constructor( private val falsingManager: FalsingManager, private val powerManager: PowerManager, private val statusBarStateController: StatusBarStateController, tunerService: TunerService, @Main resources: Resources ) : GestureDetector.SimpleOnGestureListener() { companion object { internal val DOUBLE_TAP_SLEEP_GESTURE = "lineagesystem:" + LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE } private var doubleTapToSleepEnabled = false private val quickQsOffsetHeight: Int init { val tunable = Tunable { key: String?, value: String? -> when (key) { DOUBLE_TAP_SLEEP_GESTURE -> doubleTapToSleepEnabled = TunerService.parseIntegerSwitch(value, true) } } tunerService.addTunable(tunable, DOUBLE_TAP_SLEEP_GESTURE) quickQsOffsetHeight = resources.getDimensionPixelSize( com.android.internal.R.dimen.quick_qs_offset_height) } override fun onDoubleTapEvent(e: MotionEvent): Boolean { // Go to sleep on double tap the QQS status bar if (e.actionMasked == MotionEvent.ACTION_UP && !statusBarStateController.isDozing && doubleTapToSleepEnabled && e.getY() < quickQsOffsetHeight && !falsingManager.isFalseDoubleTap ) { powerManager.goToSleep(e.getEventTime()) return true } return false } } services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −2 Original line number Diff line number Diff line Loading @@ -1990,6 +1990,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private void performKeyAction(Action action, KeyEvent event) { // By default, pass INVOCATION_TYPE_UNKNOWN to launch assistant. performKeyAction(action, event, AssistUtils.INVOCATION_TYPE_UNKNOWN); } private void performKeyAction(Action action, KeyEvent event, int assistInvocationType) { switch (action) { case NOTHING: break; Loading @@ -2001,7 +2006,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { break; case SEARCH: launchAssistAction(null, event.getDeviceId(), event.getEventTime(), AssistUtils.INVOCATION_TYPE_UNKNOWN); assistInvocationType); break; case VOICE_SEARCH: launchVoiceAssistWithWakeLock(); Loading Loading @@ -2148,7 +2153,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHomePressed = true; performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false, "Home - Long Press"); performKeyAction(mHomeLongPressAction, event); // If long press home will launch assistant, // it should pass this right invocation type. performKeyAction(mHomeLongPressAction, event, AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); if (mHomeLongPressAction != Action.SLEEP) { mHomeConsumed = true; } Loading Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +15 −2 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ public class NotificationShadeWindowViewController { step.getTransitionState() == TransitionState.RUNNING; }; private GestureDetector mQQSGestureHandler; private final QQSGestureListener mQQSGestureListener; @Inject public NotificationShadeWindowViewController( LockscreenShadeTransitionController transitionController, Loading @@ -135,7 +138,8 @@ public class NotificationShadeWindowViewController { KeyguardBouncerComponent.Factory keyguardBouncerComponentFactory, AlternateBouncerInteractor alternateBouncerInteractor, KeyguardTransitionInteractor keyguardTransitionInteractor, PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel, QQSGestureListener qqsGestureListener ) { mLockscreenShadeTransitionController = transitionController; mFalsingCollector = falsingCollector; Loading @@ -156,6 +160,7 @@ public class NotificationShadeWindowViewController { mPulsingGestureListener = pulsingGestureListener; mNotificationInsetsController = notificationInsetsController; mAlternateBouncerInteractor = alternateBouncerInteractor; mQQSGestureListener = qqsGestureListener; // This view is not part of the newly inflated expanded status bar. mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container); Loading Loading @@ -188,6 +193,8 @@ public class NotificationShadeWindowViewController { mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller); mPulsingWakeupGestureHandler = new GestureDetector(mView.getContext(), mPulsingGestureListener); mQQSGestureHandler = new GestureDetector(mView.getContext(), mQQSGestureListener); mView.setLayoutInsetsController(mNotificationInsetsController); mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() { Loading Loading @@ -239,7 +246,13 @@ public class NotificationShadeWindowViewController { } mFalsingCollector.onTouchEvent(ev); mQQSGestureHandler.onTouchEvent(ev); // Pass touch events to the pulsing gesture listener only if it's dozing, // otherwise lockscreen DT2S and AOD DT2W will conflict. if (mStatusBarStateController.isDozing()) { mPulsingWakeupGestureHandler.onTouchEvent(ev); } if (mStatusBarKeyguardViewManager.onTouch(ev)) { return true; } Loading
packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt +13 −37 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.shade import android.content.Context import android.hardware.display.AmbientDisplayConfiguration import android.os.PowerManager import android.os.SystemClock Loading @@ -34,7 +33,6 @@ import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent import com.android.systemui.tuner.TunerService import com.android.systemui.tuner.TunerService.Tunable import lineageos.providers.LineageSettings; import java.io.PrintWriter import javax.inject.Inject Loading @@ -56,23 +54,14 @@ class PulsingGestureListener @Inject constructor( private val ambientDisplayConfiguration: AmbientDisplayConfiguration, private val statusBarStateController: StatusBarStateController, private val shadeLogger: ShadeLogger, private val powerManager: PowerManager, userTracker: UserTracker, tunerService: TunerService, dumpManager: DumpManager, context: Context dumpManager: DumpManager ) : GestureDetector.SimpleOnGestureListener(), Dumpable { private var doubleTapEnabled = false private var singleTapEnabled = false private var doubleTapEnabledNative = false companion object { internal val DOUBLE_TAP_SLEEP_GESTURE = "lineagesystem:" + LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE } private var doubleTapToSleepEnabled = false private val quickQsOffsetHeight: Int init { val tunable = Tunable { key: String?, value: String? -> when (key) { Loading @@ -84,20 +73,14 @@ class PulsingGestureListener @Inject constructor( Settings.Secure.DOZE_TAP_SCREEN_GESTURE -> singleTapEnabled = ambientDisplayConfiguration.tapGestureEnabled( userTracker.userId) DOUBLE_TAP_SLEEP_GESTURE -> doubleTapToSleepEnabled = TunerService.parseIntegerSwitch(value, true) } } tunerService.addTunable(tunable, Settings.Secure.DOUBLE_TAP_TO_WAKE, Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, Settings.Secure.DOZE_TAP_SCREEN_GESTURE, DOUBLE_TAP_SLEEP_GESTURE) Settings.Secure.DOZE_TAP_SCREEN_GESTURE) dumpManager.registerDumpable(this) quickQsOffsetHeight = context.getResources().getDimensionPixelSize( com.android.internal.R.dimen.quick_qs_offset_height) } override fun onSingleTapUp(e: MotionEvent): Boolean { Loading Loading @@ -129,10 +112,11 @@ class PulsingGestureListener @Inject constructor( override fun onDoubleTapEvent(e: MotionEvent): Boolean { // React to the [MotionEvent.ACTION_UP] event after double tap is detected. Falsing // checks MUST be on the ACTION_UP event. if (e.actionMasked == MotionEvent.ACTION_UP && !falsingManager.isFalseDoubleTap) { if (statusBarStateController.isDozing && if (e.actionMasked == MotionEvent.ACTION_UP && statusBarStateController.isDozing && (doubleTapEnabled || singleTapEnabled || doubleTapEnabledNative) && !falsingManager.isProximityNear !falsingManager.isProximityNear && !falsingManager.isFalseDoubleTap ) { centralSurfaces.wakeUpIfDozing( SystemClock.uptimeMillis(), Loading @@ -140,13 +124,6 @@ class PulsingGestureListener @Inject constructor( "PULSING_DOUBLE_TAP", PowerManager.WAKE_REASON_TAP) return true } else if (!statusBarStateController.isDozing && doubleTapToSleepEnabled && e.getY() < quickQsOffsetHeight ) { powerManager.goToSleep(e.getEventTime()) return true } } return false } Loading @@ -155,7 +132,6 @@ class PulsingGestureListener @Inject constructor( pw.println("singleTapEnabled=$singleTapEnabled") pw.println("doubleTapEnabled=$doubleTapEnabled") pw.println("doubleTapEnabledNative=$doubleTapEnabledNative") pw.println("doubleTapToSleepEnabled=$doubleTapToSleepEnabled") pw.println("isDocked=${dockManager.isDocked}") pw.println("isProxCovered=${falsingManager.isProximityNear}") } Loading
packages/SystemUI/src/com/android/systemui/shade/QQSGestureListener.kt 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shade import android.content.res.Resources import android.os.PowerManager import android.view.GestureDetector import android.view.MotionEvent import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent import com.android.systemui.tuner.TunerService import com.android.systemui.tuner.TunerService.Tunable import lineageos.providers.LineageSettings import javax.inject.Inject @CentralSurfacesComponent.CentralSurfacesScope class QQSGestureListener @Inject constructor( private val falsingManager: FalsingManager, private val powerManager: PowerManager, private val statusBarStateController: StatusBarStateController, tunerService: TunerService, @Main resources: Resources ) : GestureDetector.SimpleOnGestureListener() { companion object { internal val DOUBLE_TAP_SLEEP_GESTURE = "lineagesystem:" + LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE } private var doubleTapToSleepEnabled = false private val quickQsOffsetHeight: Int init { val tunable = Tunable { key: String?, value: String? -> when (key) { DOUBLE_TAP_SLEEP_GESTURE -> doubleTapToSleepEnabled = TunerService.parseIntegerSwitch(value, true) } } tunerService.addTunable(tunable, DOUBLE_TAP_SLEEP_GESTURE) quickQsOffsetHeight = resources.getDimensionPixelSize( com.android.internal.R.dimen.quick_qs_offset_height) } override fun onDoubleTapEvent(e: MotionEvent): Boolean { // Go to sleep on double tap the QQS status bar if (e.actionMasked == MotionEvent.ACTION_UP && !statusBarStateController.isDozing && doubleTapToSleepEnabled && e.getY() < quickQsOffsetHeight && !falsingManager.isFalseDoubleTap ) { powerManager.goToSleep(e.getEventTime()) return true } return false } }
services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −2 Original line number Diff line number Diff line Loading @@ -1990,6 +1990,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private void performKeyAction(Action action, KeyEvent event) { // By default, pass INVOCATION_TYPE_UNKNOWN to launch assistant. performKeyAction(action, event, AssistUtils.INVOCATION_TYPE_UNKNOWN); } private void performKeyAction(Action action, KeyEvent event, int assistInvocationType) { switch (action) { case NOTHING: break; Loading @@ -2001,7 +2006,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { break; case SEARCH: launchAssistAction(null, event.getDeviceId(), event.getEventTime(), AssistUtils.INVOCATION_TYPE_UNKNOWN); assistInvocationType); break; case VOICE_SEARCH: launchVoiceAssistWithWakeLock(); Loading Loading @@ -2148,7 +2153,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHomePressed = true; performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, false, "Home - Long Press"); performKeyAction(mHomeLongPressAction, event); // If long press home will launch assistant, // it should pass this right invocation type. performKeyAction(mHomeLongPressAction, event, AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); if (mHomeLongPressAction != Action.SLEEP) { mHomeConsumed = true; } Loading