Made heads up persist through unlocks
The heads up now persists through unlocking. Bug: 130327302 Test: get Heads up on lockscreen, unlock with face Change-Id: Ie61d5da33024418f1214e70c414bd643af176e71
This commit is contained in:
@@ -37,8 +37,10 @@ import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
|
||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController
|
||||
import com.android.systemui.statusbar.phone.ShadeController
|
||||
import com.android.systemui.statusbar.policy.HeadsUpManager
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
@@ -51,7 +53,8 @@ import kotlin.math.max
|
||||
class PulseExpansionHandler @Inject
|
||||
constructor(context: Context,
|
||||
private val wakeUpCoordinator: NotificationWakeUpCoordinator,
|
||||
private val bypassController: KeyguardBypassController) : Gefingerpoken {
|
||||
private val bypassController: KeyguardBypassController,
|
||||
private val headsUpManager: HeadsUpManagerPhone) : Gefingerpoken {
|
||||
companion object {
|
||||
private val RUBBERBAND_FACTOR_STATIC = 0.25f
|
||||
private val SPRING_BACK_ANIMATION_LENGTH_MS = 375
|
||||
@@ -67,9 +70,12 @@ constructor(context: Context,
|
||||
val changed = field != value
|
||||
field = value
|
||||
bypassController.isPulseExpanding = value
|
||||
if (changed && !value && !leavingLockscreen) {
|
||||
bypassController.maybePerformPendingUnlock()
|
||||
pulseExpandAbortListener?.run()
|
||||
if (changed) {
|
||||
headsUpManager.unpinAll(true /* userUnPinned */)
|
||||
if (!value && !leavingLockscreen) {
|
||||
bypassController.maybePerformPendingUnlock()
|
||||
pulseExpandAbortListener?.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
var leavingLockscreen: Boolean = false
|
||||
|
||||
@@ -66,6 +66,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
@VisibleForTesting
|
||||
final int mExtensionTime;
|
||||
private final StatusBarStateController mStatusBarStateController;
|
||||
private final KeyguardBypassController mBypassController;
|
||||
private View mStatusBarWindowView;
|
||||
private NotificationGroupManager mGroupManager;
|
||||
private VisualStabilityManager mVisualStabilityManager;
|
||||
@@ -113,7 +114,8 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
|
||||
@Inject
|
||||
public HeadsUpManagerPhone(@NonNull final Context context,
|
||||
StatusBarStateController statusBarStateController) {
|
||||
StatusBarStateController statusBarStateController,
|
||||
KeyguardBypassController bypassController) {
|
||||
super(context);
|
||||
Resources resources = mContext.getResources();
|
||||
mAutoDismissNotificationDecayDozing = resources.getInteger(
|
||||
@@ -121,6 +123,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time);
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mStatusBarStateController.addCallback(this);
|
||||
mBypassController = bypassController;
|
||||
|
||||
initResources();
|
||||
}
|
||||
@@ -412,8 +415,11 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
|
||||
@Override
|
||||
protected boolean shouldHeadsUpBecomePinned(NotificationEntry entry) {
|
||||
return mStatusBarState != StatusBarState.KEYGUARD && !mIsExpanded
|
||||
|| super.shouldHeadsUpBecomePinned(entry);
|
||||
boolean pin = mStatusBarState == StatusBarState.SHADE && !mIsExpanded;
|
||||
if (mBypassController.getBypassEnabled()) {
|
||||
pin |= mStatusBarState == StatusBarState.KEYGUARD;
|
||||
}
|
||||
return pin || super.shouldHeadsUpBecomePinned(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -434,18 +434,6 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, State
|
||||
return sbn.isGroup() && !sbn.getNotification().isGroupSummary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpPinned(NotificationEntry entry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpUnPinned(NotificationEntry entry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
|
||||
onAlertStateChanged(entry, isHeadsUp);
|
||||
|
||||
@@ -356,6 +356,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
private Runnable mOnReinflationListener;
|
||||
private int mDarkIconSize;
|
||||
private int mHeadsUpInset;
|
||||
private boolean mHeadsUpPinnedMode;
|
||||
|
||||
@Inject
|
||||
public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
|
||||
@@ -2029,7 +2030,8 @@ public class NotificationPanelView extends PanelView implements
|
||||
!mHeadsUpManager.hasPinnedHeadsUp()) {
|
||||
alpha = getFadeoutAlpha();
|
||||
}
|
||||
if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning) {
|
||||
if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning
|
||||
&& !mKeyguardBypassController.getBypassEnabled()) {
|
||||
alpha *= mClockPositionResult.clockAlpha;
|
||||
}
|
||||
mNotificationStackScroller.setAlpha(alpha);
|
||||
@@ -2750,16 +2752,26 @@ public class NotificationPanelView extends PanelView implements
|
||||
mHeadsUpExistenceChangedRunnable);
|
||||
}
|
||||
updateGestureExclusionRect();
|
||||
mHeadsUpPinnedMode = inPinnedMode;
|
||||
updateHeadsUpVisibility();
|
||||
}
|
||||
|
||||
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
|
||||
mHeadsUpAnimatingAway = headsUpAnimatingAway;
|
||||
mNotificationStackScroller.setHeadsUpAnimatingAway(headsUpAnimatingAway);
|
||||
updateHeadsUpVisibility();
|
||||
}
|
||||
|
||||
private void updateHeadsUpVisibility() {
|
||||
((PhoneStatusBarView) mBar).setHeadsUpVisible(mHeadsUpAnimatingAway || mHeadsUpPinnedMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpPinned(NotificationEntry entry) {
|
||||
mNotificationStackScroller.generateHeadsUpAnimation(entry.getHeadsUpAnimationView(), true);
|
||||
if (!isOnKeyguard()) {
|
||||
mNotificationStackScroller.generateHeadsUpAnimation(entry.getHeadsUpAnimationView(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2768,7 +2780,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
// When we're unpinning the notification via active edge they remain heads-upped,
|
||||
// we need to make sure that an animation happens in this case, otherwise the notification
|
||||
// will stick to the top without any interaction.
|
||||
if (isFullyCollapsed() && entry.isRowHeadsUp()) {
|
||||
if (isFullyCollapsed() && entry.isRowHeadsUp() && !isOnKeyguard()) {
|
||||
mNotificationStackScroller.generateHeadsUpAnimation(
|
||||
entry.getHeadsUpAnimationView(), false);
|
||||
entry.setHeadsUpIsVisible();
|
||||
@@ -2891,7 +2903,8 @@ public class NotificationPanelView extends PanelView implements
|
||||
|
||||
@Override
|
||||
protected boolean isPanelVisibleBecauseOfHeadsUp() {
|
||||
return mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway;
|
||||
return (mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway)
|
||||
&& mBarState == StatusBarState.SHADE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,8 +107,12 @@ public abstract class PanelBar extends FrameLayout {
|
||||
return mExpanded;
|
||||
}
|
||||
|
||||
private void updateVisibility() {
|
||||
mPanel.setVisibility(mExpanded || mBouncerShowing ? VISIBLE : INVISIBLE);
|
||||
protected void updateVisibility() {
|
||||
mPanel.setVisibility(shouldPanelBeVisible() ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
|
||||
protected boolean shouldPanelBeVisible() {
|
||||
return mExpanded || mBouncerShowing;
|
||||
}
|
||||
|
||||
public boolean panelEnabled() {
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -82,6 +83,7 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
* Draw this many pixels into the left/right side of the cutout to optimally use the space
|
||||
*/
|
||||
private int mCutoutSideNudge = 0;
|
||||
private boolean mHeadsUpVisible;
|
||||
|
||||
public PhoneStatusBarView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -379,4 +381,14 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setHeadsUpVisible(boolean headsUpVisible) {
|
||||
mHeadsUpVisible = headsUpVisible;
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPanelBeVisible() {
|
||||
return mHeadsUpVisible || super.shouldPanelBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1537,10 +1537,16 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!mNotificationPanel.isFullyCollapsed() || mNotificationPanel.isTracking()) {
|
||||
boolean bypassKeyguard = mKeyguardBypassController.getBypassEnabled()
|
||||
&& mState == StatusBarState.KEYGUARD;
|
||||
if (!mNotificationPanel.isFullyCollapsed() || mNotificationPanel.isTracking()
|
||||
|| bypassKeyguard) {
|
||||
// We are currently tracking or is open and the shade doesn't need to be kept
|
||||
// open artificially.
|
||||
mStatusBarWindowController.setHeadsUpShowing(false);
|
||||
if (bypassKeyguard) {
|
||||
mStatusBarWindowController.setForceStatusBarVisible(false);
|
||||
}
|
||||
} else {
|
||||
// we need to keep the panel open artificially, let's wait until the animation
|
||||
// is finished.
|
||||
@@ -1556,15 +1562,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpPinned(NotificationEntry entry) {
|
||||
dismissVolumeDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpUnPinned(NotificationEntry entry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
|
||||
mEntryManager.updateNotifications();
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
|
||||
import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationContentInflaterTest;
|
||||
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.NotificationGroupManager;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||
|
||||
@@ -78,7 +79,8 @@ public class NotificationTestHelper {
|
||||
mInstrumentation = InstrumentationRegistry.getInstrumentation();
|
||||
StatusBarStateController stateController = mock(StatusBarStateController.class);
|
||||
mGroupManager = new NotificationGroupManager(stateController);
|
||||
mHeadsUpManager = new HeadsUpManagerPhone(mContext, stateController);
|
||||
mHeadsUpManager = new HeadsUpManagerPhone(mContext, stateController,
|
||||
mock(KeyguardBypassController.class));
|
||||
mHeadsUpManager.setUp(null, mGroupManager, null, null);
|
||||
mGroupManager.setHeadsUpManager(mHeadsUpManager);
|
||||
}
|
||||
|
||||
@@ -57,14 +57,16 @@ public class HeadsUpManagerPhoneTest extends AlertingNotificationManagerTest {
|
||||
@Mock private VisualStabilityManager mVSManager;
|
||||
@Mock private StatusBar mBar;
|
||||
@Mock private StatusBarStateController mStatusBarStateController;
|
||||
@Mock private KeyguardBypassController mBypassController;
|
||||
private boolean mLivesPastNormalTime;
|
||||
|
||||
private final class TestableHeadsUpManagerPhone extends HeadsUpManagerPhone {
|
||||
TestableHeadsUpManagerPhone(Context context, View statusBarWindowView,
|
||||
NotificationGroupManager groupManager, StatusBar bar,
|
||||
VisualStabilityManager vsManager,
|
||||
StatusBarStateController statusBarStateController) {
|
||||
super(context, statusBarStateController);
|
||||
StatusBarStateController statusBarStateController,
|
||||
KeyguardBypassController keyguardBypassController) {
|
||||
super(context, statusBarStateController, keyguardBypassController);
|
||||
setUp(statusBarWindowView, groupManager, bar, vsManager);
|
||||
mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME;
|
||||
mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME;
|
||||
@@ -84,7 +86,7 @@ public class HeadsUpManagerPhoneTest extends AlertingNotificationManagerTest {
|
||||
.thenReturn(TEST_AUTO_DISMISS_TIME);
|
||||
when(mVSManager.isReorderingAllowed()).thenReturn(true);
|
||||
mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mStatusBarWindowView,
|
||||
mGroupManager, mBar, mVSManager, mStatusBarStateController);
|
||||
mGroupManager, mBar, mVSManager, mStatusBarStateController, mBypassController);
|
||||
super.setUp();
|
||||
mHeadsUpManager.mHandler = mTestHandler;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class NotificationPanelViewTest extends SysuiTestCase {
|
||||
new StatusBarStateControllerImpl(),
|
||||
bypassController);
|
||||
PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator,
|
||||
bypassController);
|
||||
bypassController, mHeadsUpManager);
|
||||
mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler,
|
||||
bypassController);
|
||||
mNotificationPanelView.setHeadsUpManager(mHeadsUpManager);
|
||||
|
||||
Reference in New Issue
Block a user