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

Commit c29fbf31 authored by Yining Liu's avatar Yining Liu Committed by Automerger Merge Worker
Browse files

Merge "Add logs to NotificationWakeUpCoordinator for bugreports" into tm-qpr-dev am: 6aeb8d9a

parents 48c7b20a 6aeb8d9a
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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
+55 −0
Original line number Diff line number Diff line
/*
 * 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"
+3 −1
Original line number Diff line number Diff line
@@ -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,