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

Commit fd8b0fff authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Add logs to help investigate b/288507023

Bug: 288507023
Test: Manual, checked the logs while opening notifications
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f78f0c02fdedce6f73a5d3f5f4993940a9554852)
Merged-In: Ief31f7d3075eb1b9dc384cefdaeef371cfdf6691
Change-Id: Ief31f7d3075eb1b9dc384cefdaeef371cfdf6691
parent 6585b8a8
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -240,8 +240,15 @@ class ActivityLaunchAnimator(

    private fun Controller.callOnIntentStartedOnMainThread(willAnimate: Boolean) {
        if (Looper.myLooper() != Looper.getMainLooper()) {
            this.launchContainer.context.mainExecutor.execute { this.onIntentStarted(willAnimate) }
            this.launchContainer.context.mainExecutor.execute {
                callOnIntentStartedOnMainThread(willAnimate)
            }
        } else {
            // TODO(b/288507023): Remove this log.
            Log.d(
                TAG,
                "Calling controller.onIntentStarted(willAnimate=$willAnimate) [controller=$this]"
            )
            this.onIntentStarted(willAnimate)
        }
    }
@@ -542,6 +549,9 @@ class ActivityLaunchAnimator(
                Log.i(TAG, "Aborting the animation as no window is opening")
                removeTimeout()
                iCallback?.invoke()

                // TODO(b/288507023): Remove this log.
                Log.d(TAG, "Calling controller.onLaunchAnimationCancelled() [no window opening]")
                controller.onLaunchAnimationCancelled()
                return
            }
@@ -759,6 +769,9 @@ class ActivityLaunchAnimator(

            Log.i(TAG, "Remote animation timed out")
            timedOut = true

            // TODO(b/288507023): Remove this log.
            Log.d(TAG, "Calling controller.onLaunchAnimationCancelled() [animation timed out]")
            controller.onLaunchAnimationCancelled()
        }

@@ -773,6 +786,12 @@ class ActivityLaunchAnimator(
            removeTimeout()

            animation?.cancel()

            // TODO(b/288507023): Remove this log.
            Log.d(
                TAG,
                "Calling controller.onLaunchAnimationCancelled() [remote animation cancelled]",
            )
            controller.onLaunchAnimationCancelled()
        }

+0 −1
Original line number Diff line number Diff line
@@ -303,7 +303,6 @@
-packages/SystemUI/src/com/android/systemui/statusbar/notification/LaunchAnimationParameters.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClickerLogger.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationSectionsFeatureManager.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.kt
-packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
+2 −0
Original line number Diff line number Diff line
@@ -545,6 +545,8 @@ public class NotificationShadeWindowViewController {
    @VisibleForTesting
    void setExpandAnimationRunning(boolean running) {
        if (mExpandAnimationRunning != running) {
            // TODO(b/288507023): Remove this log.
            Log.d(TAG, "Setting mExpandAnimationRunning=" + running);
            if (running) {
                mLaunchAnimationTimeout = mClock.uptimeMillis() + 5000;
            }
+35 −21
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.notification

import android.util.Log
import android.view.ViewGroup
import com.android.internal.jank.InteractionJankMonitor
import com.android.systemui.animation.ActivityLaunchAnimator
@@ -30,6 +31,8 @@ import javax.inject.Inject
import kotlin.math.ceil
import kotlin.math.max

private const val TAG = "NotificationLaunchAnimatorController"

/** A provider of [NotificationLaunchAnimatorController]. */
@CentralSurfacesComponent.CentralSurfacesScope
class NotificationLaunchAnimatorControllerProvider @Inject constructor(
@@ -89,16 +92,19 @@ class NotificationLaunchAnimatorController(
        val clipStartLocation = notificationListContainer.topClippingStartLocation
        val roundedTopClipping = (clipStartLocation - location[1]).coerceAtLeast(0)
        val windowTop = location[1] + roundedTopClipping
        val topCornerRadius = if (roundedTopClipping > 0) {
        val topCornerRadius =
            if (roundedTopClipping > 0) {
                // Because the rounded Rect clipping is complex, we start the top rounding at
                // 0, which is pretty close to matching the real clipping.
            // We'd have to clipOut the overlaid drawable too with the outer rounded rect in case
                // We'd have to clipOut the overlaid drawable too with the outer rounded rect in
                // case
                // if we'd like to have this perfect, but this is close enough.
                0f
            } else {
                notification.topCornerRadius
            }
        val params = LaunchAnimationParameters(
        val params =
            LaunchAnimationParameters(
                top = windowTop,
                bottom = location[1] + height,
                left = location[0],
@@ -109,8 +115,10 @@ class NotificationLaunchAnimatorController(

        params.startTranslationZ = notification.translationZ
        params.startNotificationTop = location[1]
        params.notificationParentTop = notificationListContainer
                .getViewParentForNotification(notificationEntry).locationOnScreen[1]
        params.notificationParentTop =
            notificationListContainer
                .getViewParentForNotification(notificationEntry)
                .locationOnScreen[1]
        params.startRoundedTopClipping = roundedTopClipping
        params.startClipTopAmount = notification.clipTopAmount
        if (notification.isChildInGroup) {
@@ -135,6 +143,8 @@ class NotificationLaunchAnimatorController(
    }

    override fun onIntentStarted(willAnimate: Boolean) {
        // TODO(b/288507023): Remove this log.
        Log.d(TAG, "onIntentStarted(willAnimate=$willAnimate)")
        notificationExpansionRepository.setIsExpandAnimationRunning(willAnimate)
        notificationEntry.isExpandAnimationRunning = willAnimate

@@ -165,6 +175,9 @@ class NotificationLaunchAnimatorController(
    }

    override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
        // TODO(b/288507023): Remove this log.
        Log.d(TAG, "onLaunchAnimationCancelled()")

        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // here?
        notificationExpansionRepository.setIsExpandAnimationRunning(false)
@@ -177,11 +190,12 @@ class NotificationLaunchAnimatorController(
        notification.isExpandAnimationRunning = true
        notificationListContainer.setExpandingNotification(notification)

        jankMonitor.begin(notification,
            InteractionJankMonitor.CUJ_NOTIFICATION_APP_START)
        jankMonitor.begin(notification, InteractionJankMonitor.CUJ_NOTIFICATION_APP_START)
    }

    override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
        // TODO(b/288507023): Remove this log.
        Log.d(TAG, "onLaunchAnimationEnd()")
        jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START)

        notification.isExpandAnimationRunning = false
+5 −0
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package com.android.systemui.statusbar.notification.data.repository

import android.util.Log
import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

private const val TAG = "NotificationExpansionRepository"

/** A repository tracking the status of notification expansion animations. */
@SysUISingleton
class NotificationExpansionRepository @Inject constructor() {
@@ -37,6 +40,8 @@ class NotificationExpansionRepository @Inject constructor() {

    /** Sets whether the notification expansion animation is currently running. */
    fun setIsExpandAnimationRunning(running: Boolean) {
        // TODO(b/288507023): Remove this log.
        Log.d(TAG, "setIsExpandAnimationRunning(running=$running)")
        _isExpandAnimationRunning.value = running
    }
}