summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-04-30 20:06:04 +0200
committerChristoph Studer <chstuder@google.com>2014-05-02 12:25:35 +0200
commit037e34c82390281ce8de55e3da99e45efa4a19a5 (patch)
tree79086a1be47c0164f61572cf818d395e4f7e60f2 /packages/SystemUI/src/com
parent36c492cf1af25f23719d2f5738a366db6ce1d362 (diff)
downloadframeworks_base-037e34c82390281ce8de55e3da99e45efa4a19a5.zip
frameworks_base-037e34c82390281ce8de55e3da99e45efa4a19a5.tar.gz
frameworks_base-037e34c82390281ce8de55e3da99e45efa4a19a5.tar.bz2
Fix notification visibility reporting
Require the screen to be on for visibility reporting. Change-Id: I600e2fa2861bddd41ab9f9f0f381d8b1c4946afa
Diffstat (limited to 'packages/SystemUI/src/com')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java44
1 files changed, 31 insertions, 13 deletions
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 545352c..8ad3bb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -379,7 +379,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
private boolean mSettingsStarted;
private boolean mSettingsCancelled;
private boolean mSettingsClosing;
- private int mNotificationPadding;
+ private boolean mVisible;
private final OnChildLocationsChangedListener mOnChildLocationsChangedListener =
new OnChildLocationsChangedListener() {
@@ -719,8 +719,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
// Quick Settings (where available, some restrictions apply)
- mNotificationPadding = mContext.getResources()
- .getDimensionPixelSize(R.dimen.notification_side_padding);
if (mHasQuickSettings) {
// Quick Settings needs a container to survive
mSettingsContainer = (QuickSettingsContainerView)
@@ -2551,12 +2549,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
notifyNavigationBarScreenOn(false);
notifyHeadsUpScreenOn(false);
finishBarAnimations();
+ stopNotificationLogging();
}
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
mScreenOn = true;
// work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
repositionNavigationBar();
notifyNavigationBarScreenOn(true);
+ startNotificationLoggingIfScreenOnAndVisible();
}
else if (ACTION_DEMO.equals(action)) {
Bundle bundle = intent.getExtras();
@@ -2730,22 +2730,40 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
@Override
protected void visibilityChanged(boolean visible) {
+ mVisible = visible;
if (visible) {
- mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
+ startNotificationLoggingIfScreenOnAndVisible();
} else {
- // Report all notifications as invisible and turn down the
- // reporter.
- if (!mCurrentlyVisibleNotifications.isEmpty()) {
- logNotificationVisibilityChanges(
- Collections.<String>emptyList(), mCurrentlyVisibleNotifications);
- mCurrentlyVisibleNotifications.clear();
- }
- mHandler.removeCallbacks(mVisibilityReporter);
- mStackScroller.setChildLocationsChangedListener(null);
+ stopNotificationLogging();
}
super.visibilityChanged(visible);
}
+ private void stopNotificationLogging() {
+ // Report all notifications as invisible and turn down the
+ // reporter.
+ if (!mCurrentlyVisibleNotifications.isEmpty()) {
+ logNotificationVisibilityChanges(
+ Collections.<String>emptyList(), mCurrentlyVisibleNotifications);
+ mCurrentlyVisibleNotifications.clear();
+ }
+ mHandler.removeCallbacks(mVisibilityReporter);
+ mStackScroller.setChildLocationsChangedListener(null);
+ }
+
+ private void startNotificationLoggingIfScreenOnAndVisible() {
+ if (mVisible && mScreenOn) {
+ mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
+ // Some transitions like mScreenOn=false -> mScreenOn=true don't
+ // cause the scroller to emit child location events. Hence generate
+ // one ourselves to guarantee that we're reporting visible
+ // notifications.
+ // (Note that in cases where the scroller does emit events, this
+ // additional event doesn't break anything.)
+ mNotificationLocationsChangedListener.onChildLocationsChanged(mStackScroller);
+ }
+ }
+
private void logNotificationVisibilityChanges(
Collection<String> newlyVisible, Collection<String> noLongerVisible) {
if (newlyVisible.isEmpty() && noLongerVisible.isEmpty()) {