summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java65
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java3
7 files changed, 97 insertions, 79 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
index eca4c8082dfe..0df69a0a1f43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java
@@ -185,6 +185,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
mAlertEntries.put(entry.getKey(), alertEntry);
onAlertEntryAdded(alertEntry);
entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+ entry.setIsAlerting(true);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 387247eb6c5b..8ce9d944b865 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -177,6 +177,7 @@ public final class NotificationEntry extends ListEntry {
@Nullable private Long mPendingAnimationDuration;
private boolean mIsMarkedForUserTriggeredMovement;
private boolean mShelfIconVisible;
+ private boolean mIsAlerting;
/**
* @param sbn the StatusBarNotification from system server
@@ -955,6 +956,14 @@ public final class NotificationEntry extends ListEntry {
mIsMarkedForUserTriggeredMovement = marked;
}
+ public void setIsAlerting(boolean isAlerting) {
+ mIsAlerting = isAlerting;
+ }
+
+ public boolean isAlerting() {
+ return mIsAlerting;
+ }
+
/** Information about a suggestion that is being edited. */
public static class EditedSuggestionInfo {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
index d5e55315ff0a..0302b2b450e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
@@ -81,17 +81,17 @@ public class AmbientState {
private boolean mAppearing;
private float mPulseHeight = MAX_PULSE_HEIGHT;
private float mDozeAmount = 0.0f;
- private HeadsUpManager mHeadUpManager;
private Runnable mOnPulseHeightChangedListener;
private ExpandableNotificationRow mTrackedHeadsUpRow;
private float mAppearFraction;
+ /** Tracks the state from AlertingNotificationManager#hasNotifications() */
+ private boolean mHasAlertEntries;
+
public AmbientState(
Context context,
- @NonNull SectionProvider sectionProvider,
- HeadsUpManager headsUpManager) {
+ @NonNull SectionProvider sectionProvider) {
mSectionProvider = sectionProvider;
- mHeadUpManager = headsUpManager;
reload(context);
}
@@ -393,7 +393,7 @@ public class AmbientState {
}
public boolean hasPulsingNotifications() {
- return mPulsing && mHeadUpManager != null && mHeadUpManager.hasNotifications();
+ return mPulsing && mHasAlertEntries;
}
public void setPulsing(boolean hasPulsing) {
@@ -408,10 +408,7 @@ public class AmbientState {
}
public boolean isPulsing(NotificationEntry entry) {
- if (!mPulsing || mHeadUpManager == null) {
- return false;
- }
- return mHeadUpManager.isAlerting(entry.getKey());
+ return mPulsing && entry.isAlerting();
}
public boolean isPanelTracking() {
@@ -568,4 +565,8 @@ public class AmbientState {
public float getAppearFraction() {
return mAppearFraction;
}
+
+ public void setHasAlertEntries(boolean hasAlertEntries) {
+ mHasAlertEntries = hasAlertEntries;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index b1a9efe40fdb..8a0fcf0d88f3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -92,7 +92,6 @@ import com.android.systemui.Dumpable;
import com.android.systemui.ExpandHelper;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
-import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.CommandQueue;
@@ -102,7 +101,6 @@ import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.NotificationShelfController;
-import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
@@ -132,7 +130,6 @@ import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.row.NotificationSnooze;
import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
-import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.LockscreenGestureLogger.LockscreenUiEvent;
@@ -340,13 +337,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private HashSet<ExpandableView> mClearTransientViewsWhenFinished = new HashSet<>();
private HashSet<Pair<ExpandableNotificationRow, Boolean>> mHeadsUpChangeAnimations
= new HashSet<>();
- private HeadsUpManagerPhone mHeadsUpManager;
private final NotificationRoundnessManager mRoundnessManager;
private boolean mTrackingHeadsUp;
private ScrimController mScrimController;
private boolean mForceNoOverlappingRendering;
private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>();
- private FalsingManager mFalsingManager;
private boolean mAnimationRunning;
private ViewTreeObserver.OnPreDrawListener mRunningAnimationUpdater
= new ViewTreeObserver.OnPreDrawListener() {
@@ -513,6 +508,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private NotificationStackScrollLayoutController mController;
private boolean mKeyguardMediaControllorVisible;
+ private NotificationEntry mTopHeadsUpEntry;
+ private long mNumHeadsUp;
private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener =
new ExpandableView.OnHeightChangedListener() {
@@ -562,8 +559,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
NotificationRoundnessManager notificationRoundnessManager,
DynamicPrivacyController dynamicPrivacyController,
SysuiStatusBarStateController statusbarStateController,
- HeadsUpManagerPhone headsUpManager,
- FalsingManager falsingManager,
NotificationGutsManager notificationGutsManager,
NotificationSectionsManager notificationSectionsManager,
ForegroundServiceSectionController fgsSectionController,
@@ -580,9 +575,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mRoundnessManager = notificationRoundnessManager;
mNotificationGutsManager = notificationGutsManager;
- mHeadsUpManager = headsUpManager;
- mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed);
- mFalsingManager = falsingManager;
mFgsSectionController = fgsSectionController;
mSectionsManager = notificationSectionsManager;
@@ -594,7 +586,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
});
mSections = mSectionsManager.createSectionsForBuckets();
- mAmbientState = new AmbientState(context, mSectionsManager, mHeadsUpManager);
+ mAmbientState = new AmbientState(context, mSectionsManager);
mBgColor = context.getColor(R.color.notification_shade_background_color);
int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
@@ -750,27 +742,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
return false;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
- public RemoteInputController.Delegate createDelegate() {
- return new RemoteInputController.Delegate() {
- public void setRemoteInputActive(NotificationEntry entry,
- boolean remoteInputActive) {
- mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive);
- entry.notifyHeightChanged(true /* needsAnimation */);
- updateFooter();
- }
-
- public void lockScrollTo(NotificationEntry entry) {
- NotificationStackScrollLayout.this.lockScrollTo(entry.getRow());
- }
-
- public void requestDisallowLongPressAndDismiss() {
- requestDisallowLongPress();
- requestDisallowDismiss();
- }
- };
- }
-
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public NotificationSwipeActionHelper getSwipeActionHelper() {
return mSwipeHelper;
@@ -1472,11 +1443,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
*/
@ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int getTopHeadsUpPinnedHeight() {
- NotificationEntry topEntry = mHeadsUpManager.getTopEntry();
- if (topEntry == null) {
+ if (mTopHeadsUpEntry == null) {
return 0;
}
- ExpandableNotificationRow row = topEntry.getRow();
+ ExpandableNotificationRow row = mTopHeadsUpEntry.getRow();
if (row.isChildInGroup()) {
final NotificationEntry groupSummary =
mGroupManager.getGroupSummary(row.getEntry().getSbn());
@@ -1497,7 +1467,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
int visibleNotifCount = getVisibleNotificationCount();
if (mEmptyShadeView.getVisibility() == GONE && visibleNotifCount > 0) {
if (isHeadsUpTransition()
- || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDozing())) {
+ || (mInHeadsUpPinnedMode && !mAmbientState.isDozing())) {
if (mShelf.getVisibility() != GONE && visibleNotifCount > 1) {
appearPosition += mShelf.getIntrinsicHeight() + mPaddingBetweenElements;
}
@@ -1655,9 +1625,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
ExpandableNotificationRow row = (ExpandableNotificationRow) slidingChild;
NotificationEntry entry = row.getEntry();
if (!mIsExpanded && row.isHeadsUp() && row.isPinned()
- && mHeadsUpManager.getTopEntry().getRow() != row
+ && mTopHeadsUpEntry.getRow() != row
&& mGroupManager.getGroupSummary(
- mHeadsUpManager.getTopEntry().getSbn())
+ mTopHeadsUpEntry.getSbn())
!= entry) {
continue;
}
@@ -2285,7 +2255,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
// In current design, it only use the top HUN to treat all of HUNs
// although there are more than one HUNs
int contentHeight = mContentHeight;
- if (!isExpanded() && mHeadsUpManager.hasPinnedHeadsUp()) {
+ if (!isExpanded() && mInHeadsUpPinnedMode) {
contentHeight = mHeadsUpInset + getTopHeadsUpPinnedHeight();
}
int scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight);
@@ -2636,7 +2606,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
false /* shiftPulsingWithFirst */);
minTopPosition = firstVisibleSection.getBounds().top;
}
- boolean shiftPulsingWithFirst = mHeadsUpManager.getAllEntries().count() <= 1
+ boolean shiftPulsingWithFirst = mNumHeadsUp <= 1
&& (mAmbientState.isDozing()
|| (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard));
for (NotificationSection section : mSections) {
@@ -3511,7 +3481,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
// Only animate if we still have pinned heads up, otherwise we just have the
// regular collapse animation of the lock screen
|| (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard()
- && mHeadsUpManager.hasPinnedHeadsUp());
+ && mInHeadsUpPinnedMode);
if (performDisappearAnimation && !isHeadsUp) {
type = row.wasJustClicked()
? AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
@@ -5811,23 +5781,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mCurrentUserId = userId;
}
- void onMenuShown(View row) {
- mSwipeHelper.onMenuShown(row);
- }
-
- void onMenuReset(View row) {
- View translatingParentView = mSwipeHelper.getTranslatingParentView();
- if (translatingParentView != null && row == translatingParentView) {
- mSwipeHelper.clearExposedMenuView();
- mSwipeHelper.clearTranslatingParentView();
- if (row instanceof ExpandableNotificationRow) {
- mHeadsUpManager.setMenuShown(
- ((ExpandableNotificationRow) row).getEntry(), false);
-
- }
- }
- }
-
void addSwipedOutView(View v) {
mSwipedOutViews.add(v);
}
@@ -5840,6 +5793,15 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mAmbientState.onDragFinished(view);
}
+ void setTopHeadsUpEntry(NotificationEntry topEntry) {
+ mTopHeadsUpEntry = topEntry;
+ }
+
+ void setNumHeadsUp(long numHeadsUp) {
+ mNumHeadsUp = numHeadsUp;
+ mAmbientState.setHasAlertEntries(numHeadsUp > 0);
+ }
+
/**
* A listener that is notified when the empty space below the notifications is clicked on
*/
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 73b4cad4ced5..b9fc5781def4 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
@@ -70,6 +70,7 @@ import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
+import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.tuner.TunerService;
@@ -110,6 +111,7 @@ public class NotificationStackScrollLayoutController {
private NotificationStackScrollLayout mView;
private boolean mFadeNotificationsOnDismiss;
+ private NotificationSwipeHelper mSwipeHelper;
private final NotificationListContainerImpl mNotificationListContainer =
new NotificationListContainerImpl();
@@ -217,7 +219,16 @@ public class NotificationStackScrollLayoutController {
@Override
public void onMenuReset(View row) {
- mView.onMenuReset(row);
+ View translatingParentView = mSwipeHelper.getTranslatingParentView();
+ if (translatingParentView != null && row == translatingParentView) {
+ mSwipeHelper.clearExposedMenuView();
+ mSwipeHelper.clearTranslatingParentView();
+ if (row instanceof ExpandableNotificationRow) {
+ mHeadsUpManager.setMenuShown(
+ ((ExpandableNotificationRow) row).getEntry(), false);
+
+ }
+ }
}
@Override
@@ -228,7 +239,7 @@ public class NotificationStackScrollLayoutController {
.setCategory(MetricsEvent.ACTION_REVEAL_GEAR)
.setType(MetricsEvent.TYPE_ACTION));
mHeadsUpManager.setMenuShown(notificationRow.getEntry(), true);
- mView.onMenuShown(row);
+ mSwipeHelper.onMenuShown(row);
mNotificationGutsManager.closeAndSaveGuts(true /* removeLeavebehind */,
false /* force */, false /* removeControls */, -1 /* x */, -1 /* y */,
false /* resetMenu */);
@@ -438,7 +449,31 @@ public class NotificationStackScrollLayoutController {
}
};
- private NotificationSwipeHelper mSwipeHelper;
+ private final OnHeadsUpChangedListener mOnHeadsUpChangedListener =
+ new OnHeadsUpChangedListener() {
+ @Override
+ public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
+ mView.setInHeadsUpPinnedMode(inPinnedMode);
+ }
+
+ @Override
+ public void onHeadsUpPinned(NotificationEntry entry) {
+
+ }
+
+ @Override
+ public void onHeadsUpUnPinned(NotificationEntry entry) {
+
+ }
+
+ @Override
+ public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
+ long numEntries = mHeadsUpManager.getAllEntries().count();
+ NotificationEntry topEntry = mHeadsUpManager.getTopEntry();
+ mView.setNumHeadsUp(numEntries);
+ mView.setTopHeadsUpEntry(topEntry);
+ }
+ };
@Inject
public NotificationStackScrollLayoutController(
@@ -496,6 +531,8 @@ public class NotificationStackScrollLayoutController {
mSwipeHelper);
mHeadsUpManager.addListener(mNotificationRoundnessManager); // TODO: why is this here?
+ mHeadsUpManager.addListener(mOnHeadsUpChangedListener);
+ mHeadsUpManager.setAnimationStateHandler(mView::setHeadsUpGoingAwayAnimationsAllowed);
mDynamicPrivacyController.addListener(mDynamicPrivacyControllerListener);
mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener);
@@ -910,7 +947,23 @@ public class NotificationStackScrollLayoutController {
}
public RemoteInputController.Delegate createDelegate() {
- return mView.createDelegate();
+ return new RemoteInputController.Delegate() {
+ public void setRemoteInputActive(NotificationEntry entry,
+ boolean remoteInputActive) {
+ mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive);
+ entry.notifyHeightChanged(true /* needsAnimation */);
+ updateFooter();
+ }
+
+ public void lockScrollTo(NotificationEntry entry) {
+ mView.lockScrollTo(entry.getRow());
+ }
+
+ public void requestDisallowLongPressAndDismiss() {
+ mView.requestDisallowLongPress();
+ mView.requestDisallowDismiss();
+ }
+ };
}
public void updateSectionBoundaries(String reason) {
@@ -966,10 +1019,6 @@ public class NotificationStackScrollLayoutController {
return mView.getFirstChildNotGone();
}
- public void setInHeadsUpPinnedMode(boolean inPinnedMode) {
- mView.setInHeadsUpPinnedMode(inPinnedMode);
- }
-
public void generateHeadsUpAnimation(NotificationEntry entry, boolean isHeadsUp) {
mView.generateHeadsUpAnimation(entry, isHeadsUp);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 8750a02ed5b3..148029758a05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -3546,7 +3546,6 @@ public class NotificationPanelViewController extends PanelViewController {
private class MyOnHeadsUpChangedListener implements OnHeadsUpChangedListener {
@Override
public void onHeadsUpPinnedModeChanged(final boolean inPinnedMode) {
- mNotificationStackScrollLayoutController.setInHeadsUpPinnedMode(inPinnedMode);
if (inPinnedMode) {
mHeadsUpExistenceChangedRunnable.run();
updateNotificationTranslucency();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index fa9ea6b1ea10..beb0cc2809ae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -122,7 +122,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
@Mock private EmptyShadeView mEmptyShadeView;
@Mock private NotificationRemoteInputManager mRemoteInputManager;
@Mock private RemoteInputController mRemoteInputController;
- @Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private MetricsLogger mMetricsLogger;
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
@Mock private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider;
@@ -203,8 +202,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mNotificationRoundnessManager,
mock(DynamicPrivacyController.class),
mStatusBarStateController,
- mHeadsUpManager,
- new FalsingManagerFake(),
mock(NotificationGutsManager.class),
mNotificationSectionsManager,
mock(ForegroundServiceSectionController.class),