Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +24 −10 Original line number Diff line number Diff line Loading @@ -2439,10 +2439,14 @@ public class KeyguardViewMediator implements CoreStartable, } } private void doKeyguardLocked(Bundle options) { doKeyguardLocked(options, true /* resetState */); } /** * Enable the keyguard if the settings are appropriate. */ private void doKeyguardLocked(Bundle options) { private void doKeyguardLocked(Bundle options, boolean resetState) { // If the power button behavior requests to open the glanceable hub. if (options != null && options.getBoolean(EXTRA_TRIGGER_HUB)) { if (mCommunalSettingsInteractor.get().getAutoOpenEnabled().getValue()) { Loading Loading @@ -2505,7 +2509,9 @@ public class KeyguardViewMediator implements CoreStartable, + "already showing, we're interactive, we were not " + "previously hiding. It should be safe to short-circuit " + "here."); if (resetState) { resetStateLocked(/* hideBouncer= */ false); } notifyLockNowCallback(); return; } Loading Loading @@ -2715,14 +2721,8 @@ public class KeyguardViewMediator implements CoreStartable, @Override public void onReceive(Context context, Intent intent) { if (DELAYED_KEYGUARD_ACTION.equals(intent.getAction())) { final int sequence = intent.getIntExtra("seq", 0); if (DEBUG) Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = " + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence); synchronized (KeyguardViewMediator.this) { if (mDelayedShowingSequence == sequence) { doKeyguardLocked(null); } } doDelayedKeyguardAction(intent.getIntExtra("seq", 0)); } else if (DELAYED_LOCK_PROFILE_ACTION.equals(intent.getAction())) { final int sequence = intent.getIntExtra("seq", 0); int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, 0); Loading @@ -2737,6 +2737,20 @@ public class KeyguardViewMediator implements CoreStartable, } }; @VisibleForTesting void doDelayedKeyguardAction(int sequence) { if (DEBUG) { Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = " + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence); } synchronized (KeyguardViewMediator.this) { if (mDelayedShowingSequence == sequence) { doKeyguardLocked(null, !mUpdateMonitor.isDreaming()); } } } private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTestKt.kt +16 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ import android.view.WindowManager import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLogger import com.android.internal.widget.lockPatternUtils import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.keyguardUnlockAnimationController import com.android.keyguard.keyguardUpdateMonitor import com.android.keyguard.mediator.ScreenOnCoordinator import com.android.keyguard.trustManager import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR Loading Loading @@ -106,6 +106,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.doReturn Loading Loading @@ -151,7 +152,7 @@ class KeyguardViewMediatorTestKt : SysuiTestCase() { broadcastDispatcher, { statusBarKeyguardViewManager }, dismissCallbackRegistry, mock<KeyguardUpdateMonitor>(), keyguardUpdateMonitor, dumpManager, fakeExecutor, powerManager, Loading Loading @@ -243,6 +244,18 @@ class KeyguardViewMediatorTestKt : SysuiTestCase() { assertThat(communalSceneRepository.currentScene.value).isEqualTo(CommunalScenes.Blank) } @Test fun doKeyguardTimeout_dreaming_keyguardNotReset() = kosmos.runTest { underTest.setShowingLocked(true, "") whenever(powerManager.isInteractive()).thenReturn(true) whenever(keyguardStateController.isShowing()).thenReturn(true) whenever(keyguardUpdateMonitor.isDreaming).thenReturn(true) underTest.doDelayedKeyguardAction(0) testableLooper.processAllMessages() verify(statusBarKeyguardViewManager, never()).reset(anyBoolean()) } @Test fun doKeyguardTimeout_hubConditionNotActive_sleeps() = kosmos.runTest { Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +24 −10 Original line number Diff line number Diff line Loading @@ -2439,10 +2439,14 @@ public class KeyguardViewMediator implements CoreStartable, } } private void doKeyguardLocked(Bundle options) { doKeyguardLocked(options, true /* resetState */); } /** * Enable the keyguard if the settings are appropriate. */ private void doKeyguardLocked(Bundle options) { private void doKeyguardLocked(Bundle options, boolean resetState) { // If the power button behavior requests to open the glanceable hub. if (options != null && options.getBoolean(EXTRA_TRIGGER_HUB)) { if (mCommunalSettingsInteractor.get().getAutoOpenEnabled().getValue()) { Loading Loading @@ -2505,7 +2509,9 @@ public class KeyguardViewMediator implements CoreStartable, + "already showing, we're interactive, we were not " + "previously hiding. It should be safe to short-circuit " + "here."); if (resetState) { resetStateLocked(/* hideBouncer= */ false); } notifyLockNowCallback(); return; } Loading Loading @@ -2715,14 +2721,8 @@ public class KeyguardViewMediator implements CoreStartable, @Override public void onReceive(Context context, Intent intent) { if (DELAYED_KEYGUARD_ACTION.equals(intent.getAction())) { final int sequence = intent.getIntExtra("seq", 0); if (DEBUG) Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = " + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence); synchronized (KeyguardViewMediator.this) { if (mDelayedShowingSequence == sequence) { doKeyguardLocked(null); } } doDelayedKeyguardAction(intent.getIntExtra("seq", 0)); } else if (DELAYED_LOCK_PROFILE_ACTION.equals(intent.getAction())) { final int sequence = intent.getIntExtra("seq", 0); int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, 0); Loading @@ -2737,6 +2737,20 @@ public class KeyguardViewMediator implements CoreStartable, } }; @VisibleForTesting void doDelayedKeyguardAction(int sequence) { if (DEBUG) { Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = " + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence); } synchronized (KeyguardViewMediator.this) { if (mDelayedShowingSequence == sequence) { doKeyguardLocked(null, !mUpdateMonitor.isDreaming()); } } } private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTestKt.kt +16 −3 Original line number Diff line number Diff line Loading @@ -38,8 +38,8 @@ import android.view.WindowManager import androidx.test.filters.SmallTest import com.android.internal.logging.uiEventLogger import com.android.internal.widget.lockPatternUtils import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.keyguardUnlockAnimationController import com.android.keyguard.keyguardUpdateMonitor import com.android.keyguard.mediator.ScreenOnCoordinator import com.android.keyguard.trustManager import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR Loading Loading @@ -106,6 +106,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.doReturn Loading Loading @@ -151,7 +152,7 @@ class KeyguardViewMediatorTestKt : SysuiTestCase() { broadcastDispatcher, { statusBarKeyguardViewManager }, dismissCallbackRegistry, mock<KeyguardUpdateMonitor>(), keyguardUpdateMonitor, dumpManager, fakeExecutor, powerManager, Loading Loading @@ -243,6 +244,18 @@ class KeyguardViewMediatorTestKt : SysuiTestCase() { assertThat(communalSceneRepository.currentScene.value).isEqualTo(CommunalScenes.Blank) } @Test fun doKeyguardTimeout_dreaming_keyguardNotReset() = kosmos.runTest { underTest.setShowingLocked(true, "") whenever(powerManager.isInteractive()).thenReturn(true) whenever(keyguardStateController.isShowing()).thenReturn(true) whenever(keyguardUpdateMonitor.isDreaming).thenReturn(true) underTest.doDelayedKeyguardAction(0) testableLooper.processAllMessages() verify(statusBarKeyguardViewManager, never()).reset(anyBoolean()) } @Test fun doKeyguardTimeout_hubConditionNotActive_sleeps() = kosmos.runTest { Loading