Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9792f7ae authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

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

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

Change-Id: Ic551094c5658a51cadcc27d37ade8af745b40533
parents 3cb146f1 20da155d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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();
+6 −0
Original line number Original line Diff line number Diff line
@@ -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());
        }
        }
+26 −0
Original line number Original line Diff line number Diff line
@@ -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();
    }
}
}