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) {
|
if (mClockViewController != null) {
|
||||||
mClockViewController.refreshFormat();
|
mClockViewController.refreshFormat();
|
||||||
mLargeClockViewController.refreshFormat();
|
mLargeClockViewController.refreshFormat();
|
||||||
|
|||||||
@@ -286,6 +286,11 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
|||||||
refreshTime();
|
refreshTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimeFormatChanged(String timeFormat) {
|
||||||
|
mKeyguardClockSwitchController.refreshFormat();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimeZoneChanged(TimeZone timeZone) {
|
public void onTimeZoneChanged(TimeZone timeZone) {
|
||||||
mKeyguardClockSwitchController.updateTimeZone(timeZone);
|
mKeyguardClockSwitchController.updateTimeZone(timeZone);
|
||||||
@@ -313,6 +318,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitchComplete(int userId) {
|
public void onUserSwitchComplete(int userId) {
|
||||||
|
mKeyguardClockSwitchController.refreshFormat();
|
||||||
mView.updateOwnerInfo();
|
mView.updateOwnerInfo();
|
||||||
mView.updateLogoutView(shouldShowLogout());
|
mView.updateLogoutView(shouldShowLogout());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
@@ -59,6 +61,8 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {
|
|||||||
SmartspaceTransitionController mSmartSpaceTransitionController;
|
SmartspaceTransitionController mSmartSpaceTransitionController;
|
||||||
@Mock
|
@Mock
|
||||||
UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||||
|
@Captor
|
||||||
|
private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallbackCaptor;
|
||||||
|
|
||||||
private KeyguardStatusViewController mController;
|
private KeyguardStatusViewController mController;
|
||||||
|
|
||||||
@@ -90,4 +94,26 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {
|
|||||||
mController.dozeTimeTick();
|
mController.dozeTimeTick();
|
||||||
verify(mKeyguardClockSwitchController).refresh();
|
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