Merge "Update time format" into sc-dev
This commit is contained in:
@@ -342,7 +342,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
}
|
||||
}
|
||||
|
||||
void refreshFormat(String timeFormat) {
|
||||
void refreshFormat() {
|
||||
if (mClockViewController != null) {
|
||||
mClockViewController.refreshFormat();
|
||||
mLargeClockViewController.refreshFormat();
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user