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

Commit 82042d18 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[Media TTT] Re-name the status bar gesture handler to be more generic.

The next CL will split out the generic swipe-up detection and the
status-bar-specific gesture information, and will add back the class
`SwipeStatusBarAwayGestureHandler`. So, this CL leaves the variable
names to be status-bar-specific.

Bug: 262584940
Test: verify swiping the status bar away when there's an ongoing call
still works
Test: atest OngoingCallControllerTest
Change-Id: Ief581a073ca3809963014405c8233dc13e7e8266

Change-Id: I3da3c306733545df44adfb9518fb4f762f2ace6c
parent 5a7e9e63
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -322,8 +322,8 @@
-packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt
-packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/GenericGestureDetector.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/SwipeStatusBarAwayGestureHandler.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/SwipeStatusBarAwayGestureLogger.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/SwipeUpGestureHandler.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/SwipeUpGestureLogger.kt
-packages/SystemUI/src/com/android/systemui/statusbar/gesture/TapGestureDetector.kt
-packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/ConversationNotifications.kt
+4 −7
Original line number Diff line number Diff line
@@ -191,15 +191,12 @@ public class LogModule {
                false /* systrace */);
    }

    /**
     * Provides a logging buffer for logs related to swiping away the status bar while in immersive
     * mode. See {@link com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureLogger}.
     */
    /** Provides a logging buffer for logs related to swipe up gestures. */
    @Provides
    @SysUISingleton
    @SwipeStatusBarAwayLog
    public static LogBuffer provideSwipeAwayGestureLogBuffer(LogBufferFactory factory) {
        return factory.create("SwipeStatusBarAwayLog", 30);
    @SwipeUpLog
    public static LogBuffer provideSwipeUpLogBuffer(LogBufferFactory factory) {
        return factory.create("SwipeUpLog", 30);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@ import javax.inject.Qualifier;

/**
 * A {@link LogBuffer} for
 * {@link com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureLogger}.
 * {@link com.android.systemui.statusbar.gesture.SwipeUpGestureLogger}.
 */
@Qualifier
@Documented
@Retention(RUNTIME)
public @interface SwipeStatusBarAwayLog {
public @interface SwipeUpLog {
}
+3 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.commandline.CommandRegistry;
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler;
import com.android.systemui.statusbar.gesture.SwipeUpGestureHandler;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.collection.NotifCollection;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
@@ -230,7 +230,7 @@ public interface CentralSurfacesDependenciesModule {
            OngoingCallLogger logger,
            DumpManager dumpManager,
            StatusBarWindowController statusBarWindowController,
            SwipeStatusBarAwayGestureHandler swipeStatusBarAwayGestureHandler,
            SwipeUpGestureHandler swipeStatusBarAwayGestureHandler,
            StatusBarStateController statusBarStateController,
            OngoingCallFlags ongoingCallFlags) {

@@ -239,7 +239,7 @@ public interface CentralSurfacesDependenciesModule {
                ongoingCallInImmersiveEnabled
                        ? Optional.of(statusBarWindowController)
                        : Optional.empty();
        Optional<SwipeStatusBarAwayGestureHandler> gestureHandler =
        Optional<SwipeUpGestureHandler> gestureHandler =
                ongoingCallInImmersiveEnabled
                        ? Optional.of(swipeStatusBarAwayGestureHandler)
                        : Optional.empty();
+6 −6
Original line number Diff line number Diff line
@@ -32,11 +32,11 @@ import javax.inject.Inject
 * gesture is detected, add a callback via [addOnGestureDetectedCallback].
 */
@SysUISingleton
open class SwipeStatusBarAwayGestureHandler @Inject constructor(
open class SwipeUpGestureHandler @Inject constructor(
    context: Context,
    private val statusBarWindowController: StatusBarWindowController,
    private val logger: SwipeStatusBarAwayGestureLogger
) : GenericGestureDetector(SwipeStatusBarAwayGestureHandler::class.simpleName!!) {
    private val logger: SwipeUpGestureLogger
) : GenericGestureDetector(SwipeUpGestureHandler::class.simpleName!!) {

    private var startY: Float = 0f
    private var startTime: Long = 0L
@@ -72,11 +72,11 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
                }
                if (
                    // Gesture is up
                    ev.y < startY
                    ev.y < startY &&
                    // Gesture went far enough
                    && (startY - ev.y) >= swipeDistanceThreshold
                    (startY - ev.y) >= swipeDistanceThreshold &&
                    // Gesture completed quickly enough
                    && (ev.eventTime - startTime) < SWIPE_TIMEOUT_MS
                    (ev.eventTime - startTime) < SWIPE_TIMEOUT_MS
                ) {
                    monitoringCurrentTouch = false
                    logger.logGestureDetected(ev.y.toInt())
Loading