public void onScreenTurnedOff(int why) {
   if (mKeyguardService != null) {
     mKeyguardService.onScreenTurnedOff(why);
   }
   mKeyguardState.offReason = why;
   mKeyguardState.screenIsOn = false;
 }
 public void bindService(Context context) {
   Intent intent = new Intent();
   intent.setClassName(KEYGUARD_PACKAGE, KEYGUARD_CLASS);
   if (!context.bindServiceAsUser(
       intent, mKeyguardConnection, Context.BIND_AUTO_CREATE, UserHandle.OWNER)) {
     Log.v(TAG, "*** Keyguard: can't bind to " + KEYGUARD_CLASS);
     mKeyguardState.showing = false;
     mKeyguardState.showingAndNotOccluded = false;
     mKeyguardState.secure = false;
     mKeyguardState.deviceHasKeyguard = false;
     hideScrim();
   } else {
     if (DEBUG) Log.v(TAG, "*** Keyguard started");
   }
 }
 public void onSystemReady() {
   if (mKeyguardService != null) {
     mKeyguardService.onSystemReady();
   } else {
     mKeyguardState.systemIsReady = true;
   }
 }
 public void onBootCompleted() {
   if (mKeyguardService != null) {
     mKeyguardService.onBootCompleted();
     sendStateChangeBroadcast(true);
   }
   mKeyguardState.bootCompleted = true;
 }
 public int setOccluded(boolean isOccluded) {
   int result = 0;
   if (mKeyguardService != null) {
     result = mKeyguardService.setOccluded(isOccluded);
   }
   mKeyguardState.occluded = isOccluded;
   return result;
 }
 public void onSystemReady() {
   if (mKeyguardService != null) {
     mKeyguardService.onSystemReady();
   } else {
     if (DEBUG) Log.v(TAG, "onSystemReady() called before keyguard service was ready");
     mKeyguardState.systemIsReady = true;
   }
 }
 public void onScreenTurnedOn(final ShowListener showListener) {
   if (mKeyguardService != null) {
     if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + showListener + ")");
     mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(showListener));
   } else {
     // try again when we establish a connection
     Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
     // This shouldn't happen, but if it does, invoke the listener immediately
     // to avoid a dark screen...
     showListener.onShown(null);
   }
   mKeyguardState.screenIsOn = true;
 }
 public void onScreenTurnedOn(final ShowListener showListener) {
   if (mKeyguardService != null) {
     if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + showListener + ")");
     mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(showListener));
   } else {
     // try again when we establish a connection
     Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
     // This shouldn't happen, but if it does, show the scrim immediately and
     // invoke the listener's callback after the service actually connects.
     mShowListenerWhenConnect = showListener;
     showScrim();
   }
   mKeyguardState.screenIsOn = true;
 }
 public void setHidden(boolean isHidden) {
   if (mKeyguardService != null) {
     mKeyguardService.setHidden(isHidden);
   }
   mKeyguardState.hidden = isHidden;
 }
 public boolean isDismissable() {
   if (mKeyguardService != null) {
     mKeyguardState.dismissable = mKeyguardService.isDismissable();
   }
   return mKeyguardState.dismissable;
 }
 public void setKeyguardEnabled(boolean enabled) {
   if (mKeyguardService != null) {
     mKeyguardService.setKeyguardEnabled(enabled);
   }
   mKeyguardState.enabled = enabled;
 }
 public void onDreamingStarted() {
   if (mKeyguardService != null) {
     mKeyguardService.onDreamingStarted();
   }
   mKeyguardState.dreaming = true;
 }
 public void onDreamingStopped() {
   if (mKeyguardService != null) {
     mKeyguardService.onDreamingStopped();
   }
   mKeyguardState.dreaming = false;
 }
 public boolean isShowingAndNotOccluded() {
   if (mKeyguardService != null) {
     mKeyguardState.showingAndNotOccluded = mKeyguardService.isShowingAndNotOccluded();
   }
   return mKeyguardState.showingAndNotOccluded;
 }
 public void setCurrentUser(int newUserId) {
   if (mKeyguardService != null) {
     mKeyguardService.setCurrentUser(newUserId);
   }
   mKeyguardState.currentUser = newUserId;
 }
 public boolean isInputRestricted() {
   if (mKeyguardService != null) {
     mKeyguardState.inputRestricted = mKeyguardService.isInputRestricted();
   }
   return mKeyguardState.inputRestricted;
 }
 public boolean isShowingAndNotHidden() {
   if (mKeyguardService != null) {
     mKeyguardState.showingAndNotHidden = mKeyguardService.isShowingAndNotHidden();
   }
   return mKeyguardState.showingAndNotHidden;
 }
 public boolean isShowing() {
   if (mKeyguardService != null) {
     mKeyguardState.showing = mKeyguardService.isShowing();
   }
   return mKeyguardState.showing;
 }
 public void onBootCompleted() {
   if (mKeyguardService != null) {
     mKeyguardService.onBootCompleted();
   }
   mKeyguardState.bootCompleted = true;
 }
 public boolean isSecure() {
   if (mKeyguardService != null) {
     mKeyguardState.secure = mKeyguardService.isSecure();
   }
   return mKeyguardState.secure;
 }