shadows/framework/src/main/java/org/robolectric/shadows/ShadowKeyguardManager.java
public void setKeyguardLocked(boolean isKeyguardLocked) {
    this.isKeyguardLocked = isKeyguardLocked;
    if (callback != null) {
      if (isKeyguardLocked) {
        callback.onDismissCancelled();
      } else {
        callback.onDismissSucceeded();
      }
      callback = null;
    }
  }
public void setKeyguardLocked(boolean isKeyguardLocked) {
    this.isKeyguardLocked = isKeyguardLocked;
    if (callback != null) {
      if (isKeyguardLocked) {
        callback.onDismissCancelled();
      } else {
        callback.onDismissSucceeded();
      }
      callback = null;
    }
  }
Sets whether the device keyguard is locked or not. This affects the value to be returned by
{@link #isKeyguardLocked()} and also invokes callbacks set in
{@link KeyguardManager#requestDismissKeyguard()}.

@param isKeyguardLocked true to lock the keyguard. If a KeyguardDismissCallback is set will
fire {@link KeyguardDismissCallback#onDismissCancelled()} or false to unlock and dismiss the
keyguard firing {@link KeyguardDismissCallback#onDismissSucceeded()} if a
KeyguardDismissCallback is set.