title: Return a failure result in inKeyguardRestrictedInputMode()
body: <p>I have a function to determine four states of phone's screen: screen on, screen off, screen on with lock, screen on without lock. My function is</p>
  
  <pre><code>private KeyguardManager keyguardManager;
  public String getScreenStatus()
  {
      String sreen_State="unknown";
      keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
      PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT_WATCH) {
          if (pm.isInteractive()) {
              sreen_State="screen_on";
              if(!keyguardManager.inKeyguardRestrictedInputMode()) {
                  sreen_State="screen_on_no_lock_screen";
  
              }else{
                  Log.i(TAG, "screen_on_lock_screen");
                  sreen_State="screen_on_lock_screen";
              }
          }
          else {
              sreen_State="screen_off";
          }
      }
      else if(Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.KITKAT_WATCH){
          if(pm.isScreenOn()){
              sreen_State="screen_on";
              if(!keyguardManager.inKeyguardRestrictedInputMode()) {
                  Log.i(TAG, "screen_on_no_lock_screen");
                  sreen_State="screen_on_no_lock_screen";
  
              }else{
                  Log.i(TAG, "screen_on_lock_screen");
                  sreen_State="screen_on_lock_screen";
              }
  
          }
          else {
              mIsScreenOn=false;
              sreen_State="screen_off";
          }
      }
      return sreen_State;
  }
  </code></pre>
  
  <p>The above function returns corrected states of the screen. However, it has error when I add one more code as follows:</p>
  
  <pre><code> KeyguardManager.KeyguardLock
   kl = keyguardManager.newKeyguardLock("MyKeyguardLock");
   if(index.equals("1"))
          kl.disableKeyguard();
    else if(indexequals("2"))
          kl.reenableKeyguard();
    getScreenStatus();
  </code></pre>
  
  <p>The index can change by press a button. Now, the wrong state of screen is happen. It always return <code>screen_on_lock_screen</code>, although the screen is in <code>screen_on_no_lock_screen</code>. How could I fix my issue?</p>