Merge "Improved the heads up experience when notifications were blocked" into qt-r1-dev
This commit is contained in:
@@ -64,7 +64,6 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
private var mVisibilityAnimator: ObjectAnimator? = null
|
private var mVisibilityAnimator: ObjectAnimator? = null
|
||||||
private var mVisibilityAmount = 0.0f
|
private var mVisibilityAmount = 0.0f
|
||||||
private var mLinearVisibilityAmount = 0.0f
|
private var mLinearVisibilityAmount = 0.0f
|
||||||
private var mWakingUp = false
|
|
||||||
private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
|
private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
|
||||||
private val mDozeParameters: DozeParameters
|
private val mDozeParameters: DozeParameters
|
||||||
private var pulseExpanding: Boolean = false
|
private var pulseExpanding: Boolean = false
|
||||||
@@ -73,6 +72,25 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
|
|
||||||
var fullyAwake: Boolean = false
|
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
|
var willWakeUp = false
|
||||||
set(value) {
|
set(value) {
|
||||||
if (!value || mDozeAmount != 0.0f) {
|
if (!value || mDozeAmount != 0.0f) {
|
||||||
@@ -112,7 +130,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
var canShow = pulsing
|
var canShow = pulsing
|
||||||
if (bypassController.bypassEnabled) {
|
if (bypassController.bypassEnabled) {
|
||||||
// We also allow pulsing on the lock screen!
|
// We also allow pulsing on the lock screen!
|
||||||
canShow = canShow || (mWakingUp || willWakeUp || fullyAwake)
|
canShow = canShow || (wakingUp || willWakeUp || fullyAwake)
|
||||||
&& statusBarStateController.state == StatusBarState.KEYGUARD
|
&& statusBarStateController.state == StatusBarState.KEYGUARD
|
||||||
}
|
}
|
||||||
return canShow
|
return canShow
|
||||||
@@ -160,7 +178,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
wakeUpListeners.add(listener);
|
wakeUpListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removeFullyHiddenChangedListener(listener: WakeUpListener) {
|
fun removeListener(listener: WakeUpListener) {
|
||||||
wakeUpListeners.remove(listener);
|
wakeUpListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +187,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications()
|
var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications()
|
||||||
visible = visible && canShowPulsingHuns
|
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
|
// let's not make notifications invisible while waking up, otherwise the animation
|
||||||
// is strange
|
// is strange
|
||||||
return;
|
return;
|
||||||
@@ -307,16 +325,6 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
return if (bypassController.bypassEnabled) 0.0f else overflow
|
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) {
|
override fun onHeadsUpStateChanged(entry: NotificationEntry, isHeadsUp: Boolean) {
|
||||||
var animate = shouldAnimateVisibility()
|
var animate = shouldAnimateVisibility()
|
||||||
if (!isHeadsUp) {
|
if (!isHeadsUp) {
|
||||||
@@ -325,7 +333,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
// if we animate, we see the shelf briefly visible. Instead we fully animate
|
// if we animate, we see the shelf briefly visible. Instead we fully animate
|
||||||
// the notification and its background out
|
// the notification and its background out
|
||||||
animate = false
|
animate = false
|
||||||
} else if (!mWakingUp && !willWakeUp){
|
} else if (!wakingUp && !willWakeUp){
|
||||||
// TODO: look that this is done properly and not by anyone else
|
// TODO: look that this is done properly and not by anyone else
|
||||||
entry.setHeadsUpAnimatingAway(true)
|
entry.setHeadsUpAnimatingAway(true)
|
||||||
mEntrySetToClearWhenFinished.add(entry)
|
mEntrySetToClearWhenFinished.add(entry)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.systemui.statusbar.CrossFadeHelper;
|
|||||||
import com.android.systemui.statusbar.HeadsUpStatusBarView;
|
import com.android.systemui.statusbar.HeadsUpStatusBarView;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
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.collection.NotificationEntry;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
|
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
|
||||||
@@ -48,7 +49,7 @@ import java.util.function.Consumer;
|
|||||||
* Controls the appearance of heads up notifications in the icon area and the header itself.
|
* Controls the appearance of heads up notifications in the icon area and the header itself.
|
||||||
*/
|
*/
|
||||||
public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
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_DURATION = 110;
|
||||||
public static final int CONTENT_FADE_DELAY = 100;
|
public static final int CONTENT_FADE_DELAY = 100;
|
||||||
private final NotificationIconAreaController mNotificationIconAreaController;
|
private final NotificationIconAreaController mNotificationIconAreaController;
|
||||||
@@ -67,6 +68,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
private final KeyguardBypassController mBypassController;
|
private final KeyguardBypassController mBypassController;
|
||||||
private final StatusBarStateController mStatusBarStateController;
|
private final StatusBarStateController mStatusBarStateController;
|
||||||
private final CommandQueue mCommandQueue;
|
private final CommandQueue mCommandQueue;
|
||||||
|
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
float mExpandedHeight;
|
float mExpandedHeight;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -95,9 +97,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
HeadsUpManagerPhone headsUpManager,
|
HeadsUpManagerPhone headsUpManager,
|
||||||
View statusbarView,
|
View statusbarView,
|
||||||
SysuiStatusBarStateController statusBarStateController,
|
SysuiStatusBarStateController statusBarStateController,
|
||||||
KeyguardBypassController keyguardBypassController) {
|
KeyguardBypassController keyguardBypassController,
|
||||||
|
NotificationWakeUpCoordinator wakeUpCoordinator) {
|
||||||
this(notificationIconAreaController, headsUpManager, statusBarStateController,
|
this(notificationIconAreaController, headsUpManager, statusBarStateController,
|
||||||
keyguardBypassController,
|
keyguardBypassController, wakeUpCoordinator,
|
||||||
statusbarView.findViewById(R.id.heads_up_status_bar_view),
|
statusbarView.findViewById(R.id.heads_up_status_bar_view),
|
||||||
statusbarView.findViewById(R.id.notification_stack_scroller),
|
statusbarView.findViewById(R.id.notification_stack_scroller),
|
||||||
statusbarView.findViewById(R.id.notification_panel),
|
statusbarView.findViewById(R.id.notification_panel),
|
||||||
@@ -112,6 +115,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
HeadsUpManagerPhone headsUpManager,
|
HeadsUpManagerPhone headsUpManager,
|
||||||
StatusBarStateController stateController,
|
StatusBarStateController stateController,
|
||||||
KeyguardBypassController bypassController,
|
KeyguardBypassController bypassController,
|
||||||
|
NotificationWakeUpCoordinator wakeUpCoordinator,
|
||||||
HeadsUpStatusBarView headsUpStatusBarView,
|
HeadsUpStatusBarView headsUpStatusBarView,
|
||||||
NotificationStackScrollLayout stackScroller,
|
NotificationStackScrollLayout stackScroller,
|
||||||
NotificationPanelView panelView,
|
NotificationPanelView panelView,
|
||||||
@@ -153,6 +157,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
});
|
});
|
||||||
mBypassController = bypassController;
|
mBypassController = bypassController;
|
||||||
mStatusBarStateController = stateController;
|
mStatusBarStateController = stateController;
|
||||||
|
mWakeUpCoordinator = wakeUpCoordinator;
|
||||||
|
wakeUpCoordinator.addListener(this);
|
||||||
mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class);
|
mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class);
|
||||||
mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
|
mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
|
||||||
}
|
}
|
||||||
@@ -161,6 +167,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
public void destroy() {
|
public void destroy() {
|
||||||
mHeadsUpManager.removeListener(this);
|
mHeadsUpManager.removeListener(this);
|
||||||
mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
|
mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
|
||||||
|
mWakeUpCoordinator.removeListener(this);
|
||||||
mPanelView.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
mPanelView.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
||||||
mPanelView.removeVerticalTranslationListener(mUpdatePanelTranslation);
|
mPanelView.removeVerticalTranslationListener(mUpdatePanelTranslation);
|
||||||
mPanelView.setHeadsUpAppearanceController(null);
|
mPanelView.setHeadsUpAppearanceController(null);
|
||||||
@@ -289,6 +296,11 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
updateParentClipping(true /* shouldClip */);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,10 +374,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
* @return if the heads up status bar view should be shown
|
* @return if the heads up status bar view should be shown
|
||||||
*/
|
*/
|
||||||
public boolean shouldBeVisible() {
|
public boolean shouldBeVisible() {
|
||||||
boolean canShow = !mIsExpanded;
|
boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden();
|
||||||
|
boolean canShow = !mIsExpanded && notificationsShown;
|
||||||
if (mBypassController.getBypassEnabled() &&
|
if (mBypassController.getBypassEnabled() &&
|
||||||
(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
|
(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
|
||||||
|| mKeyguardMonitor.isKeyguardGoingAway())) {
|
|| mKeyguardMonitor.isKeyguardGoingAway())
|
||||||
|
&& notificationsShown) {
|
||||||
canShow = true;
|
canShow = true;
|
||||||
}
|
}
|
||||||
return canShow && mHeadsUpManager.hasPinnedHeadsUp();
|
return canShow && mHeadsUpManager.hasPinnedHeadsUp();
|
||||||
@@ -377,15 +391,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
updateHeader(entry);
|
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) {
|
public void setAppearFraction(float expandedHeight, float appearFraction) {
|
||||||
boolean changed = expandedHeight != mExpandedHeight;
|
boolean changed = expandedHeight != mExpandedHeight;
|
||||||
mExpandedHeight = expandedHeight;
|
mExpandedHeight = expandedHeight;
|
||||||
@@ -451,4 +456,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|||||||
mAppearFraction = oldController.mAppearFraction;
|
mAppearFraction = oldController.mAppearFraction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFullyHiddenChanged(boolean isFullyHidden) {
|
||||||
|
updateTopEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
|
|||||||
mConfigurationController.removeCallback(this);
|
mConfigurationController.removeCallback(this);
|
||||||
mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
|
mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
|
||||||
mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback);
|
mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback);
|
||||||
mWakeUpCoordinator.removeFullyHiddenChangedListener(this);
|
mWakeUpCoordinator.removeListener(this);
|
||||||
mUnlockMethodCache.removeListener(this);
|
mUnlockMethodCache.removeListener(this);
|
||||||
if (mDockManager != null) {
|
if (mDockManager != null) {
|
||||||
mDockManager.removeListener(mDockEventListener);
|
mDockManager.removeListener(mDockEventListener);
|
||||||
|
|||||||
@@ -453,6 +453,11 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mQsFrame = findViewById(R.id.qs_frame);
|
mQsFrame = findViewById(R.id.qs_frame);
|
||||||
mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController);
|
mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController);
|
||||||
mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() {
|
mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() {
|
||||||
|
@Override
|
||||||
|
public void onFullyHiddenChanged(boolean isFullyHidden) {
|
||||||
|
updateKeyguardStatusBarForHeadsUp();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPulseExpansionChanged(boolean expandingChanged) {
|
public void onPulseExpansionChanged(boolean expandingChanged) {
|
||||||
if (mKeyguardBypassController.getBypassEnabled()) {
|
if (mKeyguardBypassController.getBypassEnabled()) {
|
||||||
|
|||||||
@@ -856,7 +856,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
}
|
}
|
||||||
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
|
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
|
||||||
mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow,
|
mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow,
|
||||||
mStatusBarStateController, mKeyguardBypassController);
|
mStatusBarStateController, mKeyguardBypassController,
|
||||||
|
mWakeUpCoordinator);
|
||||||
mHeadsUpAppearanceController.readFrom(oldController);
|
mHeadsUpAppearanceController.readFrom(oldController);
|
||||||
mStatusBarWindow.setStatusBarView(mStatusBarView);
|
mStatusBarWindow.setStatusBarView(mStatusBarView);
|
||||||
updateAreThereNotifications();
|
updateAreThereNotifications();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.systemui.plugins.DarkIconDispatcher;
|
|||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.HeadsUpStatusBarView;
|
import com.android.systemui.statusbar.HeadsUpStatusBarView;
|
||||||
import com.android.systemui.statusbar.NotificationTestHelper;
|
import com.android.systemui.statusbar.NotificationTestHelper;
|
||||||
|
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
|
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
|||||||
private View mOperatorNameView;
|
private View mOperatorNameView;
|
||||||
private StatusBarStateController mStatusbarStateController;
|
private StatusBarStateController mStatusbarStateController;
|
||||||
private KeyguardBypassController mBypassController;
|
private KeyguardBypassController mBypassController;
|
||||||
|
private NotificationWakeUpCoordinator mWakeUpCoordinator;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
@@ -72,11 +74,13 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
|||||||
mOperatorNameView = new View(mContext);
|
mOperatorNameView = new View(mContext);
|
||||||
mStatusbarStateController = mock(StatusBarStateController.class);
|
mStatusbarStateController = mock(StatusBarStateController.class);
|
||||||
mBypassController = mock(KeyguardBypassController.class);
|
mBypassController = mock(KeyguardBypassController.class);
|
||||||
|
mWakeUpCoordinator = mock(NotificationWakeUpCoordinator.class);
|
||||||
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
|
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
|
||||||
mock(NotificationIconAreaController.class),
|
mock(NotificationIconAreaController.class),
|
||||||
mHeadsUpManager,
|
mHeadsUpManager,
|
||||||
mStatusbarStateController,
|
mStatusbarStateController,
|
||||||
mBypassController,
|
mBypassController,
|
||||||
|
mWakeUpCoordinator,
|
||||||
mHeadsUpStatusBarView,
|
mHeadsUpStatusBarView,
|
||||||
mStackScroller,
|
mStackScroller,
|
||||||
mPanelView,
|
mPanelView,
|
||||||
@@ -153,6 +157,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
|||||||
mHeadsUpManager,
|
mHeadsUpManager,
|
||||||
mStatusbarStateController,
|
mStatusbarStateController,
|
||||||
mBypassController,
|
mBypassController,
|
||||||
|
mWakeUpCoordinator,
|
||||||
mHeadsUpStatusBarView,
|
mHeadsUpStatusBarView,
|
||||||
mStackScroller,
|
mStackScroller,
|
||||||
mPanelView,
|
mPanelView,
|
||||||
|
|||||||
Reference in New Issue
Block a user