Merge "Address communal callbacks in NotificationPanelViewController."

This commit is contained in:
Bryce Lee
2021-11-20 03:44:44 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 15 deletions

View File

@@ -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();
}

View File

@@ -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);