KeyguardViewManagerpublic class KeyguardViewManager extends Object implements KeyguardWindowControllerManages creating, showing, hiding and resetting the keyguard. Calls back
via {@link com.android.internal.policy.impl.KeyguardViewCallback} to poke
the wake lock and report that the keyguard is done, which is in turn,
reported to this class by the current {@link KeyguardViewBase}. |
Fields Summary |
---|
private static final boolean | DEBUG | private static String | TAG | private final android.content.Context | mContext | private final android.view.ViewManager | mViewManager | private final KeyguardViewCallback | mCallback | private final KeyguardViewProperties | mKeyguardViewProperties | private final KeyguardUpdateMonitor | mUpdateMonitor | private WindowManager.LayoutParams | mWindowLayoutParams | private boolean | mNeedsInput | private android.widget.FrameLayout | mKeyguardHost | private KeyguardViewBase | mKeyguardView | private boolean | mScreenOn |
Methods Summary |
---|
public synchronized void | hide()Hides the keyguard view
if (DEBUG) Log.d(TAG, "hide()");
if (mKeyguardHost != null) {
mKeyguardHost.setVisibility(View.GONE);
if (mKeyguardView != null) {
mKeyguardHost.removeView(mKeyguardView);
mKeyguardView.cleanUp();
mKeyguardView = null;
}
}
| public synchronized boolean | isShowing()
return (mKeyguardHost != null && mKeyguardHost.getVisibility() == View.VISIBLE);
| public synchronized void | onScreenTurnedOff()
if (DEBUG) Log.d(TAG, "onScreenTurnedOff()");
mScreenOn = false;
if (mKeyguardView != null) {
mKeyguardView.onScreenTurnedOff();
}
| public synchronized void | onScreenTurnedOn()
if (DEBUG) Log.d(TAG, "onScreenTurnedOn()");
mScreenOn = true;
if (mKeyguardView != null) {
mKeyguardView.onScreenTurnedOn();
}
| public synchronized void | reset()Reset the state of the view.
if (DEBUG) Log.d(TAG, "reset()");
if (mKeyguardView != null) {
mKeyguardView.reset();
}
| public void | setNeedsInput(boolean needsInput)
mNeedsInput = needsInput;
if (mWindowLayoutParams != null) {
if (needsInput) {
mWindowLayoutParams.flags &=
~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
} else {
mWindowLayoutParams.flags |=
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
}
| public synchronized void | show()Show the keyguard. Will handle creating and attaching to the view manager
lazily.
if (DEBUG) Log.d(TAG, "show()");
if (mKeyguardHost == null) {
if (DEBUG) Log.d(TAG, "keyguard host is null, creating it...");
mKeyguardHost = new KeyguardViewHost(mContext, mCallback);
final int stretch = ViewGroup.LayoutParams.FILL_PARENT;
int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
/*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ;
if (!mNeedsInput) {
flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
stretch, stretch, WindowManager.LayoutParams.TYPE_KEYGUARD,
flags, PixelFormat.OPAQUE);
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen;
lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
lp.setTitle("Keyguard");
mWindowLayoutParams = lp;
mViewManager.addView(mKeyguardHost, lp);
}
if (mKeyguardView == null) {
if (DEBUG) Log.d(TAG, "keyguard view is null, creating it...");
mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mUpdateMonitor, this);
mKeyguardView.setId(R.id.lock_screen);
mKeyguardView.setCallback(mCallback);
final ViewGroup.LayoutParams lp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
mKeyguardHost.addView(mKeyguardView, lp);
if (mScreenOn) {
mKeyguardView.onScreenTurnedOn();
}
}
mKeyguardHost.setVisibility(View.VISIBLE);
mKeyguardView.requestFocus();
| public synchronized void | verifyUnlock()
if (DEBUG) Log.d(TAG, "verifyUnlock()");
show();
mKeyguardView.verifyUnlock();
| public void | wakeWhenReadyTq(int keyCode)A key has woken the device. We use this to potentially adjust the state
of the lock screen based on the key.
The 'Tq' suffix is per the documentation in {@link android.view.WindowManagerPolicy}.
Be sure not to take any action that takes a long time; any significant
action should be posted to a handler.
if (DEBUG) Log.d(TAG, "wakeWhenReady(" + keyCode + ")");
if (mKeyguardView != null) {
mKeyguardView.wakeWhenReadyTq(keyCode);
}
|
|