Merge changes I95fd75ac,I56977a66 into main
* changes:
Re-format files
Log reasons of HeadsUpManager#removeNotification
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
index 9005ae3..89aa670 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
@@ -241,7 +241,7 @@
alm.showNotification(entry);
final boolean removedImmediately = alm.removeNotification(
- entry.getKey(), /* releaseImmediately = */ false);
+ entry.getKey(), /* releaseImmediately = */ false, "removeDeferred");
assertFalse(removedImmediately);
assertTrue(alm.isHeadsUpEntry(entry.getKey()));
}
@@ -254,7 +254,7 @@
alm.showNotification(entry);
final boolean removedImmediately = alm.removeNotification(
- entry.getKey(), /* releaseImmediately = */ true);
+ entry.getKey(), /* releaseImmediately = */ true, "forceRemove");
assertTrue(removedImmediately);
assertFalse(alm.isHeadsUpEntry(entry.getKey()));
}
@@ -430,7 +430,7 @@
hum.showNotification(entry);
final boolean removedImmediately = hum.removeNotification(
- entry.getKey(), /* releaseImmediately = */ false);
+ entry.getKey(), /* releaseImmediately = */ false, "beforeMinimumDisplayTime");
assertFalse(removedImmediately);
assertTrue(hum.isHeadsUpEntry(entry.getKey()));
@@ -452,7 +452,7 @@
assertTrue(hum.isHeadsUpEntry(entry.getKey()));
final boolean removedImmediately = hum.removeNotification(
- entry.getKey(), /* releaseImmediately = */ false);
+ entry.getKey(), /* releaseImmediately = */ false, "afterMinimumDisplayTime");
assertTrue(removedImmediately);
assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -466,7 +466,7 @@
hum.showNotification(entry);
final boolean removedImmediately = hum.removeNotification(
- entry.getKey(), /* releaseImmediately = */ true);
+ entry.getKey(), /* releaseImmediately = */ true, "afterMinimumDisplayTime");
assertTrue(removedImmediately);
assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
index 7a6838a..ca106fa 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
@@ -179,8 +179,8 @@
mContext
.getOrCreateTestableResources()
.addOverride(R.integer.ambient_notification_extension_time, 500)
- mAvalancheController = AvalancheController(dumpManager, mUiEventLogger,
- mHeadsUpManagerLogger, mBgHandler)
+ mAvalancheController =
+ AvalancheController(dumpManager, mUiEventLogger, mHeadsUpManagerLogger, mBgHandler)
}
@Test
@@ -200,7 +200,12 @@
hmp.addSwipedOutNotification(entry.key)
// Remove should succeed because the notification is swiped out
- val removedImmediately = hmp.removeNotification(entry.key, /* releaseImmediately= */ false)
+ val removedImmediately =
+ hmp.removeNotification(
+ entry.key,
+ /* releaseImmediately= */ false,
+ /* reason= */ "swipe out"
+ )
Assert.assertTrue(removedImmediately)
Assert.assertFalse(hmp.isHeadsUpEntry(entry.key))
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/TestableHeadsUpManager.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/TestableHeadsUpManager.java
index 69207ba..3efabd7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/TestableHeadsUpManager.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/TestableHeadsUpManager.java
@@ -100,7 +100,7 @@
@Override
public boolean removeNotification(@NonNull String key, boolean releaseImmediately,
- boolean animate) {
+ boolean animate, @NonNull String reason) {
throw new UnsupportedOperationException();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt
index 2b7df7d..67c53d46 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt
@@ -142,14 +142,15 @@
}
override fun onIntentStarted(willAnimate: Boolean) {
+ val reason = "onIntentStarted(willAnimate=$willAnimate)"
if (ActivityTransitionAnimator.DEBUG_TRANSITION_ANIMATION) {
- Log.d(TAG, "onIntentStarted(willAnimate=$willAnimate)")
+ Log.d(TAG, reason)
}
notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(willAnimate)
notificationEntry.isExpandAnimationRunning = willAnimate
if (!willAnimate) {
- removeHun(animate = true)
+ removeHun(animate = true, reason)
onFinishAnimationCallback?.run()
}
}
@@ -166,13 +167,18 @@
}
}
- private fun removeHun(animate: Boolean) {
+ private fun removeHun(animate: Boolean, reason: String) {
val row = headsUpNotificationRow ?: return
// TODO: b/297247841 - Call on the row we're removing, which may differ from notification.
HeadsUpUtil.setNeedsHeadsUpDisappearAnimationAfterClick(notification, animate)
- headsUpManager.removeNotification(row.entry.key, true /* releaseImmediately */, animate)
+ headsUpManager.removeNotification(
+ row.entry.key,
+ true /* releaseImmediately */,
+ animate,
+ reason
+ )
}
override fun onTransitionAnimationCancelled(newKeyguardOccludedState: Boolean?) {
@@ -184,7 +190,7 @@
// here?
notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
notificationEntry.isExpandAnimationRunning = false
- removeHun(animate = true)
+ removeHun(animate = true, "onLaunchAnimationCancelled()")
onFinishAnimationCallback?.run()
}
@@ -206,7 +212,7 @@
notificationEntry.isExpandAnimationRunning = false
notificationListContainer.setExpandingNotification(null)
applyParams(null)
- removeHun(animate = false)
+ removeHun(animate = false, "onLaunchAnimationEnd()")
onFinishAnimationCallback?.run()
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
index e50d64b..ec8566b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
@@ -496,7 +496,11 @@
if (posted?.shouldHeadsUpEver == false) {
if (posted.isHeadsUpEntry) {
// We don't want this to be interrupting anymore, let's remove it
- mHeadsUpManager.removeNotification(posted.key, false /*removeImmediately*/)
+ mHeadsUpManager.removeNotification(
+ posted.key,
+ /* removeImmediately= */ false,
+ "onEntryUpdated"
+ )
} else if (posted.isBinding) {
// Don't let the bind finish
cancelHeadsUpBind(posted.entry)
@@ -520,7 +524,11 @@
val removeImmediatelyForRemoteInput =
(mRemoteInputManager.isSpinning(entryKey) &&
!NotificationRemoteInputManager.FORCE_REMOTE_INPUT_HISTORY)
- mHeadsUpManager.removeNotification(entry.key, removeImmediatelyForRemoteInput)
+ mHeadsUpManager.removeNotification(
+ entry.key,
+ removeImmediatelyForRemoteInput,
+ "onEntryRemoved, reason: $reason"
+ )
}
}
@@ -721,7 +729,9 @@
{
mHeadsUpManager.removeNotification(
entry.key, /* releaseImmediately */
- true
+ true,
+ "cancel lifetime extension - extended for reason: " +
+ "$reason, isSticky: true"
)
},
removeAfterMillis
@@ -730,7 +740,9 @@
mExecutor.execute {
mHeadsUpManager.removeNotification(
entry.key, /* releaseImmediately */
- false
+ false,
+ "lifetime extension - extended for reason: $reason" +
+ ", isSticky: false"
)
}
mNotifsExtendingLifetime[entry] = null
@@ -902,7 +914,7 @@
fun commitModifications() {
deferred.forEach { (key, releaseImmediately) ->
- headsUpManager.removeNotification(key, releaseImmediately)
+ headsUpManager.removeNotification(key, releaseImmediately, "commitModifications")
}
deferred.clear()
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 41195aa..fa12bb9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -638,8 +638,11 @@
if (row.isPinned() && !canChildBeDismissed(row)
&& row.getEntry().getSbn().getNotification().fullScreenIntent
== null) {
- mHeadsUpManager.removeNotification(row.getEntry().getSbn().getKey(),
- true /* removeImmediately */);
+ mHeadsUpManager.removeNotification(
+ row.getEntry().getSbn().getKey(),
+ /* removeImmediately= */ true ,
+ /* reason= */ "onChildSnappedBack"
+ );
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
index ac10155..ec92990 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -193,7 +193,11 @@
void fireNotificationPulse(NotificationEntry entry) {
Runnable pulseSuppressedListener = () -> {
mHeadsUpManager.removeNotification(
- entry.getKey(), /* releaseImmediately= */ true, /* animate= */ false);
+ entry.getKey(),
+ /* releaseImmediately= */ true,
+ /* animate= */ false,
+ "fireNotificationPulse"
+ );
};
Assert.isMainThread();
for (Callback callback : mCallbacks) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 25d9cc7..544a8a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -60,11 +60,6 @@
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;
-import kotlinx.coroutines.flow.Flow;
-import kotlinx.coroutines.flow.MutableStateFlow;
-import kotlinx.coroutines.flow.StateFlow;
-import kotlinx.coroutines.flow.StateFlowKt;
-
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -75,6 +70,11 @@
import javax.inject.Inject;
+import kotlinx.coroutines.flow.Flow;
+import kotlinx.coroutines.flow.MutableStateFlow;
+import kotlinx.coroutines.flow.StateFlow;
+import kotlinx.coroutines.flow.StateFlowKt;
+
/** A implementation of HeadsUpManager for phone. */
@SysUISingleton
public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
@@ -365,12 +365,14 @@
@Override
public boolean removeNotification(@NonNull String key, boolean releaseImmediately,
- boolean animate) {
+ boolean animate, @NonNull String reason) {
if (animate) {
- return removeNotification(key, releaseImmediately);
+ return removeNotification(key, releaseImmediately,
+ "removeNotification(animate: true), reason: " + reason);
} else {
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false);
- boolean removed = removeNotification(key, releaseImmediately);
+ final boolean removed = removeNotification(key, releaseImmediately,
+ "removeNotification(animate: false), reason: " + reason);
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(true);
return removed;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index e92058b..0a6e7f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -230,7 +230,8 @@
Runnable action = () -> {
mBubblesManagerOptional.ifPresent(bubblesManager ->
bubblesManager.onUserChangedBubble(entry, !entry.isBubble()));
- mHeadsUpManager.removeNotification(entry.getKey(), /* releaseImmediately= */ true);
+ mHeadsUpManager.removeNotification(entry.getKey(), /* releaseImmediately= */ true,
+ /* reason= */ "onNotificationBubbleIconClicked");
};
if (entry.isBubble()) {
// entry is being un-bubbled, no need to unlock
@@ -621,7 +622,8 @@
// In most cases, when FLAG_AUTO_CANCEL is set, the notification will
// become canceled shortly by NoMan, but we can't assume that.
- mHeadsUpManager.removeNotification(key, true /* releaseImmediately */);
+ mHeadsUpManager.removeNotification(key, /* releaseImmediately= */ true,
+ "removeHunAfterClick");
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
index 3786958..f37393a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
@@ -40,13 +40,14 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun;
-import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor;
import com.android.systemui.statusbar.phone.ExpandHeadsUpOnInlineReply;
import com.android.systemui.util.ListenerSet;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;
+import org.jetbrains.annotations.NotNull;
+
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -191,12 +192,14 @@
* enough and needs to be kept around.
* @param key the key of the notification to remove
* @param releaseImmediately force a remove regardless of earliest removal time
+ * @param reason reason for removing the notification
* @return true if notification is removed, false otherwise
*/
@Override
- public boolean removeNotification(@NonNull String key, boolean releaseImmediately) {
+ public boolean removeNotification(@NotNull String key, boolean releaseImmediately,
+ @NonNull String reason) {
final boolean isWaiting = mAvalancheController.isWaiting(key);
- mLogger.logRemoveNotification(key, releaseImmediately, isWaiting);
+ mLogger.logRemoveNotification(key, releaseImmediately, isWaiting, reason);
if (mAvalancheController.isWaiting(key)) {
removeEntry(key, "removeNotification (isWaiting)");
@@ -204,6 +207,7 @@
}
HeadsUpEntry headsUpEntry = mHeadsUpEntryMap.get(key);
if (headsUpEntry == null) {
+ mLogger.logNullEntry(key, reason);
return true;
}
if (releaseImmediately) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
index fcf77d5..04fe6b3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
@@ -96,9 +96,10 @@
*
* @param key the key of the notification to remove
* @param releaseImmediately force a remove regardless of earliest removal time
+ * @param reason reason for removing the notification
* @return true if notification is removed, false otherwise
*/
- fun removeNotification(key: String, releaseImmediately: Boolean): Boolean
+ fun removeNotification(key: String, releaseImmediately: Boolean, reason: String): Boolean
/**
* Try to remove the notification. May not succeed if the notification has not been shown long
@@ -107,9 +108,15 @@
* @param key the key of the notification to remove
* @param releaseImmediately force a remove regardless of earliest removal time
* @param animate if true, animate the removal
+ * @param reason reason for removing the notification
* @return true if notification is removed, false otherwise
*/
- fun removeNotification(key: String, releaseImmediately: Boolean, animate: Boolean): Boolean
+ fun removeNotification(
+ key: String,
+ releaseImmediately: Boolean,
+ animate: Boolean,
+ reason: String
+ ): Boolean
/** Clears all managed notifications. */
fun releaseAllImmediately()
@@ -246,11 +253,16 @@
override fun removeListener(listener: OnHeadsUpChangedListener) {}
- override fun removeNotification(key: String, releaseImmediately: Boolean) = false
-
- override fun removeNotification(key: String, releaseImmediately: Boolean, animate: Boolean) =
+ override fun removeNotification(key: String, releaseImmediately: Boolean, reason: String) =
false
+ override fun removeNotification(
+ key: String,
+ releaseImmediately: Boolean,
+ animate: Boolean,
+ reason: String
+ ) = false
+
override fun setAnimationStateHandler(handler: AnimationStateHandler) {}
override fun setExpanded(entry: NotificationEntry, expanded: Boolean) {}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt
index 80c595f..c6fc547 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt
@@ -16,244 +16,283 @@
package com.android.systemui.statusbar.policy
-import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel.INFO
import com.android.systemui.log.core.LogLevel.VERBOSE
+import com.android.systemui.log.dagger.NotificationHeadsUpLog
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import javax.inject.Inject
/** Logger for [HeadsUpManager]. */
-class HeadsUpManagerLogger @Inject constructor(
- @NotificationHeadsUpLog private val buffer: LogBuffer
-) {
+class HeadsUpManagerLogger
+@Inject
+constructor(@NotificationHeadsUpLog private val buffer: LogBuffer) {
fun logPackageSnoozed(snoozeKey: String) {
- buffer.log(TAG, INFO, {
- str1 = snoozeKey
- }, {
- "package snoozed $str1"
- })
+ buffer.log(TAG, INFO, { str1 = snoozeKey }, { "package snoozed $str1" })
}
fun logPackageUnsnoozed(snoozeKey: String) {
- buffer.log(TAG, INFO, {
- str1 = snoozeKey
- }, {
- "package unsnoozed $str1"
- })
+ buffer.log(TAG, INFO, { str1 = snoozeKey }, { "package unsnoozed $str1" })
}
fun logIsSnoozedReturned(snoozeKey: String) {
- buffer.log(TAG, INFO, {
- str1 = snoozeKey
- }, {
- "package snoozed when queried $str1"
- })
+ buffer.log(TAG, INFO, { str1 = snoozeKey }, { "package snoozed when queried $str1" })
}
fun logReleaseAllImmediately() {
- buffer.log(TAG, INFO, { }, {
- "release all immediately"
- })
+ buffer.log(TAG, INFO, {}, { "release all immediately" })
}
fun logShowNotificationRequest(entry: NotificationEntry) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- }, {
- "request: show notification $str1"
- })
+ buffer.log(TAG, INFO, { str1 = entry.logKey }, { "request: show notification $str1" })
}
- fun logAvalancheUpdate(caller: String, isEnabled: Boolean, notifEntryKey: String,
- outcome: String) {
- buffer.log(TAG, INFO, {
- str1 = caller
- str2 = notifEntryKey
- str3 = outcome
- bool1 = isEnabled
- }, {
- "$str1\n\t=> AC[isEnabled:$bool1] update: $str2\n\t=> $str3"
- })
+ fun logAvalancheUpdate(
+ caller: String,
+ isEnabled: Boolean,
+ notifEntryKey: String,
+ outcome: String
+ ) {
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = caller
+ str2 = notifEntryKey
+ str3 = outcome
+ bool1 = isEnabled
+ },
+ { "$str1\n\t=> AC[isEnabled:$bool1] update: $str2\n\t=> $str3" }
+ )
}
- fun logAvalancheDelete(caller: String, isEnabled: Boolean, notifEntryKey: String,
- outcome: String) {
- buffer.log(TAG, INFO, {
- str1 = caller
- str2 = notifEntryKey
- str3 = outcome
- bool1 = isEnabled
- }, {
- "$str1\n\t=> AC[isEnabled:$bool1] delete: $str2\n\t=> $str3"
- })
+ fun logAvalancheDelete(
+ caller: String,
+ isEnabled: Boolean,
+ notifEntryKey: String,
+ outcome: String
+ ) {
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = caller
+ str2 = notifEntryKey
+ str3 = outcome
+ bool1 = isEnabled
+ },
+ { "$str1\n\t=> AC[isEnabled:$bool1] delete: $str2\n\t=> $str3" }
+ )
}
fun logShowNotification(entry: NotificationEntry) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- }, {
- "show notification $str1"
- })
+ buffer.log(TAG, INFO, { str1 = entry.logKey }, { "show notification $str1" })
}
fun logAutoRemoveScheduled(entry: NotificationEntry, delayMillis: Long, reason: String) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- long1 = delayMillis
- str2 = reason
- }, {
- "schedule auto remove of $str1 in $long1 ms reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ long1 = delayMillis
+ str2 = reason
+ },
+ { "schedule auto remove of $str1 in $long1 ms reason: $str2" }
+ )
}
fun logAutoRemoveRequest(entry: NotificationEntry, reason: String) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- str2 = reason
- }, {
- "request: reschedule auto remove of $str1 reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ str2 = reason
+ },
+ { "request: reschedule auto remove of $str1 reason: $str2" }
+ )
}
fun logAutoRemoveRescheduled(entry: NotificationEntry, delayMillis: Long, reason: String) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- long1 = delayMillis
- str2 = reason
- }, {
- "reschedule auto remove of $str1 in $long1 ms reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ long1 = delayMillis
+ str2 = reason
+ },
+ { "reschedule auto remove of $str1 in $long1 ms reason: $str2" }
+ )
}
fun logAutoRemoveCancelRequest(entry: NotificationEntry, reason: String?) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- str2 = reason ?: "unknown"
- }, {
- "request: cancel auto remove of $str1 reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ str2 = reason ?: "unknown"
+ },
+ { "request: cancel auto remove of $str1 reason: $str2" }
+ )
}
fun logAutoRemoveCanceled(entry: NotificationEntry, reason: String?) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- str2 = reason ?: "unknown"
- }, {
- "cancel auto remove of $str1 reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ str2 = reason ?: "unknown"
+ },
+ { "cancel auto remove of $str1 reason: $str2" }
+ )
}
fun logRemoveEntryRequest(key: String, reason: String, isWaiting: Boolean) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- str2 = reason
- bool1 = isWaiting
- }, {
- "request: $str2 => remove entry $str1 isWaiting: $isWaiting"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ str2 = reason
+ bool1 = isWaiting
+ },
+ { "request: $str2 => remove entry $str1 isWaiting: $isWaiting" }
+ )
}
fun logRemoveEntry(key: String, reason: String, isWaiting: Boolean) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- str2 = reason
- bool1 = isWaiting
- }, {
- "$str2 => remove entry $str1 isWaiting: $isWaiting"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ str2 = reason
+ bool1 = isWaiting
+ },
+ { "$str2 => remove entry $str1 isWaiting: $isWaiting" }
+ )
}
fun logUnpinEntryRequest(key: String) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- }, {
- "request: unpin entry $str1"
- })
+ buffer.log(TAG, INFO, { str1 = logKey(key) }, { "request: unpin entry $str1" })
}
fun logUnpinEntry(key: String) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- }, {
- "unpin entry $str1"
- })
+ buffer.log(TAG, INFO, { str1 = logKey(key) }, { "unpin entry $str1" })
}
- fun logRemoveNotification(key: String, releaseImmediately: Boolean, isWaiting: Boolean) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- bool1 = releaseImmediately
- bool2 = isWaiting
- }, {
- "remove notification $str1 releaseImmediately: $bool1 isWaiting: $bool2"
- })
+ fun logRemoveNotification(
+ key: String,
+ releaseImmediately: Boolean,
+ isWaiting: Boolean,
+ reason: String
+ ) {
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ bool1 = releaseImmediately
+ bool2 = isWaiting
+ str2 = reason
+ },
+ {
+ "remove notification $str1 releaseImmediately: $bool1 isWaiting: $bool2 " +
+ "reason: $str2"
+ }
+ )
+ }
+
+ fun logNullEntry(key: String, reason: String) {
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ str2 = reason
+ },
+ { "remove notification $str1 when headsUpEntry is null, reason: $str2" }
+ )
}
fun logNotificationActuallyRemoved(entry: NotificationEntry) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- }, {
- "notification removed $str1 "
- })
+ buffer.log(TAG, INFO, { str1 = entry.logKey }, { "notification removed $str1 " })
}
fun logUpdateNotificationRequest(key: String, alert: Boolean, hasEntry: Boolean) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- bool1 = alert
- bool2 = hasEntry
- }, {
- "request: update notification $str1 alert: $bool1 hasEntry: $bool2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ bool1 = alert
+ bool2 = hasEntry
+ },
+ { "request: update notification $str1 alert: $bool1 hasEntry: $bool2" }
+ )
}
fun logUpdateNotification(key: String, alert: Boolean, hasEntry: Boolean) {
- buffer.log(TAG, INFO, {
- str1 = logKey(key)
- bool1 = alert
- bool2 = hasEntry
- }, {
- "update notification $str1 alert: $bool1 hasEntry: $bool2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = logKey(key)
+ bool1 = alert
+ bool2 = hasEntry
+ },
+ { "update notification $str1 alert: $bool1 hasEntry: $bool2" }
+ )
}
fun logUpdateEntry(entry: NotificationEntry, updatePostTime: Boolean, reason: String?) {
- buffer.log(TAG, INFO, {
- str1 = entry.logKey
- bool1 = updatePostTime
- str2 = reason ?: "unknown"
- }, {
- "update entry $str1 updatePostTime: $bool1 reason: $str2"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ {
+ str1 = entry.logKey
+ bool1 = updatePostTime
+ str2 = reason ?: "unknown"
+ },
+ { "update entry $str1 updatePostTime: $bool1 reason: $str2" }
+ )
}
fun logSnoozeLengthChange(packageSnoozeLengthMs: Int) {
- buffer.log(TAG, INFO, {
- int1 = packageSnoozeLengthMs
- }, {
- "snooze length changed: ${int1}ms"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ { int1 = packageSnoozeLengthMs },
+ { "snooze length changed: ${int1}ms" }
+ )
}
fun logSetEntryPinned(entry: NotificationEntry, isPinned: Boolean, reason: String) {
- buffer.log(TAG, VERBOSE, {
- str1 = entry.logKey
- bool1 = isPinned
- str2 = reason
- }, {
- "$str2 => set entry pinned $str1 pinned: $bool1"
- })
+ buffer.log(
+ TAG,
+ VERBOSE,
+ {
+ str1 = entry.logKey
+ bool1 = isPinned
+ str2 = reason
+ },
+ { "$str2 => set entry pinned $str1 pinned: $bool1" }
+ )
}
fun logUpdatePinnedMode(hasPinnedNotification: Boolean) {
- buffer.log(TAG, INFO, {
- bool1 = hasPinnedNotification
- }, {
- "has pinned notification changed to $bool1"
- })
+ buffer.log(
+ TAG,
+ INFO,
+ { bool1 = hasPinnedNotification },
+ { "has pinned notification changed to $bool1" }
+ )
}
}
-private const val TAG = "HeadsUpManager"
\ No newline at end of file
+private const val TAG = "HeadsUpManager"
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt
index 3abdf62..cb92b77 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt
@@ -91,7 +91,12 @@
assertFalse(isExpandAnimationRunning!!)
verify(headsUpManager)
- .removeNotification(notificationKey, true /* releaseImmediately */, true /* animate */)
+ .removeNotification(
+ notificationKey,
+ /* releaseImmediately= */ true,
+ /* animate= */ true,
+ /* reason= */ "onIntentStarted(willAnimate=false)"
+ )
verify(onFinishAnimationCallback).run()
}
@@ -109,7 +114,12 @@
assertFalse(isExpandAnimationRunning!!)
verify(headsUpManager)
- .removeNotification(notificationKey, true /* releaseImmediately */, true /* animate */)
+ .removeNotification(
+ notificationKey,
+ /* releaseImmediately= */ true,
+ /* animate= */ true,
+ /* reason= */ "onLaunchAnimationCancelled()"
+ )
verify(onFinishAnimationCallback).run()
}
@@ -127,7 +137,12 @@
assertFalse(isExpandAnimationRunning!!)
verify(headsUpManager)
- .removeNotification(notificationKey, true /* releaseImmediately */, false /* animate */)
+ .removeNotification(
+ notificationKey,
+ /* releaseImmediately= */ true,
+ /* animate= */ false,
+ /* reason= */ "onLaunchAnimationEnd()"
+ )
verify(onFinishAnimationCallback).run()
}
@@ -161,12 +176,18 @@
controller.onTransitionAnimationEnd(isExpandingFullyAbove = true)
verify(headsUpManager)
- .removeNotification(summary.key, true /* releaseImmediately */, false /* animate */)
+ .removeNotification(
+ summary.key,
+ /* releaseImmediately= */ true,
+ /* animate= */ false,
+ /* reason= */ "onLaunchAnimationEnd()"
+ )
verify(headsUpManager, never())
.removeNotification(
notification.entry.key,
- true /* releaseImmediately */,
- false /* animate */
+ /* releaseImmediately= */ true,
+ /* animate= */ false,
+ /* reason= */ "onLaunchAnimationEnd()"
)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
index 8e9323f..b4f4138 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
@@ -108,30 +108,31 @@
private val executor = FakeExecutor(systemClock)
private val huns: ArrayList<NotificationEntry> = ArrayList()
private lateinit var helper: NotificationGroupTestHelper
+
@Before
fun setUp() {
MockitoAnnotations.initMocks(this)
helper = NotificationGroupTestHelper(mContext)
- coordinator = HeadsUpCoordinator(
- logger,
- systemClock,
- headsUpManager,
- headsUpViewBinder,
- visualInterruptionDecisionProvider,
- remoteInputManager,
- launchFullScreenIntentProvider,
- flags,
- headerController,
- executor)
+ coordinator =
+ HeadsUpCoordinator(
+ logger,
+ systemClock,
+ headsUpManager,
+ headsUpViewBinder,
+ visualInterruptionDecisionProvider,
+ remoteInputManager,
+ launchFullScreenIntentProvider,
+ flags,
+ headerController,
+ executor
+ )
coordinator.attach(notifPipeline)
// capture arguments:
collectionListener = withArgCaptor {
verify(notifPipeline).addCollectionListener(capture())
}
- notifPromoter = withArgCaptor {
- verify(notifPipeline).addPromoter(capture())
- }
+ notifPromoter = withArgCaptor { verify(notifPipeline).addPromoter(capture()) }
notifLifetimeExtender = withArgCaptor {
verify(notifPipeline).addNotificationLifetimeExtender(capture())
}
@@ -141,9 +142,7 @@
beforeFinalizeFilterListener = withArgCaptor {
verify(notifPipeline).addOnBeforeFinalizeFilterListener(capture())
}
- onHeadsUpChangedListener = withArgCaptor {
- verify(headsUpManager).addListener(capture())
- }
+ onHeadsUpChangedListener = withArgCaptor { verify(headsUpManager).addListener(capture()) }
actionPressListener = withArgCaptor {
verify(remoteInputManager).addActionPressListener(capture())
}
@@ -187,8 +186,8 @@
assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, 0))
executor.advanceClockToLast()
executor.runAllReady()
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(false))
- verify(headsUpManager, times(1)).removeNotification(anyString(), eq(true))
+ verify(headsUpManager, times(0)).removeNotification(anyString(), eq(false), anyString())
+ verify(headsUpManager, times(1)).removeNotification(anyString(), eq(true), anyString())
}
@Test
@@ -203,8 +202,8 @@
executor.advanceClockToLast()
executor.runAllReady()
assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, 0))
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(false))
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(true))
+ verify(headsUpManager, times(0)).removeNotification(anyString(), eq(false), anyString())
+ verify(headsUpManager, times(0)).removeNotification(anyString(), eq(true), anyString())
}
@Test
@@ -217,7 +216,7 @@
notifLifetimeExtender.cancelLifetimeExtension(entry)
executor.advanceClockToLast()
executor.runAllReady()
- verify(headsUpManager, times(0)).removeNotification(anyString(), any())
+ verify(headsUpManager, never()).removeNotification(anyString(), any(), anyString())
}
@Test
@@ -227,14 +226,14 @@
whenever(headsUpManager.canRemoveImmediately(anyString())).thenReturn(false)
whenever(headsUpManager.getEarliestRemovalTime(anyString())).thenReturn(1000L)
- assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, /* reason = */ 0))
+ assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, /* reason= */ 0))
actionPressListener.accept(entry)
executor.runAllReady()
verify(endLifetimeExtension, times(1)).onEndLifetimeExtension(notifLifetimeExtender, entry)
- collectionListener.onEntryRemoved(entry, /* reason = */ 0)
- verify(headsUpManager, times(1)).removeNotification(eq(entry.key), any())
+ collectionListener.onEntryRemoved(entry, /* reason= */ 0)
+ verify(headsUpManager, times(1)).removeNotification(eq(entry.key), any(), anyString())
}
@Test
@@ -248,8 +247,8 @@
whenever(headsUpManager.canRemoveImmediately(anyString())).thenReturn(true)
assertFalse(notifLifetimeExtender.maybeExtendLifetime(entry, 0))
- collectionListener.onEntryRemoved(entry, /* reason = */ 0)
- verify(headsUpManager, times(1)).removeNotification(eq(entry.key), any())
+ collectionListener.onEntryRemoved(entry, /* reason= */ 0)
+ verify(headsUpManager, times(1)).removeNotification(eq(entry.key), any(), anyString())
}
@Test
@@ -261,8 +260,8 @@
addHUN(entry)
executor.advanceClockToLast()
executor.runAllReady()
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(false))
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(true))
+ verify(headsUpManager, never()).removeNotification(anyString(), eq(false), anyString())
+ verify(headsUpManager, never()).removeNotification(anyString(), eq(true), anyString())
}
@Test
@@ -273,8 +272,8 @@
assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, 0))
executor.advanceClockToLast()
executor.runAllReady()
- verify(headsUpManager, times(1)).removeNotification(anyString(), eq(false))
- verify(headsUpManager, times(0)).removeNotification(anyString(), eq(true))
+ verify(headsUpManager, times(1)).removeNotification(anyString(), eq(false), anyString())
+ verify(headsUpManager, never()).removeNotification(anyString(), eq(true), anyString())
}
@Test
@@ -326,9 +325,8 @@
// THEN only promote the current HUN, mEntry
assertTrue(notifPromoter.shouldPromoteToTopLevel(entry))
- assertFalse(notifPromoter.shouldPromoteToTopLevel(NotificationEntryBuilder()
- .setPkg("test-package2")
- .build()))
+ val testPackage2 = NotificationEntryBuilder().setPkg("test-package2").build()
+ assertFalse(notifPromoter.shouldPromoteToTopLevel(testPackage2))
}
@Test
@@ -338,9 +336,9 @@
// THEN only section the current HUN, mEntry
assertTrue(notifSectioner.isInSection(entry))
- assertFalse(notifSectioner.isInSection(NotificationEntryBuilder()
- .setPkg("test-package")
- .build()))
+ assertFalse(
+ notifSectioner.isInSection(NotificationEntryBuilder().setPkg("test-package").build())
+ )
}
@Test
@@ -350,10 +348,12 @@
// THEN only the current HUN, mEntry, should be lifetimeExtended
assertTrue(notifLifetimeExtender.maybeExtendLifetime(entry, /* cancellationReason */ 0))
- assertFalse(notifLifetimeExtender.maybeExtendLifetime(
- NotificationEntryBuilder()
- .setPkg("test-package")
- .build(), /* cancellationReason */ 0))
+ assertFalse(
+ notifLifetimeExtender.maybeExtendLifetime(
+ NotificationEntryBuilder().setPkg("test-package").build(),
+ /* reason= */ 0
+ )
+ )
}
@Test
@@ -366,8 +366,9 @@
beforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(entry))
verify(headsUpManager, never()).showNotification(entry)
withArgCaptor<BindCallback> {
- verify(headsUpViewBinder).bindHeadsUpView(eq(entry), capture())
- }.onBindFinished(entry)
+ verify(headsUpViewBinder).bindHeadsUpView(eq(entry), capture())
+ }
+ .onBindFinished(entry)
// THEN we tell the HeadsUpManager to show the notification
verify(headsUpManager).showNotification(entry)
@@ -430,7 +431,7 @@
whenever(remoteInputManager.isSpinning(any())).thenReturn(false)
// THEN heads up manager should remove the entry
- verify(headsUpManager).removeNotification(entry.key, false)
+ verify(headsUpManager).removeNotification(eq(entry.key), eq(false), anyString())
}
private fun addHUN(entry: NotificationEntry) {
@@ -545,19 +546,22 @@
collectionListener.onEntryAdded(groupSibling1)
collectionListener.onEntryAdded(groupSibling2)
- val beforeTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
- .build()
+ val beforeTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(beforeTransformGroup))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
- val afterTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupSibling2))
- .build()
- beforeFinalizeFilterListener
- .onBeforeFinalizeFilter(listOf(groupPriority, afterTransformGroup))
+ val afterTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupSibling2))
+ .build()
+ beforeFinalizeFilterListener.onBeforeFinalizeFilter(
+ listOf(groupPriority, afterTransformGroup)
+ )
verify(headsUpViewBinder, never()).bindHeadsUpView(eq(groupSummary), any())
finishBind(groupPriority)
@@ -583,19 +587,22 @@
collectionListener.onEntryUpdated(groupSibling1)
collectionListener.onEntryUpdated(groupSibling2)
- val beforeTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
- .build()
+ val beforeTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(beforeTransformGroup))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
- val afterTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupSibling2))
- .build()
- beforeFinalizeFilterListener
- .onBeforeFinalizeFilter(listOf(groupPriority, afterTransformGroup))
+ val afterTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupSibling2))
+ .build()
+ beforeFinalizeFilterListener.onBeforeFinalizeFilter(
+ listOf(groupPriority, afterTransformGroup)
+ )
verify(headsUpViewBinder, never()).bindHeadsUpView(eq(groupSummary), any())
finishBind(groupPriority)
@@ -618,19 +625,22 @@
collectionListener.onEntryUpdated(groupSummary)
collectionListener.onEntryUpdated(groupPriority)
- val beforeTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
- .build()
+ val beforeTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(beforeTransformGroup))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
- val afterTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupSibling2))
- .build()
- beforeFinalizeFilterListener
- .onBeforeFinalizeFilter(listOf(groupPriority, afterTransformGroup))
+ val afterTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupSibling2))
+ .build()
+ beforeFinalizeFilterListener.onBeforeFinalizeFilter(
+ listOf(groupPriority, afterTransformGroup)
+ )
verify(headsUpViewBinder, never()).bindHeadsUpView(eq(groupSummary), any())
finishBind(groupPriority)
@@ -654,19 +664,22 @@
collectionListener.onEntryUpdated(groupSibling1)
collectionListener.onEntryUpdated(groupSibling2)
- val beforeTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
- .build()
+ val beforeTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupPriority, groupSibling2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(beforeTransformGroup))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
- val afterTransformGroup = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupSibling2))
- .build()
- beforeFinalizeFilterListener
- .onBeforeFinalizeFilter(listOf(groupPriority, afterTransformGroup))
+ val afterTransformGroup =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupSibling2))
+ .build()
+ beforeFinalizeFilterListener.onBeforeFinalizeFilter(
+ listOf(groupPriority, afterTransformGroup)
+ )
finishBind(groupSummary)
verify(headsUpViewBinder, never()).bindHeadsUpView(eq(groupPriority), any())
@@ -688,10 +701,11 @@
collectionListener.onEntryAdded(groupSummary)
collectionListener.onEntryAdded(groupSibling1)
collectionListener.onEntryAdded(groupSibling2)
- val groupEntry = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupSibling1, groupSibling2))
- .build()
+ val groupEntry =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupSibling1, groupSibling2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(groupEntry))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
beforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(groupEntry))
@@ -708,16 +722,16 @@
@Test
fun testNoTransferTwoChildAlert_withGroupAlertAll() {
setShouldHeadsUp(groupSummary)
- whenever(notifPipeline.allNotifs)
- .thenReturn(listOf(groupSummary, groupChild1, groupChild2))
+ whenever(notifPipeline.allNotifs).thenReturn(listOf(groupSummary, groupChild1, groupChild2))
collectionListener.onEntryAdded(groupSummary)
collectionListener.onEntryAdded(groupChild1)
collectionListener.onEntryAdded(groupChild2)
- val groupEntry = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupChild1, groupChild2))
- .build()
+ val groupEntry =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupChild1, groupChild2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(groupEntry))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
beforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(groupEntry))
@@ -742,10 +756,11 @@
collectionListener.onEntryAdded(groupSummary)
collectionListener.onEntryAdded(groupChild1)
collectionListener.onEntryAdded(groupChild2)
- val groupEntry = GroupEntryBuilder()
- .setSummary(groupSummary)
- .setChildren(listOf(groupChild1, groupChild2))
- .build()
+ val groupEntry =
+ GroupEntryBuilder()
+ .setSummary(groupSummary)
+ .setChildren(listOf(groupChild1, groupChild2))
+ .build()
beforeTransformGroupsListener.onBeforeTransformGroups(listOf(groupEntry))
verify(headsUpViewBinder, never()).bindHeadsUpView(any(), any())
beforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(groupEntry))
@@ -1045,9 +1060,7 @@
.thenReturn(DecisionImpl.of(should))
}
- private fun setDefaultShouldFullScreen(
- originalDecision: FullScreenIntentDecision
- ) {
+ private fun setDefaultShouldFullScreen(originalDecision: FullScreenIntentDecision) {
val provider = visualInterruptionDecisionProvider
whenever(provider.makeUnloggedFullScreenIntentDecision(any())).thenAnswer {
val entry: NotificationEntry = it.getArgument(0)
@@ -1059,11 +1072,8 @@
entry: NotificationEntry,
originalDecision: FullScreenIntentDecision
) {
- whenever(
- visualInterruptionDecisionProvider.makeUnloggedFullScreenIntentDecision(entry)
- ).thenAnswer {
- FullScreenIntentDecisionImpl(entry, originalDecision)
- }
+ whenever(visualInterruptionDecisionProvider.makeUnloggedFullScreenIntentDecision(entry))
+ .thenAnswer { FullScreenIntentDecisionImpl(entry, originalDecision) }
}
private fun verifyLoggedFullScreenIntentDecision(
@@ -1089,7 +1099,8 @@
private fun finishBind(entry: NotificationEntry) {
verify(headsUpManager, never()).showNotification(entry)
withArgCaptor<BindCallback> {
- verify(headsUpViewBinder).bindHeadsUpView(eq(entry), capture())
- }.onBindFinished(entry)
+ verify(headsUpViewBinder).bindHeadsUpView(eq(entry), capture())
+ }
+ .onBindFinished(entry)
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
index 9fa392f..7a34e94 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
@@ -434,7 +434,11 @@
// Then
verify(mBubblesManager).onUserChangedBubble(entry, false);
- verify(mHeadsUpManager).removeNotification(entry.getKey(), true);
+ verify(mHeadsUpManager).removeNotification(
+ entry.getKey(),
+ /* releaseImmediately= */ true,
+ /* reason= */ "onNotificationBubbleIconClicked"
+ );
verifyNoMoreInteractions(mContentIntent);
verifyNoMoreInteractions(mShadeController);
@@ -456,7 +460,11 @@
// Then
verify(mBubblesManager).onUserChangedBubble(entry, true);
- verify(mHeadsUpManager).removeNotification(entry.getKey(), true);
+ verify(mHeadsUpManager).removeNotification(
+ entry.getKey(),
+ /* releaseImmediately= */ true,
+ /* reason= */ "onNotificationBubbleIconClicked"
+ );
verify(mContentIntent, atLeastOnce()).isActivity();
verifyNoMoreInteractions(mContentIntent);