Fields Summary |
---|
public static final String | KEYGUARD_PACKAGE |
public static final String | KEYGUARD_CLASS |
private static final String | TAG |
private static final boolean | DEBUG |
protected KeyguardServiceWrapper | mKeyguardService |
private final android.content.Context | mContext |
private final android.view.View | mScrim |
private final KeyguardState | mKeyguardState |
private ShowListener | mShowListenerWhenConnect |
private final android.content.ServiceConnection | mKeyguardConnection |
Methods Summary |
---|
public void | bindService(android.content.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");
}
|
private static final android.view.View | createScrim(android.content.Context context)
View view = new View(context);
int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
| WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
| WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
;
final int stretch = ViewGroup.LayoutParams.MATCH_PARENT;
final int type = WindowManager.LayoutParams.TYPE_KEYGUARD_SCRIM;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
stretch, stretch, type, flags, PixelFormat.TRANSLUCENT);
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
lp.setTitle("KeyguardScrim");
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.addView(view, lp);
// Disable pretty much everything in statusbar until keyguard comes back and we know
// the state of the world.
view.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME
| View.STATUS_BAR_DISABLE_BACK
| View.STATUS_BAR_DISABLE_RECENT
| View.STATUS_BAR_DISABLE_EXPAND
| View.STATUS_BAR_DISABLE_SEARCH);
return view;
|
public void | dismiss()
if (mKeyguardService != null) {
mKeyguardService.dismiss();
}
|
public void | doKeyguardTimeout(android.os.Bundle options)
if (mKeyguardService != null) {
mKeyguardService.doKeyguardTimeout(options);
}
|
public void | hideScrim()
mScrim.post(new Runnable() {
@Override
public void run() {
mScrim.setVisibility(View.GONE);
}
});
|
public boolean | isInputRestricted()
if (mKeyguardService != null) {
mKeyguardState.inputRestricted = mKeyguardService.isInputRestricted();
}
return mKeyguardState.inputRestricted;
|
public boolean | isSecure()
if (mKeyguardService != null) {
mKeyguardState.secure = mKeyguardService.isSecure();
}
return mKeyguardState.secure;
|
public boolean | isShowing()
if (mKeyguardService != null) {
mKeyguardState.showing = mKeyguardService.isShowing();
}
return mKeyguardState.showing;
|
public void | keyguardDone(boolean authenticated, boolean wakeup)
if (mKeyguardService != null) {
mKeyguardService.keyguardDone(authenticated, wakeup);
}
|
public void | onActivityDrawn()
if (mKeyguardService != null) {
mKeyguardService.onActivityDrawn();
}
|
public void | onBootCompleted()
if (mKeyguardService != null) {
mKeyguardService.onBootCompleted();
}
mKeyguardState.bootCompleted = true;
|
public void | onDreamingStarted()
if (mKeyguardService != null) {
mKeyguardService.onDreamingStarted();
}
mKeyguardState.dreaming = true;
|
public void | onDreamingStopped()
if (mKeyguardService != null) {
mKeyguardService.onDreamingStopped();
}
mKeyguardState.dreaming = false;
|
public void | onScreenTurnedOff(int why)
if (mKeyguardService != null) {
mKeyguardService.onScreenTurnedOff(why);
}
mKeyguardState.offReason = why;
mKeyguardState.screenIsOn = false;
|
public void | onScreenTurnedOn(com.android.internal.policy.impl.keyguard.KeyguardServiceDelegate$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 | onSystemReady()
if (mKeyguardService != null) {
mKeyguardService.onSystemReady();
} else {
mKeyguardState.systemIsReady = true;
}
|
public void | setCurrentUser(int newUserId)
if (mKeyguardService != null) {
mKeyguardService.setCurrentUser(newUserId);
}
mKeyguardState.currentUser = newUserId;
|
public void | setKeyguardEnabled(boolean enabled)
if (mKeyguardService != null) {
mKeyguardService.setKeyguardEnabled(enabled);
}
mKeyguardState.enabled = enabled;
|
public void | setOccluded(boolean isOccluded)
if (mKeyguardService != null) {
mKeyguardService.setOccluded(isOccluded);
}
mKeyguardState.occluded = isOccluded;
|
public void | showScrim()
if (!mKeyguardState.deviceHasKeyguard) return;
mScrim.post(new Runnable() {
@Override
public void run() {
mScrim.setVisibility(View.VISIBLE);
}
});
|
public void | startKeyguardExitAnimation(long startTime, long fadeoutDuration)
if (mKeyguardService != null) {
mKeyguardService.startKeyguardExitAnimation(startTime, fadeoutDuration);
}
|
public void | verifyUnlock(android.view.WindowManagerPolicy.OnKeyguardExitResult onKeyguardExitResult)
if (mKeyguardService != null) {
mKeyguardService.verifyUnlock(new KeyguardExitDelegate(onKeyguardExitResult));
}
|