Fix HUN re-show after closing shade
The removeRunnable that we create for every entry adds the removed entry to mEntriesToRemoveWhenReorderingAllowed. We remove from this list on entry update. Problem: if the HUN is seen in shade, and we close the shade BEFORE the removeRunnable runs OR after entry UPDATE, the HUN is no longer in this list and we re-show the HUN. Solution: record the HUN as “seen” immediately when shown in shade, instead of on removal/update. In this change --------------- NotificationEntry.seenInShade - New field set true when HUN shows when shade is open HeadsUpmanager.OnReorderingBannedListener - Disables AvalancheController when shade is open HeadsUpManagerPhone.setEntry, if shade is open: - Set "seenInShade" true - Save for removal on shade close HeadsUpManagerPhone.updateEntry - Do NOT remove entry from mEntriesToRemoveWhenReorderingAllowed When HUNs show in shade, we immediately call updateEntry for them (from updatePostTime and scheduleAutoRemovalCallback) which should not change the fact that they should be demoted from HUN when shade closes HeadsUpManagerPhone.OnReorderingAllowedListener - Add this as one persistent listener instead of a temporary one for each HUN NSSL.generateHeadsUpAnimation - Do NOT generate animation if notification seenInShade==true AvalancheController.delete - Runs runnable for untracked but shown HUN so that HUN is removed (without animation) once shade closes Full CUJ walkthrough -------------- Open shade - HeadsUpManagerPhone.OnReorderingBannedListener clears waiting HUNs and disables AvalancheController HUN arrives; the disabled AvalancheController runs the following ASAP: - HeadsUpManagerPhone.setEntry - adds entry to mEntriesToRemoveWhenReorderingAllowed - sets "seenInShade" true - BaseHeadsUpManager.showNotification: runs the appear animation - HeadsUpNotificationViewBinder.bindHeadsUpNotifications calls NSSL.generateHeadsUpAnimation, which adds an item to mHeadsUpChangeAnimations - requestChildrenUpdate calls generateAllAnimationEvents, calls generateHeadsUpAnimationEvents, with this new HeadsUpChangeAnimation - BaseHeadsUpManager.updateEntry (twice, from updatePostEntry and scheduleAutoRemovalCallback) - HUN now stays in mEntriesToRemoveWhenReorderingAllowed Shade closes: - OnReorderingAllowedListener calls removeEntry and enables AvalancheController - AvalancheController runs removeEntry ASAP for the untracked HUN, which is untracked because it was never added to the queue while AvalancheController was disabled during shade open. - removeEntry results in HeadsUpNotificationViewBinder calling NSSL.generateHeadsUpAnimation, which DOES NOT generate the animation since the HUN was seen and shade is closed; thus the HUN does not re-show. Bug: 350797731 Test: AvalancheControllerTest Test: NotificationStackScrollLayoutTest Test: HeadsUpManagerPhoneTest Test: Close shade/exit lockscreen before HUN timeout => HUNs do not re-show Close shade/exit lockscreen after HUN timeout => HUNs do not re-show Inline reply from shade/fullscreen quick settings, then close shade => HUNs do not re-show Send floating HUN with shade closed => No change to throttled behavior Flag: com.android.systemui.notification_avalanche_throttle_hun Change-Id: I0b1d36582025b61d7c917ca02e7deac18ce87f23
Loading
Please register or sign in to comment