// Returns true if the device is currently in a state where the user is seeing the bouncer.
 // This requires isKeyguardBouncer() to be true, but that doesn't imply that the screen is on or
 // the keyguard visibility is set to true, so we must check those conditions as well.
 private boolean isBouncerVisibleToUser() {
   KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
   return updateMonitor.isKeyguardBouncer()
       && updateMonitor.isKeyguardVisible()
       && updateMonitor.isScreenOn();
 }