summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-08-05 17:10:43 +0000
committerJorim Jaggi <jjaggi@google.com>2014-08-05 17:10:43 +0000
commitf641174eb9a41c9d340e350624533b36e265402f (patch)
treef3473eee66126416eeb67d1d71487480b831f9b0 /packages/SystemUI/src/com/android
parent62a7c831d54d0a552f059e70176ccf7ac77e57f4 (diff)
downloadframeworks_base-f641174eb9a41c9d340e350624533b36e265402f.zip
frameworks_base-f641174eb9a41c9d340e350624533b36e265402f.tar.gz
frameworks_base-f641174eb9a41c9d340e350624533b36e265402f.tar.bz2
Revert "Clean up hiden notifications on Keyguard handling"
This reverts commit d9267cae958b572b715d22a4905b18749a369c9f. Too much performance regression - need to figure out something else. Change-Id: I2d399add74402e1c036235ec095a053a6d5b828e
Diffstat (limited to 'packages/SystemUI/src/com/android')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java70
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java14
3 files changed, 62 insertions, 57 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 12c3dd5..af92e49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1364,9 +1364,13 @@ public abstract class BaseStatusBar extends SystemUI implements
* Updates expanded, dimmed and locked states of notification rows.
*/
protected void updateRowStates() {
+ int maxKeyguardNotifications = getMaxKeyguardNotifications();
+ mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
+
ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
final int N = activeNotifications.size();
+ int visibleNotifications = 0;
boolean onKeyguard = mState == StatusBarState.KEYGUARD;
for (int i = 0; i < N; i++) {
NotificationData.Entry entry = activeNotifications.get(i);
@@ -1379,7 +1383,38 @@ public abstract class BaseStatusBar extends SystemUI implements
entry.row.setSystemExpanded(top);
}
}
+ boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
+ if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications
+ || !showOnKeyguard)) {
+ entry.row.setVisibility(View.GONE);
+ if (showOnKeyguard) {
+ mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
+ }
+ } else {
+ boolean wasGone = entry.row.getVisibility() == View.GONE;
+ entry.row.setVisibility(View.VISIBLE);
+ if (wasGone) {
+ // notify the scroller of a child addition
+ mStackScroller.generateAddAnimation(entry.row, true /* fromMoreCard */);
+ }
+ visibleNotifications++;
+ }
}
+
+ if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
+ mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
+ } else {
+ mKeyguardIconOverflowContainer.setVisibility(View.GONE);
+ }
+
+ mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer,
+ mStackScroller.getChildCount() - 3);
+ mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 2);
+ mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 1);
+ }
+
+ private boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
+ return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey());
}
protected void setZenMode(int mode) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index e2a9702..ae7d500 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -158,7 +158,6 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
@@ -338,8 +337,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
: null;
private int mNavigationIconHints = 0;
- private final HashSet<View> mOverflowNotifications = new HashSet<>();
- private final HashSet<View> mOldOverflowNotifications = new HashSet<>();
// ensure quick settings is disabled until the current user makes it through the setup wizard
private boolean mUserSetup = false;
@@ -1358,33 +1355,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private void updateNotificationShade() {
if (mStackScroller == null) return;
- int speedbumpIndex = -1;
- int maxKeyguardNotifications = getMaxKeyguardNotifications();
- mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
- int visibleNotifications = 0;
- boolean onKeyguard = mState == StatusBarState.KEYGUARD;
- mOldOverflowNotifications.clear();
- mOldOverflowNotifications.addAll(mOverflowNotifications);
-
ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
- ArrayList<View> toShow = new ArrayList<>(activeNotifications.size());
+ ArrayList<ExpandableNotificationRow> toShow = new ArrayList<>(activeNotifications.size());
final int N = activeNotifications.size();
for (int i=0; i<N; i++) {
Entry ent = activeNotifications.get(i);
int vis = ent.notification.getNotification().visibility;
- // Decide whether to hide to notification because of Keyguard showing.
- boolean showOnKeyguard = mShowLockscreenNotifications
- && !mNotificationData.isAmbient(ent.key);
- if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications
- || !showOnKeyguard)) {
- if (showOnKeyguard) {
- mKeyguardIconOverflowContainer.getIconsView().addNotification(ent);
- mOverflowNotifications.add(ent.row);
- }
- continue;
- }
-
// Display public version of the notification if we need to redact.
final boolean hideSensitive =
!userAllowsPrivateNotificationsInPublic(ent.notification.getUserId());
@@ -1402,23 +1379,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
toShow.add(ent.row);
- visibleNotifications++;
-
- // Handle speed bump.
- if (speedbumpIndex == -1 && mNotificationData.isAmbient(ent.key)) {
- speedbumpIndex = visibleNotifications-1;
- }
- }
-
- if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
- toShow.add(mKeyguardIconOverflowContainer);
}
ArrayList<View> toRemove = new ArrayList<View>();
for (int i=0; i< mStackScroller.getChildCount(); i++) {
View child = mStackScroller.getChildAt(i);
- if ((child instanceof ExpandableNotificationRow
- || child == mKeyguardIconOverflowContainer) && !toShow.contains(child)) {
+ if (!toShow.contains(child) && child instanceof ExpandableNotificationRow) {
toRemove.add(child);
}
}
@@ -1430,9 +1396,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
View v = toShow.get(i);
if (v.getParent() == null) {
mStackScroller.addView(v);
- if (mOldOverflowNotifications.contains(v)) {
- mStackScroller.notifyAddFromMoreCard(v);
- }
}
}
@@ -1459,15 +1422,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
j++;
}
updateRowStates();
-
- mStackScroller.changeViewPosition(mEmptyShadeView,
- mStackScroller.getChildCount() - 1);
- mStackScroller.changeViewPosition(mDismissView,
- mStackScroller.getChildCount() - 2);
- mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer,
- mStackScroller.getChildCount() - 3);
- mStackScroller.updateSpeedBumpIndex(speedbumpIndex);
-
+ updateSpeedbump();
updateClearAll();
updateEmptyShadeView();
@@ -1489,6 +1444,23 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mNotificationPanel.setShadeEmpty(showEmptyShade);
}
+ private void updateSpeedbump() {
+ int speedbumpIndex = -1;
+ int currentIndex = 0;
+ ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
+ final int N = activeNotifications.size();
+ for (int i = 0; i < N; i++) {
+ Entry entry = activeNotifications.get(i);
+ if (entry.row.getVisibility() != View.GONE &&
+ mNotificationData.isAmbient(entry.key)) {
+ speedbumpIndex = currentIndex;
+ break;
+ }
+ currentIndex++;
+ }
+ mStackScroller.updateSpeedBumpIndex(speedbumpIndex);
+ }
+
@Override
protected void updateNotifications() {
// TODO: Move this into updateNotificationIcons()?
@@ -2999,7 +2971,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
repositionNavigationBar();
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
updateShowSearchHoldoff();
- updateNotificationShade();
+ updateRowStates();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 6c6bd30..fcca5fa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -1520,7 +1520,7 @@ public class NotificationStackScrollLayout extends ViewGroup
super.onViewAdded(child);
mStackScrollAlgorithm.notifyChildrenChanged(this);
((ExpandableView) child).setOnHeightChangedListener(this);
- generateAddAnimation(child);
+ generateAddAnimation(child, false /* fromMoreCard */);
}
public void setAnimationsEnabled(boolean animationsEnabled) {
@@ -1535,21 +1535,19 @@ public class NotificationStackScrollLayout extends ViewGroup
* Generate an animation for an added child view.
*
* @param child The view to be added.
+ * @param fromMoreCard Whether this add is coming from the "more" card on lockscreen.
*/
- private void generateAddAnimation(View child) {
+ public void generateAddAnimation(View child, boolean fromMoreCard) {
if (mIsExpanded && mAnimationsEnabled && !mChangePositionInProgress) {
// Generate Animations
mChildrenToAddAnimated.add(child);
+ if (fromMoreCard) {
+ mFromMoreCardAdditions.add(child);
+ }
mNeedsAnimation = true;
}
}
- public void notifyAddFromMoreCard(View v) {
- if (mChildrenToAddAnimated.contains(v)) {
- mFromMoreCardAdditions.add(v);
- }
- }
-
/**
* Change the position of child to a new location
*