Loading core/java/android/companion/virtual/computercontrol/ComputerControlSession.java +5 −5 Original line number Diff line number Diff line Loading @@ -71,14 +71,14 @@ public final class ComputerControlSession implements AutoCloseable { public static final int ERROR_SESSION_LIMIT_REACHED = 1; /** * Error code indicating that a new session cannot be created because the lock screen (also * known as Keyguard) is showing. * Error code indicating that a new session cannot be created because the device is currently * locked. * * <p>This is a transient error and the session creation request can be retried later.</p> * * @see android.app.KeyguardManager#isKeyguardLocked() * @see android.app.KeyguardManager#isDeviceLocked() */ public static final int ERROR_KEYGUARD_LOCKED = 2; public static final int ERROR_DEVICE_LOCKED = 2; /** * Error code indicating that the user did not approve the creation of a new session. Loading @@ -89,7 +89,7 @@ public final class ComputerControlSession implements AutoCloseable { @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "ERROR_", value = { ERROR_SESSION_LIMIT_REACHED, ERROR_KEYGUARD_LOCKED, ERROR_DEVICE_LOCKED, ERROR_PERMISSION_DENIED}) @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) public @interface SessionCreationError { Loading services/companion/java/com/android/server/companion/virtual/computercontrol/ComputerControlSessionProcessor.java +2 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,9 @@ public class ComputerControlSessionProcessor { private boolean checkSessionCreationPreconditionsLocked( @NonNull ComputerControlSessionParams params, @NonNull IComputerControlSessionCallback callback) { if (mKeyguardManager.isKeyguardLocked()) { if (mKeyguardManager.isDeviceLocked()) { dispatchSessionCreationFailed(callback, params, ComputerControlSession.ERROR_KEYGUARD_LOCKED); ComputerControlSession.ERROR_DEVICE_LOCKED); return false; } if (mSessions.size() >= MAXIMUM_CONCURRENT_SESSIONS) { Loading services/tests/servicestests/src/com/android/server/companion/virtual/computercontrol/ComputerControlSessionProcessorTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -133,12 +133,12 @@ public class ComputerControlSessionProcessorTest { @Test public void keyguardLocked_sessionNotCreated() throws Exception { when(mKeyguardManager.isKeyguardLocked()).thenReturn(true); when(mKeyguardManager.isDeviceLocked()).thenReturn(true); mProcessor.processNewSessionRequest(AttributionSource.myAttributionSource(), mParams, mComputerControlSessionCallback); verify(mComputerControlSessionCallback, timeout(CALLBACK_TIMEOUT_MS)) .onSessionCreationFailed(ComputerControlSession.ERROR_KEYGUARD_LOCKED); .onSessionCreationFailed(ComputerControlSession.ERROR_DEVICE_LOCKED); } @Test Loading Loading
core/java/android/companion/virtual/computercontrol/ComputerControlSession.java +5 −5 Original line number Diff line number Diff line Loading @@ -71,14 +71,14 @@ public final class ComputerControlSession implements AutoCloseable { public static final int ERROR_SESSION_LIMIT_REACHED = 1; /** * Error code indicating that a new session cannot be created because the lock screen (also * known as Keyguard) is showing. * Error code indicating that a new session cannot be created because the device is currently * locked. * * <p>This is a transient error and the session creation request can be retried later.</p> * * @see android.app.KeyguardManager#isKeyguardLocked() * @see android.app.KeyguardManager#isDeviceLocked() */ public static final int ERROR_KEYGUARD_LOCKED = 2; public static final int ERROR_DEVICE_LOCKED = 2; /** * Error code indicating that the user did not approve the creation of a new session. Loading @@ -89,7 +89,7 @@ public final class ComputerControlSession implements AutoCloseable { @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "ERROR_", value = { ERROR_SESSION_LIMIT_REACHED, ERROR_KEYGUARD_LOCKED, ERROR_DEVICE_LOCKED, ERROR_PERMISSION_DENIED}) @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) public @interface SessionCreationError { Loading
services/companion/java/com/android/server/companion/virtual/computercontrol/ComputerControlSessionProcessor.java +2 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,9 @@ public class ComputerControlSessionProcessor { private boolean checkSessionCreationPreconditionsLocked( @NonNull ComputerControlSessionParams params, @NonNull IComputerControlSessionCallback callback) { if (mKeyguardManager.isKeyguardLocked()) { if (mKeyguardManager.isDeviceLocked()) { dispatchSessionCreationFailed(callback, params, ComputerControlSession.ERROR_KEYGUARD_LOCKED); ComputerControlSession.ERROR_DEVICE_LOCKED); return false; } if (mSessions.size() >= MAXIMUM_CONCURRENT_SESSIONS) { Loading
services/tests/servicestests/src/com/android/server/companion/virtual/computercontrol/ComputerControlSessionProcessorTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -133,12 +133,12 @@ public class ComputerControlSessionProcessorTest { @Test public void keyguardLocked_sessionNotCreated() throws Exception { when(mKeyguardManager.isKeyguardLocked()).thenReturn(true); when(mKeyguardManager.isDeviceLocked()).thenReturn(true); mProcessor.processNewSessionRequest(AttributionSource.myAttributionSource(), mParams, mComputerControlSessionCallback); verify(mComputerControlSessionCallback, timeout(CALLBACK_TIMEOUT_MS)) .onSessionCreationFailed(ComputerControlSession.ERROR_KEYGUARD_LOCKED); .onSessionCreationFailed(ComputerControlSession.ERROR_DEVICE_LOCKED); } @Test Loading