Merge changes I07dae5fb,Ibe0100bc

* changes:
  Tidy up PhoneStatusBar deeply nested Runnables
  [statusbar] Use the right settings observer
This commit is contained in:
TreeHugger Robot
2016-09-09 07:40:56 +00:00
committed by Android (Google) Code Review
2 changed files with 42 additions and 38 deletions

View File

@@ -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(

View File

@@ -4664,44 +4664,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();
}
}
});
}
}
};