diff options
| author | 2021-11-20 03:44:44 +0000 | |
|---|---|---|
| committer | 2021-11-20 03:44:44 +0000 | |
| commit | fd4dda192c365290af6b79bcb561744b4b081e74 (patch) | |
| tree | 56e366269694416f493a1a9b97fc8dc35cb3bfc6 | |
| parent | 2e8ec6384c20f40a6837ecb5ec83ffa2e6ad20d5 (diff) | |
| parent | b1c3b17ea4bb8a351d7f04fb48f2b7be62191edf (diff) | |
Merge "Address communal callbacks in NotificationPanelViewController."
2 files changed, 14 insertions, 15 deletions
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 a9753acc2de0..16aac4d765a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -506,23 +506,11 @@ public class NotificationPanelViewController extends PanelViewController { mPanelAlphaAnimator.getProperty(), Interpolators.ALPHA_IN); private final NotificationEntryManager mEntryManager; - private final CommunalSourceMonitor.Callback mCommunalSourceMonitorCallback = - new CommunalSourceMonitor.Callback() { - @Override - public void onSourceAvailable(WeakReference<CommunalSource> source) { - setCommunalSource(source); - } - }; + private final CommunalSourceMonitor.Callback mCommunalSourceMonitorCallback; private WeakReference<CommunalSource> mCommunalSource; - private final CommunalSource.Callback mCommunalSourceCallback = - new CommunalSource.Callback() { - @Override - public void onDisconnected() { - setCommunalSource(null /*source*/); - } - }; + private final CommunalSource.Callback mCommunalSourceCallback; private final CommandQueue mCommandQueue; private final NotificationLockscreenUserManager mLockscreenUserManager; @@ -904,6 +892,15 @@ public class NotificationPanelViewController extends PanelViewController { mMaxKeyguardNotifications = resources.getInteger(R.integer.keyguard_max_notification_count); mKeyguardUnfoldTransition = unfoldComponent.map(c -> c.getKeyguardUnfoldTransition()); + + mCommunalSourceCallback = () -> { + mUiExecutor.execute(() -> setCommunalSource(null /*source*/)); + }; + + mCommunalSourceMonitorCallback = (source) -> { + mUiExecutor.execute(() -> setCommunalSource(source)); + }; + updateUserSwitcherFlags(); onFinishInflate(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java index 81ddc670745b..270c64ddfa7a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java @@ -358,6 +358,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { private NotificationsQuickSettingsContainer mNotificationContainerParent; private List<View.OnAttachStateChangeListener> mOnAttachStateChangeListeners; private FalsingManagerFake mFalsingManager = new FalsingManagerFake(); + private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock()); @Before public void setup() { @@ -511,7 +512,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mQuickAccessWalletController, mQrCodeScannerController, mRecordingController, - new FakeExecutor(new FakeSystemClock()), + mExecutor, mSecureSettings, mSplitShadeHeaderController, mUnlockedScreenOffAnimationController, @@ -936,6 +937,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(WeakReference.class); monitorCallback.getValue().onSourceAvailable(new WeakReference<>(mCommunalSource)); + mExecutor.runAllReady(); verify(mCommunalHostViewController).show(sourceCapture.capture()); assertThat(sourceCapture.getValue().get()).isEqualTo(mCommunalSource); |