[Ongoing Call] Use a LogBuffer for the SwipeStatusBarAwayGestureHandler.
Test: manually dumping log Bug: 195839150 Change-Id: I5b4f13f7aa4544199c1c740d8a326a10cc73c2a4
This commit is contained in:
@@ -111,6 +111,17 @@ public class LogModule {
|
||||
return factory.create("CollapsedSbFragmentLog", 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@SysUISingleton
|
||||
@SwipeStatusBarAwayLog
|
||||
public static LogBuffer provideSwipeAwayGestureLogBuffer(LogBufferFactory factory) {
|
||||
return factory.create("SwipeStatusBarAwayLog", 30);
|
||||
}
|
||||
|
||||
/** Allows logging buffers to be tweaked via adb on debug builds but not on prod builds. */
|
||||
@Provides
|
||||
@SysUISingleton
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source 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.log.dagger;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.android.systemui.log.LogBuffer;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
|
||||
/**
|
||||
* A {@link LogBuffer} for
|
||||
* {@link com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureLogger}.
|
||||
*/
|
||||
@Qualifier
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
public @interface SwipeStatusBarAwayLog {
|
||||
}
|
||||
@@ -47,6 +47,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.notification.AssistantFeedbackController;
|
||||
import com.android.systemui.statusbar.notification.DynamicChildBindController;
|
||||
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
|
||||
@@ -69,7 +70,6 @@ import com.android.systemui.statusbar.phone.StatusBarWindowController;
|
||||
import com.android.systemui.statusbar.phone.SystemUIHostDialogProvider;
|
||||
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
|
||||
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallLogger;
|
||||
import com.android.systemui.statusbar.phone.ongoingcall.SwipeStatusBarAwayGestureHandler;
|
||||
import com.android.systemui.statusbar.policy.RemoteInputUriController;
|
||||
import com.android.systemui.tracing.ProtoTracer;
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.phone.ongoingcall
|
||||
package com.android.systemui.statusbar.gesture
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.Choreographer
|
||||
import android.view.Display
|
||||
import android.view.InputEvent
|
||||
@@ -38,6 +37,7 @@ import javax.inject.Inject
|
||||
open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
context: Context,
|
||||
private val statusBarWindowController: StatusBarWindowController,
|
||||
private val logger: SwipeStatusBarAwayGestureLogger
|
||||
) {
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
ev.y >= statusBarWindowController.statusBarHeight
|
||||
&& ev.y <= 3 * statusBarWindowController.statusBarHeight
|
||||
) {
|
||||
Log.d(TAG, "Beginning gesture detection, y=${ev.y}")
|
||||
logger.logGestureDetectionStarted(ev.y.toInt())
|
||||
startY = ev.y
|
||||
startTime = ev.eventTime
|
||||
monitoringCurrentTouch = true
|
||||
@@ -109,12 +109,15 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
// Gesture completed quickly enough
|
||||
&& (ev.eventTime - startTime) < SWIPE_TIMEOUT_MS
|
||||
) {
|
||||
Log.i(TAG, "Gesture detected; notifying callbacks")
|
||||
callbacks.values.forEach { it.invoke() }
|
||||
monitoringCurrentTouch = false
|
||||
logger.logGestureDetected(ev.y.toInt())
|
||||
callbacks.values.forEach { it.invoke() }
|
||||
}
|
||||
}
|
||||
ACTION_CANCEL, ACTION_UP -> {
|
||||
if (monitoringCurrentTouch) {
|
||||
logger.logGestureDetectionEndedWithoutTriggering(ev.y.toInt())
|
||||
}
|
||||
monitoringCurrentTouch = false
|
||||
}
|
||||
}
|
||||
@@ -124,7 +127,7 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
private fun startGestureListening() {
|
||||
stopGestureListening()
|
||||
|
||||
if (DEBUG) { Log.d(TAG, "Input listening started") }
|
||||
logger.logInputListeningStarted()
|
||||
inputMonitor = InputMonitorCompat(TAG, Display.DEFAULT_DISPLAY).also {
|
||||
inputReceiver = it.getInputReceiver(
|
||||
Looper.getMainLooper(),
|
||||
@@ -137,7 +140,7 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
/** Stop listening for the swipe gesture. */
|
||||
private fun stopGestureListening() {
|
||||
inputMonitor?.let {
|
||||
if (DEBUG) { Log.d(TAG, "Input listening stopped") }
|
||||
logger.logInputListeningStopped()
|
||||
inputMonitor = null
|
||||
it.dispose()
|
||||
}
|
||||
@@ -150,4 +153,3 @@ open class SwipeStatusBarAwayGestureHandler @Inject constructor(
|
||||
|
||||
private const val SWIPE_TIMEOUT_MS: Long = 500
|
||||
private val TAG = SwipeStatusBarAwayGestureHandler::class.simpleName
|
||||
private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source 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.statusbar.gesture
|
||||
|
||||
import com.android.systemui.log.LogBuffer
|
||||
import com.android.systemui.log.LogLevel
|
||||
import com.android.systemui.log.dagger.SwipeStatusBarAwayLog
|
||||
import javax.inject.Inject
|
||||
|
||||
/** Log messages for [SwipeStatusBarAwayGestureHandler]. */
|
||||
class SwipeStatusBarAwayGestureLogger @Inject constructor(
|
||||
@SwipeStatusBarAwayLog private val buffer: LogBuffer
|
||||
) {
|
||||
fun logGestureDetectionStarted(y: Int) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
LogLevel.DEBUG,
|
||||
{ int1 = y },
|
||||
{ "Beginning gesture detection. y=$int1" }
|
||||
)
|
||||
}
|
||||
|
||||
fun logGestureDetectionEndedWithoutTriggering(y: Int) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
LogLevel.DEBUG,
|
||||
{ int1 = y },
|
||||
{ "Gesture finished; no swipe up gesture detected. Final y=$int1" }
|
||||
)
|
||||
}
|
||||
|
||||
fun logGestureDetected(y: Int) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
LogLevel.INFO,
|
||||
{ int1 = y },
|
||||
{ "Gesture detected; notifying callbacks. y=$int1" }
|
||||
)
|
||||
}
|
||||
|
||||
fun logInputListeningStarted() {
|
||||
buffer.log(TAG, LogLevel.VERBOSE, {}, { "Input listening started "})
|
||||
}
|
||||
|
||||
fun logInputListeningStopped() {
|
||||
buffer.log(TAG, LogLevel.VERBOSE, {}, { "Input listening stopped "})
|
||||
}
|
||||
}
|
||||
|
||||
private const val TAG = "SwipeStatusBarAwayGestureHandler"
|
||||
@@ -35,6 +35,7 @@ import com.android.systemui.dump.DumpManager
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
|
||||
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.android.systemui.dump.DumpManager
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder
|
||||
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
|
||||
|
||||
Reference in New Issue
Block a user