Merge "Fixed navigation bar to show itself after creating a new user through keyguard ui." into rvc-dev am: 628f2eeafe am: 313e484fe0
Change-Id: I5456627d4a78d7f5dc7741ef8336920b5ad006e2
This commit is contained in:
@@ -238,10 +238,12 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
|
||||
}
|
||||
|
||||
buildNavBarContent();
|
||||
// If the UI was rebuilt (day/night change) while the keyguard was up we need to
|
||||
// correctly respect that state.
|
||||
// If the UI was rebuilt (day/night change or user change) while the keyguard was up we need
|
||||
// to correctly respect that state.
|
||||
if (mKeyguardStateControllerLazy.get().isShowing()) {
|
||||
mCarNavigationBarController.showAllKeyguardButtons(isDeviceSetupForUser());
|
||||
} else {
|
||||
mCarNavigationBarController.hideAllKeyguardButtons(isDeviceSetupForUser());
|
||||
}
|
||||
|
||||
// Upon restarting the Navigation Bar, CarFacetButtonController should immediately apply the
|
||||
|
||||
@@ -46,8 +46,6 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import dagger.Lazy;
|
||||
|
||||
@RunWith(AndroidTestingRunner.class)
|
||||
@TestableLooper.RunWithLooper
|
||||
@SmallTest
|
||||
@@ -68,12 +66,8 @@ public class CarNavigationBarTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private ButtonSelectionStateListener mButtonSelectionStateListener;
|
||||
@Mock
|
||||
private Lazy<KeyguardStateController> mKeyguardStateControllerLazy;
|
||||
@Mock
|
||||
private KeyguardStateController mKeyguardStateController;
|
||||
@Mock
|
||||
private Lazy<NavigationBarController> mNavigationBarControllerLazy;
|
||||
@Mock
|
||||
private NavigationBarController mNavigationBarController;
|
||||
@Mock
|
||||
private SuperStatusBarViewFactory mSuperStatusBarViewFactory;
|
||||
@@ -89,13 +83,11 @@ public class CarNavigationBarTest extends SysuiTestCase {
|
||||
mCarNavigationBar = new CarNavigationBar(mContext, mCarNavigationBarController,
|
||||
mWindowManager, mDeviceProvisionedController, new CommandQueue(mContext),
|
||||
mAutoHideController, mButtonSelectionStateListener, mHandler,
|
||||
mKeyguardStateControllerLazy, mNavigationBarControllerLazy,
|
||||
() -> mKeyguardStateController, () -> mNavigationBarController,
|
||||
mSuperStatusBarViewFactory, mButtonSelectionStateController);
|
||||
StatusBarWindowView statusBarWindowView = (StatusBarWindowView) LayoutInflater.from(
|
||||
mContext).inflate(R.layout.super_status_bar, /* root= */ null);
|
||||
when(mSuperStatusBarViewFactory.getStatusBarWindowView()).thenReturn(statusBarWindowView);
|
||||
when(mNavigationBarControllerLazy.get()).thenReturn(mNavigationBarController);
|
||||
when(mKeyguardStateControllerLazy.get()).thenReturn(mKeyguardStateController);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
mDependency.injectMockDependency(WindowManager.class);
|
||||
// Needed to inflate top navigation bar.
|
||||
@@ -119,4 +111,44 @@ public class CarNavigationBarTest extends SysuiTestCase {
|
||||
|
||||
verify(mButtonSelectionStateListener).onTaskStackChanged();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void restartNavBars_newUserNotSetupWithKeyguardShowing_showsKeyguardButtons() {
|
||||
ArgumentCaptor<CarDeviceProvisionedController.DeviceProvisionedListener>
|
||||
deviceProvisionedCallbackCaptor = ArgumentCaptor.forClass(
|
||||
CarDeviceProvisionedController.DeviceProvisionedListener.class);
|
||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true);
|
||||
mCarNavigationBar.start();
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
// switching the currentUserSetup value to force restart the navbars.
|
||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(false);
|
||||
verify(mDeviceProvisionedController).addCallback(deviceProvisionedCallbackCaptor.capture());
|
||||
|
||||
deviceProvisionedCallbackCaptor.getValue().onUserSwitched();
|
||||
waitForIdleSync(mHandler);
|
||||
|
||||
verify(mCarNavigationBarController).showAllKeyguardButtons(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void restartNavbars_newUserIsSetupWithKeyguardHidden_hidesKeyguardButtons() {
|
||||
ArgumentCaptor<CarDeviceProvisionedController.DeviceProvisionedListener>
|
||||
deviceProvisionedCallbackCaptor = ArgumentCaptor.forClass(
|
||||
CarDeviceProvisionedController.DeviceProvisionedListener.class);
|
||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true);
|
||||
mCarNavigationBar.start();
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
// switching the currentUserSetup value to force restart the navbars.
|
||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(false);
|
||||
verify(mDeviceProvisionedController).addCallback(deviceProvisionedCallbackCaptor.capture());
|
||||
deviceProvisionedCallbackCaptor.getValue().onUserSwitched();
|
||||
waitForIdleSync(mHandler);
|
||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
|
||||
deviceProvisionedCallbackCaptor.getValue().onUserSetupChanged();
|
||||
waitForIdleSync(mHandler);
|
||||
|
||||
verify(mCarNavigationBarController).hideAllKeyguardButtons(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user