Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +2 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ public class KeyguardIndicationController implements StateListener, mStatusBarStateController = statusBarStateController; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mDockManager = dockManager; mDockManager.addAlignmentStateListener(this::handleAlignStateChanged); mDockManager.addAlignmentStateListener( alignState -> mHandler.post(() -> handleAlignStateChanged(alignState))); // lock icon is not used on all form factors. if (mLockIcon != null) { mLockIcon.setOnLongClickListener(this::handleLockLongClick); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +30 −20 Original line number Diff line number Diff line Loading @@ -154,12 +154,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_showsSlowChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mAlignmentListener.getValue().onAlignmentStateChanged( DockManager.ALIGN_STATE_POOR); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_slow_charging)); Loading @@ -169,11 +171,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_showsNotChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_not_charging)); Loading @@ -183,13 +188,15 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_whileDozing_showsSlowChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mController.setDozing(true); mAlignmentListener.getValue().onAlignmentStateChanged( DockManager.ALIGN_STATE_POOR); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_slow_charging)); Loading @@ -199,12 +206,15 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_whileDozing_showsNotChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mController.setDozing(true); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_not_charging)); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +2 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ public class KeyguardIndicationController implements StateListener, mStatusBarStateController = statusBarStateController; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mDockManager = dockManager; mDockManager.addAlignmentStateListener(this::handleAlignStateChanged); mDockManager.addAlignmentStateListener( alignState -> mHandler.post(() -> handleAlignStateChanged(alignState))); // lock icon is not used on all form factors. if (mLockIcon != null) { mLockIcon.setOnLongClickListener(this::handleLockLongClick); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +30 −20 Original line number Diff line number Diff line Loading @@ -154,12 +154,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_showsSlowChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mAlignmentListener.getValue().onAlignmentStateChanged( DockManager.ALIGN_STATE_POOR); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_slow_charging)); Loading @@ -169,11 +171,14 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_showsNotChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_not_charging)); Loading @@ -183,13 +188,15 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_whileDozing_showsSlowChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mController.setDozing(true); mAlignmentListener.getValue().onAlignmentStateChanged( DockManager.ALIGN_STATE_POOR); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_slow_charging)); Loading @@ -199,12 +206,15 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onAlignmentStateChanged_whileDozing_showsNotChargingIndication() { mInstrumentation.runOnMainSync(() -> { createController(); verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); mController.setVisible(true); mController.setDozing(true); mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); }); mInstrumentation.waitForIdleSync(); assertThat(mTextView.getText()).isEqualTo( mContext.getResources().getString(R.string.dock_alignment_not_charging)); Loading