Merge "Update time format" into sc-dev am: 20da155df4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14847409

Change-Id: I081d52fbc571251be6883602db9de2cff9c4e947
This commit is contained in:
Matt Pietal
2021-06-07 13:26:00 +00:00
committed by Automerger Merge Worker
3 changed files with 33 additions and 1 deletions

View File

@@ -342,7 +342,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
}
}
void refreshFormat(String timeFormat) {
void refreshFormat() {
if (mClockViewController != null) {
mClockViewController.refreshFormat();
mLargeClockViewController.refreshFormat();

View File

@@ -286,6 +286,11 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
refreshTime();
}
@Override
public void onTimeFormatChanged(String timeFormat) {
mKeyguardClockSwitchController.refreshFormat();
}
@Override
public void onTimeZoneChanged(TimeZone timeZone) {
mKeyguardClockSwitchController.updateTimeZone(timeZone);
@@ -313,6 +318,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
@Override
public void onUserSwitchComplete(int userId) {
mKeyguardClockSwitchController.refreshFormat();
mView.updateOwnerInfo();
mView.updateLogoutView(shouldShowLogout());
}

View File

@@ -32,6 +32,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -59,6 +61,8 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {
SmartspaceTransitionController mSmartSpaceTransitionController;
@Mock
UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
@Captor
private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallbackCaptor;
private KeyguardStatusViewController mController;
@@ -90,4 +94,26 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {
mController.dozeTimeTick();
verify(mKeyguardClockSwitchController).refresh();
}
@Test
public void timeFormatUpdateNotifiesClockSwitchController() {
mController.onViewAttached();
verify(mKeyguardUpdateMonitor).registerCallback(
mKeyguardUpdateMonitorCallbackCaptor.capture());
mKeyguardUpdateMonitorCallbackCaptor.getValue().onTimeFormatChanged("");
verify(mKeyguardClockSwitchController).refreshFormat();
}
@Test
public void userChangeNotifiesClockSwitchController() {
mController.onViewAttached();
verify(mKeyguardUpdateMonitor).registerCallback(
mKeyguardUpdateMonitorCallbackCaptor.capture());
mKeyguardUpdateMonitorCallbackCaptor.getValue().onUserSwitchComplete(0);
verify(mKeyguardClockSwitchController).refreshFormat();
}
}