From 9c5799c46e5eda7abb8db682db1e5fe294f80e9d Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Fri, 26 Aug 2016 15:12:22 +0100 Subject: [PATCH 1/2] [statusbar] Use the right settings observer Not sure why there are two of them -- but if there are two of them then we should be using the one that responds to SHOW_NOTIFICATIONS events. Change-Id: Ibe0100bc767fbbad41494c6ddada07590942136c --- .../src/com/android/systemui/statusbar/BaseStatusBar.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a6536a83183b4..75b9417467f70 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -309,6 +309,7 @@ public abstract class BaseStatusBar extends SystemUI implements mUsersAllowingPrivateNotifications.clear(); mUsersAllowingNotifications.clear(); // ... and refresh all the notifications + updateLockscreenNotificationSetting(); updateNotifications(); } }; @@ -714,7 +715,7 @@ public abstract class BaseStatusBar extends SystemUI implements mSettingsObserver); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS), false, - mSettingsObserver, + mLockscreenSettingsObserver, UserHandle.USER_ALL); if (ENABLE_LOCK_SCREEN_ALLOW_REMOTE_INPUT) { mContext.getContentResolver().registerContentObserver( From a6f04afbc9b944ac5e4e5d4b846d173bba0c27c1 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Wed, 31 Aug 2016 13:56:46 +0100 Subject: [PATCH 2/2] Tidy up PhoneStatusBar deeply nested Runnables Change-Id: I07dae5fbe8360e467169e7d2d61492a804bcaf41 --- .../statusbar/phone/PhoneStatusBar.java | 77 ++++++++++--------- 1 file changed, 40 insertions(+), 37 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 d2bb40565ec4d..fc3b024541333 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -4654,44 +4654,47 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, final Runnable clickPendingViewRunnable = new Runnable() { @Override public void run() { - if (mPendingWorkRemoteInputView != null) { - final View pendingWorkRemoteInputView = mPendingWorkRemoteInputView; - ViewParent p = pendingWorkRemoteInputView.getParent(); - while (p != null) { - if (p instanceof ExpandableNotificationRow) { - final ExpandableNotificationRow row = (ExpandableNotificationRow) p; - ViewParent viewParent = row.getParent(); - if (viewParent instanceof NotificationStackScrollLayout) { - final NotificationStackScrollLayout scrollLayout = - (NotificationStackScrollLayout) viewParent; - row.makeActionsVisibile(); - row.post(new Runnable() { - @Override - public void run() { - final Runnable finishScrollingCallback = new Runnable() - { - @Override - public void run() { - mPendingWorkRemoteInputView.callOnClick(); - mPendingWorkRemoteInputView = null; - scrollLayout.setFinishScrollingCallback(null); - } - }; - if (scrollLayout.scrollTo(row)) { - // It scrolls! So call it when it's finished. - scrollLayout.setFinishScrollingCallback( - finishScrollingCallback); - } else { - // It does not scroll, so call it now! - finishScrollingCallback.run(); - } - } - }); - } - break; - } - p = p.getParent(); + final View pendingWorkRemoteInputView = mPendingWorkRemoteInputView; + if (pendingWorkRemoteInputView == null) { + return; + } + + // Climb up the hierarchy until we get to the container for this row. + ViewParent p = pendingWorkRemoteInputView.getParent(); + while (!(p instanceof ExpandableNotificationRow)) { + if (p == null) { + return; } + p = p.getParent(); + } + + final ExpandableNotificationRow row = (ExpandableNotificationRow) p; + ViewParent viewParent = row.getParent(); + if (viewParent instanceof NotificationStackScrollLayout) { + final NotificationStackScrollLayout scrollLayout = + (NotificationStackScrollLayout) viewParent; + row.makeActionsVisibile(); + row.post(new Runnable() { + @Override + public void run() { + final Runnable finishScrollingCallback = new Runnable() { + @Override + public void run() { + mPendingWorkRemoteInputView.callOnClick(); + mPendingWorkRemoteInputView = null; + scrollLayout.setFinishScrollingCallback(null); + } + }; + if (scrollLayout.scrollTo(row)) { + // It scrolls! So call it when it's finished. + scrollLayout.setFinishScrollingCallback( + finishScrollingCallback); + } else { + // It does not scroll, so call it now! + finishScrollingCallback.run(); + } + } + }); } } };