Merge "Add logs to NotificationWakeUpCoordinator for bugreports" into tm-qpr-dev
This commit is contained in:
@@ -38,6 +38,7 @@ import java.io.PrintWriter
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.min
|
||||
|
||||
|
||||
@SysUISingleton
|
||||
class NotificationWakeUpCoordinator @Inject constructor(
|
||||
dumpManager: DumpManager,
|
||||
@@ -45,7 +46,8 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
||||
private val statusBarStateController: StatusBarStateController,
|
||||
private val bypassController: KeyguardBypassController,
|
||||
private val dozeParameters: DozeParameters,
|
||||
private val screenOffAnimationController: ScreenOffAnimationController
|
||||
private val screenOffAnimationController: ScreenOffAnimationController,
|
||||
private val logger: NotificationWakeUpCoordinatorLogger,
|
||||
) : OnHeadsUpChangedListener, StatusBarStateController.StateListener, ShadeExpansionListener,
|
||||
Dumpable {
|
||||
|
||||
@@ -242,6 +244,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
||||
logger.logOnDozeAmountChanged(linear, eased)
|
||||
if (overrideDozeAmountIfAnimatingScreenOff(linear)) {
|
||||
return
|
||||
}
|
||||
@@ -273,6 +276,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onStateChanged(newState: Int) {
|
||||
logger.logOnStateChanged(newState)
|
||||
if (state == StatusBarState.SHADE && newState == StatusBarState.SHADE) {
|
||||
// The SHADE -> SHADE transition is only possible as part of cancelling the screen-off
|
||||
// animation (e.g. by fingerprint unlock). This is done because the system is in an
|
||||
@@ -320,8 +324,12 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
||||
private fun overrideDozeAmountIfBypass(): Boolean {
|
||||
if (bypassController.bypassEnabled) {
|
||||
if (statusBarStateController.state == StatusBarState.KEYGUARD) {
|
||||
logger.logSetDozeAmount("1.0", "1.0",
|
||||
"Override: bypass (keyguard)", StatusBarState.KEYGUARD)
|
||||
setDozeAmount(1f, 1f, source = "Override: bypass (keyguard)")
|
||||
} else {
|
||||
logger.logSetDozeAmount("0.0", "0.0",
|
||||
"Override: bypass (shade)", statusBarStateController.state)
|
||||
setDozeAmount(0f, 0f, source = "Override: bypass (shade)")
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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.notification
|
||||
|
||||
import com.android.systemui.log.dagger.NotificationLog
|
||||
import com.android.systemui.plugins.log.LogBuffer
|
||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||
import javax.inject.Inject
|
||||
|
||||
class NotificationWakeUpCoordinatorLogger
|
||||
@Inject
|
||||
constructor(@NotificationLog private val buffer: LogBuffer) {
|
||||
fun logSetDozeAmount(linear: String, eased: String, source: String, state: Int) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
DEBUG,
|
||||
{
|
||||
str1 = linear
|
||||
str2 = eased
|
||||
str3 = source
|
||||
int1 = state
|
||||
},
|
||||
{ "setDozeAmount: linear: $str1, eased: $str2, source: $str3, state: $int1" }
|
||||
)
|
||||
}
|
||||
|
||||
fun logOnDozeAmountChanged(linear: Float, eased: Float) {
|
||||
buffer.log(
|
||||
TAG,
|
||||
DEBUG,
|
||||
{
|
||||
double1 = linear.toDouble()
|
||||
str2 = eased.toString()
|
||||
},
|
||||
{ "onDozeAmountChanged($double1, $str2)" }
|
||||
)
|
||||
}
|
||||
|
||||
fun logOnStateChanged(newState: Int) {
|
||||
buffer.log(TAG, DEBUG, { int1 = newState }, { "onStateChanged($int1)" })
|
||||
}
|
||||
}
|
||||
|
||||
private const val TAG = "NotificationWakeUpCoordinator"
|
||||
@@ -131,6 +131,7 @@ import com.android.systemui.statusbar.VibratorHelper;
|
||||
import com.android.systemui.statusbar.notification.ConversationNotificationManager;
|
||||
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
|
||||
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
|
||||
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinatorLogger;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
@@ -383,7 +384,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
mInteractionJankMonitor, mShadeExpansionStateManager),
|
||||
mKeyguardBypassController,
|
||||
mDozeParameters,
|
||||
mScreenOffAnimationController);
|
||||
mScreenOffAnimationController,
|
||||
mock(NotificationWakeUpCoordinatorLogger.class));
|
||||
mConfigurationController = new ConfigurationControllerImpl(mContext);
|
||||
PulseExpansionHandler expansionHandler = new PulseExpansionHandler(
|
||||
mContext,
|
||||
|
||||
Reference in New Issue
Block a user