summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapper.kt30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt102
2 files changed, 78 insertions, 54 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapper.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapper.kt
index 16bcd43dd877..bd3a71c5ac9b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderWrapper.kt
@@ -15,6 +15,7 @@
*/
package com.android.systemui.statusbar.notification.interruption
+import com.android.app.tracing.traceSection
import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.RefactorFlagUtils
@@ -82,20 +83,33 @@ class NotificationInterruptStateProviderWrapper(
}
override fun makeUnloggedHeadsUpDecision(entry: NotificationEntry): Decision =
- wrapped.checkHeadsUp(entry, /* log= */ false).let { DecisionImpl.of(it) }
+ traceSection("NotificationInterruptStateProviderWrapper#makeUnloggedHeadsUpDecision") {
+ wrapped.checkHeadsUp(entry, /* log= */ false).let { DecisionImpl.of(it) }
+ }
override fun makeAndLogHeadsUpDecision(entry: NotificationEntry): Decision =
- wrapped.checkHeadsUp(entry, /* log= */ true).let { DecisionImpl.of(it) }
+ traceSection("NotificationInterruptStateProviderWrapper#makeAndLogHeadsUpDecision") {
+ wrapped.checkHeadsUp(entry, /* log= */ true).let { DecisionImpl.of(it) }
+ }
override fun makeUnloggedFullScreenIntentDecision(entry: NotificationEntry) =
- wrapped.getFullScreenIntentDecision(entry).let { FullScreenIntentDecisionImpl(entry, it) }
+ traceSection(
+ "NotificationInterruptStateProviderWrapper#makeUnloggedFullScreenIntentDecision"
+ ) {
+ wrapped.getFullScreenIntentDecision(entry).let {
+ FullScreenIntentDecisionImpl(entry, it)
+ }
+ }
- override fun logFullScreenIntentDecision(decision: FullScreenIntentDecision) {
- (decision as FullScreenIntentDecisionImpl).let {
- wrapped.logFullScreenIntentDecision(it.originalEntry, it.originalDecision)
+ override fun logFullScreenIntentDecision(decision: FullScreenIntentDecision) =
+ traceSection("NotificationInterruptStateProviderWrapper#logFullScreenIntentDecision") {
+ (decision as FullScreenIntentDecisionImpl).let {
+ wrapped.logFullScreenIntentDecision(it.originalEntry, it.originalDecision)
+ }
}
- }
override fun makeAndLogBubbleDecision(entry: NotificationEntry): Decision =
- wrapped.shouldBubbleUp(entry).let { DecisionImpl.of(it) }
+ traceSection("NotificationInterruptStateProviderWrapper#makeAndLogBubbleDecision") {
+ wrapped.shouldBubbleUp(entry).let { DecisionImpl.of(it) }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
index 73dd5f6e5fb6..6878a1e9062c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
@@ -19,6 +19,7 @@ import android.hardware.display.AmbientDisplayConfiguration
import android.os.Handler
import android.os.PowerManager
import android.util.Log
+import com.android.app.tracing.traceSection
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.logging.UiEventLogger
import com.android.internal.logging.UiEventLogger.UiEventEnum
@@ -196,27 +197,29 @@ constructor(
filters.remove(filter)
}
- override fun makeUnloggedHeadsUpDecision(entry: NotificationEntry): Decision {
- check(started)
+ override fun makeUnloggedHeadsUpDecision(entry: NotificationEntry): Decision =
+ traceSection("VisualInterruptionDecisionProviderImpl#makeUnloggedHeadsUpDecision") {
+ check(started)
- return if (statusBarStateController.isDozing) {
- makeLoggablePulseDecision(entry)
- } else {
- makeLoggablePeekDecision(entry)
- }
- .decision
- }
+ return if (statusBarStateController.isDozing) {
+ makeLoggablePulseDecision(entry)
+ } else {
+ makeLoggablePeekDecision(entry)
+ }
+ .decision
+ }
- override fun makeAndLogHeadsUpDecision(entry: NotificationEntry): Decision {
- check(started)
+ override fun makeAndLogHeadsUpDecision(entry: NotificationEntry): Decision =
+ traceSection("VisualInterruptionDecisionProviderImpl#makeAndLogHeadsUpDecision") {
+ check(started)
- return if (statusBarStateController.isDozing) {
- makeLoggablePulseDecision(entry).also { logDecision(PULSE, entry, it) }
- } else {
- makeLoggablePeekDecision(entry).also { logDecision(PEEK, entry, it) }
- }
- .decision
- }
+ return if (statusBarStateController.isDozing) {
+ makeLoggablePulseDecision(entry).also { logDecision(PULSE, entry, it) }
+ } else {
+ makeLoggablePeekDecision(entry).also { logDecision(PEEK, entry, it) }
+ }
+ .decision
+ }
private fun makeLoggablePeekDecision(entry: NotificationEntry): LoggableDecision =
checkConditions(PEEK)
@@ -229,11 +232,14 @@ constructor(
?: checkFilters(PULSE, entry) ?: checkSuppressInterruptions(entry)
?: LoggableDecision.unsuppressed
- override fun makeAndLogBubbleDecision(entry: NotificationEntry): Decision {
- check(started)
+ override fun makeAndLogBubbleDecision(entry: NotificationEntry): Decision =
+ traceSection("VisualInterruptionDecisionProviderImpl#makeAndLogBubbleDecision") {
+ check(started)
- return makeLoggableBubbleDecision(entry).also { logDecision(BUBBLE, entry, it) }.decision
- }
+ return makeLoggableBubbleDecision(entry)
+ .also { logDecision(BUBBLE, entry, it) }
+ .decision
+ }
private fun makeLoggableBubbleDecision(entry: NotificationEntry): LoggableDecision =
checkConditions(BUBBLE)
@@ -251,38 +257,42 @@ constructor(
override fun makeUnloggedFullScreenIntentDecision(
entry: NotificationEntry
- ): FullScreenIntentDecision {
- check(started)
+ ): FullScreenIntentDecision =
+ traceSection(
+ "VisualInterruptionDecisionProviderImpl#makeUnloggedFullScreenIntentDecision"
+ ) {
+ check(started)
+
+ val couldHeadsUp = makeUnloggedHeadsUpDecision(entry).shouldInterrupt
+ val fsiDecision =
+ fullScreenIntentDecisionProvider.makeFullScreenIntentDecision(entry, couldHeadsUp)
+ return FullScreenIntentDecisionImpl(entry, fsiDecision)
+ }
- val couldHeadsUp = makeUnloggedHeadsUpDecision(entry).shouldInterrupt
- val fsiDecision =
- fullScreenIntentDecisionProvider.makeFullScreenIntentDecision(entry, couldHeadsUp)
- return FullScreenIntentDecisionImpl(entry, fsiDecision)
- }
+ override fun logFullScreenIntentDecision(decision: FullScreenIntentDecision) =
+ traceSection("VisualInterruptionDecisionProviderImpl#logFullScreenIntentDecision") {
+ check(started)
- override fun logFullScreenIntentDecision(decision: FullScreenIntentDecision) {
- check(started)
+ if (decision !is FullScreenIntentDecisionImpl) {
+ Log.wtf(TAG, "FSI decision $decision was not created by this class")
+ return
+ }
- if (decision !is FullScreenIntentDecisionImpl) {
- Log.wtf(TAG, "FSI decision $decision was not created by this class")
- return
- }
+ if (decision.hasBeenLogged) {
+ Log.wtf(TAG, "FSI decision $decision has already been logged")
+ return
+ }
- if (decision.hasBeenLogged) {
- Log.wtf(TAG, "FSI decision $decision has already been logged")
- return
- }
+ decision.hasBeenLogged = true
- decision.hasBeenLogged = true
+ if (!decision.shouldLog) {
+ return
+ }
- if (!decision.shouldLog) {
- return
+ logger.logFullScreenIntentDecision(decision.entry, decision, decision.isWarning)
+ logEvents(decision.entry, decision)
}
- logger.logFullScreenIntentDecision(decision.entry, decision, decision.isWarning)
- logEvents(decision.entry, decision)
- }
-
private fun logEvents(entry: NotificationEntry, loggable: Loggable) {
loggable.uiEventId?.let { uiEventLogger.log(it, entry.sbn.uid, entry.sbn.packageName) }
loggable.eventLogData?.let {