Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +23 −15 Original line number Diff line number Diff line Loading @@ -64,7 +64,6 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mVisibilityAnimator: ObjectAnimator? = null private var mVisibilityAmount = 0.0f private var mLinearVisibilityAmount = 0.0f private var mWakingUp = false private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>() private val mDozeParameters: DozeParameters private var pulseExpanding: Boolean = false Loading @@ -73,6 +72,25 @@ class NotificationWakeUpCoordinator @Inject constructor( var fullyAwake: Boolean = false var wakingUp = false set(value) { field = value willWakeUp = false if (value) { if (mNotificationsVisible && !mNotificationsVisibleForExpansion && !bypassController.bypassEnabled) { // We're waking up while pulsing, let's make sure the animation looks nice mStackScroller.wakeUpFromPulse(); } if (bypassController.bypassEnabled && !mNotificationsVisible) { // Let's make sure our huns become visible once we are waking up in case // they were blocked by the proximity sensor updateNotificationVisibility(animate = shouldAnimateVisibility(), increaseSpeed = false) } } } var willWakeUp = false set(value) { if (!value || mDozeAmount != 0.0f) { Loading Loading @@ -112,7 +130,7 @@ class NotificationWakeUpCoordinator @Inject constructor( var canShow = pulsing if (bypassController.bypassEnabled) { // We also allow pulsing on the lock screen! canShow = canShow || (mWakingUp || willWakeUp || fullyAwake) canShow = canShow || (wakingUp || willWakeUp || fullyAwake) && statusBarStateController.state == StatusBarState.KEYGUARD } return canShow Loading Loading @@ -160,7 +178,7 @@ class NotificationWakeUpCoordinator @Inject constructor( wakeUpListeners.add(listener); } fun removeFullyHiddenChangedListener(listener: WakeUpListener) { fun removeListener(listener: WakeUpListener) { wakeUpListeners.remove(listener); } Loading @@ -169,7 +187,7 @@ class NotificationWakeUpCoordinator @Inject constructor( var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications() visible = visible && canShowPulsingHuns if (!visible && mNotificationsVisible && (mWakingUp || willWakeUp) && mDozeAmount != 0.0f) { if (!visible && mNotificationsVisible && (wakingUp || willWakeUp) && mDozeAmount != 0.0f) { // let's not make notifications invisible while waking up, otherwise the animation // is strange return; Loading Loading @@ -307,16 +325,6 @@ class NotificationWakeUpCoordinator @Inject constructor( return if (bypassController.bypassEnabled) 0.0f else overflow } fun setWakingUp(wakingUp: Boolean) { willWakeUp = false mWakingUp = wakingUp if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion && !bypassController.bypassEnabled) { // We're waking up while pulsing, let's make sure the animation looks nice mStackScroller.wakeUpFromPulse(); } } override fun onHeadsUpStateChanged(entry: NotificationEntry, isHeadsUp: Boolean) { var animate = shouldAnimateVisibility() if (!isHeadsUp) { Loading @@ -325,7 +333,7 @@ class NotificationWakeUpCoordinator @Inject constructor( // if we animate, we see the shelf briefly visible. Instead we fully animate // the notification and its background out animate = false } else if (!mWakingUp && !willWakeUp){ } else if (!wakingUp && !willWakeUp){ // TODO: look that this is done properly and not by anyone else entry.setHeadsUpAnimatingAway(true) mEntrySetToClearWhenFinished.add(entry) Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +24 −14 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.HeadsUpStatusBarView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; Loading @@ -48,7 +49,7 @@ import java.util.function.Consumer; * Controls the appearance of heads up notifications in the icon area and the header itself. */ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, DarkIconDispatcher.DarkReceiver { DarkIconDispatcher.DarkReceiver, NotificationWakeUpCoordinator.WakeUpListener { public static final int CONTENT_FADE_DURATION = 110; public static final int CONTENT_FADE_DELAY = 100; private final NotificationIconAreaController mNotificationIconAreaController; Loading @@ -67,6 +68,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, private final KeyguardBypassController mBypassController; private final StatusBarStateController mStatusBarStateController; private final CommandQueue mCommandQueue; private final NotificationWakeUpCoordinator mWakeUpCoordinator; @VisibleForTesting float mExpandedHeight; @VisibleForTesting Loading Loading @@ -95,9 +97,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, View statusbarView, SysuiStatusBarStateController statusBarStateController, KeyguardBypassController keyguardBypassController) { KeyguardBypassController keyguardBypassController, NotificationWakeUpCoordinator wakeUpCoordinator) { this(notificationIconAreaController, headsUpManager, statusBarStateController, keyguardBypassController, keyguardBypassController, wakeUpCoordinator, statusbarView.findViewById(R.id.heads_up_status_bar_view), statusbarView.findViewById(R.id.notification_stack_scroller), statusbarView.findViewById(R.id.notification_panel), Loading @@ -112,6 +115,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, StatusBarStateController stateController, KeyguardBypassController bypassController, NotificationWakeUpCoordinator wakeUpCoordinator, HeadsUpStatusBarView headsUpStatusBarView, NotificationStackScrollLayout stackScroller, NotificationPanelView panelView, Loading Loading @@ -153,6 +157,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, }); mBypassController = bypassController; mStatusBarStateController = stateController; mWakeUpCoordinator = wakeUpCoordinator; wakeUpCoordinator.addListener(this); mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class); mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); } Loading @@ -161,6 +167,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, public void destroy() { mHeadsUpManager.removeListener(this); mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null); mWakeUpCoordinator.removeListener(this); mPanelView.removeTrackingHeadsUpListener(mSetTrackingHeadsUp); mPanelView.removeVerticalTranslationListener(mUpdatePanelTranslation); mPanelView.setHeadsUpAppearanceController(null); Loading Loading @@ -289,6 +296,11 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateParentClipping(true /* shouldClip */); }); } // Show the status bar icons when the view gets shown / hidden if (mStatusBarStateController.getState() != StatusBarState.SHADE) { mCommandQueue.recomputeDisableFlags( mHeadsUpStatusBarView.getContext().getDisplayId(), false); } } } Loading Loading @@ -362,10 +374,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, * @return if the heads up status bar view should be shown */ public boolean shouldBeVisible() { boolean canShow = !mIsExpanded; boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden(); boolean canShow = !mIsExpanded && notificationsShown; if (mBypassController.getBypassEnabled() && (mStatusBarStateController.getState() == StatusBarState.KEYGUARD || mKeyguardMonitor.isKeyguardGoingAway())) { || mKeyguardMonitor.isKeyguardGoingAway()) && notificationsShown) { canShow = true; } return canShow && mHeadsUpManager.hasPinnedHeadsUp(); Loading @@ -377,15 +391,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateHeader(entry); } @Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) { if (mStatusBarStateController.getState() != StatusBarState.SHADE) { // Show the status bar icons when the pinned mode changes mCommandQueue.recomputeDisableFlags( mHeadsUpStatusBarView.getContext().getDisplayId(), false); } } public void setAppearFraction(float expandedHeight, float appearFraction) { boolean changed = expandedHeight != mExpandedHeight; mExpandedHeight = expandedHeight; Loading Loading @@ -451,4 +456,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, mAppearFraction = oldController.mAppearFraction; } } @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateTopEntry(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +1 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange mConfigurationController.removeCallback(this); mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback); mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback); mWakeUpCoordinator.removeFullyHiddenChangedListener(this); mWakeUpCoordinator.removeListener(this); mUnlockMethodCache.removeListener(this); if (mDockManager != null) { mDockManager.removeListener(mDockEventListener); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -453,6 +453,11 @@ public class NotificationPanelView extends PanelView implements mQsFrame = findViewById(R.id.qs_frame); mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController); mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() { @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateKeyguardStatusBarForHeadsUp(); } @Override public void onPulseExpansionChanged(boolean expandingChanged) { if (mKeyguardBypassController.getBypassEnabled()) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -856,7 +856,8 @@ public class StatusBar extends SystemUI implements DemoMode, } mHeadsUpAppearanceController = new HeadsUpAppearanceController( mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow, mStatusBarStateController, mKeyguardBypassController); mStatusBarStateController, mKeyguardBypassController, mWakeUpCoordinator); mHeadsUpAppearanceController.readFrom(oldController); mStatusBarWindow.setStatusBarView(mStatusBarView); updateAreThereNotifications(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +23 −15 Original line number Diff line number Diff line Loading @@ -64,7 +64,6 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mVisibilityAnimator: ObjectAnimator? = null private var mVisibilityAmount = 0.0f private var mLinearVisibilityAmount = 0.0f private var mWakingUp = false private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>() private val mDozeParameters: DozeParameters private var pulseExpanding: Boolean = false Loading @@ -73,6 +72,25 @@ class NotificationWakeUpCoordinator @Inject constructor( var fullyAwake: Boolean = false var wakingUp = false set(value) { field = value willWakeUp = false if (value) { if (mNotificationsVisible && !mNotificationsVisibleForExpansion && !bypassController.bypassEnabled) { // We're waking up while pulsing, let's make sure the animation looks nice mStackScroller.wakeUpFromPulse(); } if (bypassController.bypassEnabled && !mNotificationsVisible) { // Let's make sure our huns become visible once we are waking up in case // they were blocked by the proximity sensor updateNotificationVisibility(animate = shouldAnimateVisibility(), increaseSpeed = false) } } } var willWakeUp = false set(value) { if (!value || mDozeAmount != 0.0f) { Loading Loading @@ -112,7 +130,7 @@ class NotificationWakeUpCoordinator @Inject constructor( var canShow = pulsing if (bypassController.bypassEnabled) { // We also allow pulsing on the lock screen! canShow = canShow || (mWakingUp || willWakeUp || fullyAwake) canShow = canShow || (wakingUp || willWakeUp || fullyAwake) && statusBarStateController.state == StatusBarState.KEYGUARD } return canShow Loading Loading @@ -160,7 +178,7 @@ class NotificationWakeUpCoordinator @Inject constructor( wakeUpListeners.add(listener); } fun removeFullyHiddenChangedListener(listener: WakeUpListener) { fun removeListener(listener: WakeUpListener) { wakeUpListeners.remove(listener); } Loading @@ -169,7 +187,7 @@ class NotificationWakeUpCoordinator @Inject constructor( var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications() visible = visible && canShowPulsingHuns if (!visible && mNotificationsVisible && (mWakingUp || willWakeUp) && mDozeAmount != 0.0f) { if (!visible && mNotificationsVisible && (wakingUp || willWakeUp) && mDozeAmount != 0.0f) { // let's not make notifications invisible while waking up, otherwise the animation // is strange return; Loading Loading @@ -307,16 +325,6 @@ class NotificationWakeUpCoordinator @Inject constructor( return if (bypassController.bypassEnabled) 0.0f else overflow } fun setWakingUp(wakingUp: Boolean) { willWakeUp = false mWakingUp = wakingUp if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion && !bypassController.bypassEnabled) { // We're waking up while pulsing, let's make sure the animation looks nice mStackScroller.wakeUpFromPulse(); } } override fun onHeadsUpStateChanged(entry: NotificationEntry, isHeadsUp: Boolean) { var animate = shouldAnimateVisibility() if (!isHeadsUp) { Loading @@ -325,7 +333,7 @@ class NotificationWakeUpCoordinator @Inject constructor( // if we animate, we see the shelf briefly visible. Instead we fully animate // the notification and its background out animate = false } else if (!mWakingUp && !willWakeUp){ } else if (!wakingUp && !willWakeUp){ // TODO: look that this is done properly and not by anyone else entry.setHeadsUpAnimatingAway(true) mEntrySetToClearWhenFinished.add(entry) Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +24 −14 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.HeadsUpStatusBarView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; Loading @@ -48,7 +49,7 @@ import java.util.function.Consumer; * Controls the appearance of heads up notifications in the icon area and the header itself. */ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, DarkIconDispatcher.DarkReceiver { DarkIconDispatcher.DarkReceiver, NotificationWakeUpCoordinator.WakeUpListener { public static final int CONTENT_FADE_DURATION = 110; public static final int CONTENT_FADE_DELAY = 100; private final NotificationIconAreaController mNotificationIconAreaController; Loading @@ -67,6 +68,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, private final KeyguardBypassController mBypassController; private final StatusBarStateController mStatusBarStateController; private final CommandQueue mCommandQueue; private final NotificationWakeUpCoordinator mWakeUpCoordinator; @VisibleForTesting float mExpandedHeight; @VisibleForTesting Loading Loading @@ -95,9 +97,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, View statusbarView, SysuiStatusBarStateController statusBarStateController, KeyguardBypassController keyguardBypassController) { KeyguardBypassController keyguardBypassController, NotificationWakeUpCoordinator wakeUpCoordinator) { this(notificationIconAreaController, headsUpManager, statusBarStateController, keyguardBypassController, keyguardBypassController, wakeUpCoordinator, statusbarView.findViewById(R.id.heads_up_status_bar_view), statusbarView.findViewById(R.id.notification_stack_scroller), statusbarView.findViewById(R.id.notification_panel), Loading @@ -112,6 +115,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, StatusBarStateController stateController, KeyguardBypassController bypassController, NotificationWakeUpCoordinator wakeUpCoordinator, HeadsUpStatusBarView headsUpStatusBarView, NotificationStackScrollLayout stackScroller, NotificationPanelView panelView, Loading Loading @@ -153,6 +157,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, }); mBypassController = bypassController; mStatusBarStateController = stateController; mWakeUpCoordinator = wakeUpCoordinator; wakeUpCoordinator.addListener(this); mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class); mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); } Loading @@ -161,6 +167,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, public void destroy() { mHeadsUpManager.removeListener(this); mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null); mWakeUpCoordinator.removeListener(this); mPanelView.removeTrackingHeadsUpListener(mSetTrackingHeadsUp); mPanelView.removeVerticalTranslationListener(mUpdatePanelTranslation); mPanelView.setHeadsUpAppearanceController(null); Loading Loading @@ -289,6 +296,11 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateParentClipping(true /* shouldClip */); }); } // Show the status bar icons when the view gets shown / hidden if (mStatusBarStateController.getState() != StatusBarState.SHADE) { mCommandQueue.recomputeDisableFlags( mHeadsUpStatusBarView.getContext().getDisplayId(), false); } } } Loading Loading @@ -362,10 +374,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, * @return if the heads up status bar view should be shown */ public boolean shouldBeVisible() { boolean canShow = !mIsExpanded; boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden(); boolean canShow = !mIsExpanded && notificationsShown; if (mBypassController.getBypassEnabled() && (mStatusBarStateController.getState() == StatusBarState.KEYGUARD || mKeyguardMonitor.isKeyguardGoingAway())) { || mKeyguardMonitor.isKeyguardGoingAway()) && notificationsShown) { canShow = true; } return canShow && mHeadsUpManager.hasPinnedHeadsUp(); Loading @@ -377,15 +391,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateHeader(entry); } @Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) { if (mStatusBarStateController.getState() != StatusBarState.SHADE) { // Show the status bar icons when the pinned mode changes mCommandQueue.recomputeDisableFlags( mHeadsUpStatusBarView.getContext().getDisplayId(), false); } } public void setAppearFraction(float expandedHeight, float appearFraction) { boolean changed = expandedHeight != mExpandedHeight; mExpandedHeight = expandedHeight; Loading Loading @@ -451,4 +456,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, mAppearFraction = oldController.mAppearFraction; } } @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateTopEntry(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +1 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange mConfigurationController.removeCallback(this); mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback); mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback); mWakeUpCoordinator.removeFullyHiddenChangedListener(this); mWakeUpCoordinator.removeListener(this); mUnlockMethodCache.removeListener(this); if (mDockManager != null) { mDockManager.removeListener(mDockEventListener); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -453,6 +453,11 @@ public class NotificationPanelView extends PanelView implements mQsFrame = findViewById(R.id.qs_frame); mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController); mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() { @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateKeyguardStatusBarForHeadsUp(); } @Override public void onPulseExpansionChanged(boolean expandingChanged) { if (mKeyguardBypassController.getBypassEnabled()) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -856,7 +856,8 @@ public class StatusBar extends SystemUI implements DemoMode, } mHeadsUpAppearanceController = new HeadsUpAppearanceController( mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow, mStatusBarStateController, mKeyguardBypassController); mStatusBarStateController, mKeyguardBypassController, mWakeUpCoordinator); mHeadsUpAppearanceController.readFrom(oldController); mStatusBarWindow.setStatusBarView(mStatusBarView); updateAreThereNotifications(); Loading