Methods Summary |
---|
public void | confirmCurrentPrompt()
if (mClingWindow != null) {
if (DEBUG) Slog.d(TAG, "confirmCurrentPrompt()");
mHandler.post(mConfirm);
}
|
public FrameLayout.LayoutParams | getBubbleLayoutParams()
return new FrameLayout.LayoutParams(
mContext.getResources().getDimensionPixelSize(
R.dimen.immersive_mode_cling_width),
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
|
public WindowManager.LayoutParams | getClingWindowLayoutParams()
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_TOAST,
0
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
lp.setTitle("ImmersiveModeConfirmation");
lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
lp.gravity = Gravity.FILL;
return lp;
|
private long | getNavBarExitDuration()
Animation exit = AnimationUtils.loadAnimation(mContext, R.anim.dock_bottom_exit);
return exit != null ? exit.getDuration() : 0;
|
private void | handleHide()
if (mClingWindow != null) {
if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation");
mWindowManager.removeView(mClingWindow);
mClingWindow = null;
}
|
private void | handlePanic()
if (DEBUG) Slog.d(TAG, "handlePanic()");
if (mUserPanicResets.get(mCurrentUserId, false)) return; // already reset for panic
mUserPanicResets.put(mCurrentUserId, true);
mConfirmed = false;
saveSetting();
|
private void | handleShow()
if (DEBUG) Slog.d(TAG, "Showing immersive mode confirmation");
mClingWindow = new ClingWindowView(mContext, mConfirm);
// we will be hiding the nav bar, so layout as if it's already hidden
mClingWindow.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
// show the confirmation
WindowManager.LayoutParams lp = getClingWindowLayoutParams();
mWindowManager.addView(mClingWindow, lp);
|
public void | immersiveModeChanged(java.lang.String pkg, boolean isImmersiveMode, boolean userSetupComplete)
mHandler.removeMessages(H.SHOW);
if (isImmersiveMode) {
final boolean disabled = PolicyControl.disableImmersiveConfirmation(pkg);
if (DEBUG) Slog.d(TAG, String.format("immersiveModeChanged() disabled=%s mConfirmed=%s",
disabled, mConfirmed));
if (!disabled && (DEBUG_SHOW_EVERY_TIME || !mConfirmed) && userSetupComplete) {
mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs);
}
} else {
mHandler.sendEmptyMessage(H.HIDE);
}
|
public void | loadSetting(int currentUserId)
mConfirmed = false;
mCurrentUserId = currentUserId;
if (DEBUG) Slog.d(TAG, String.format("loadSetting() mCurrentUserId=%d resetForPanic=%s",
mCurrentUserId, mUserPanicResets.get(mCurrentUserId, false)));
String value = null;
try {
value = Settings.Secure.getStringForUser(mContext.getContentResolver(),
Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
UserHandle.USER_CURRENT);
mConfirmed = CONFIRMED.equals(value);
if (DEBUG) Slog.d(TAG, "Loaded mConfirmed=" + mConfirmed);
} catch (Throwable t) {
Slog.w(TAG, "Error loading confirmations, value=" + value, t);
}
|
public boolean | onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode)
if (!isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {
// turning the screen back on within the panic threshold
mHandler.sendEmptyMessage(H.PANIC);
return mClingWindow == null;
}
if (isScreenOn && inImmersiveMode) {
// turning the screen off, remember if we were in immersive mode
mPanicTime = time;
} else {
mPanicTime = 0;
}
return false;
|
private void | saveSetting()
if (DEBUG) Slog.d(TAG, "saveSetting()");
try {
final String value = mConfirmed ? CONFIRMED : null;
Settings.Secure.putStringForUser(mContext.getContentResolver(),
Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
value,
UserHandle.USER_CURRENT);
if (DEBUG) Slog.d(TAG, "Saved value=" + value);
} catch (Throwable t) {
Slog.w(TAG, "Error saving confirmations, mConfirmed=" + mConfirmed, t);
}
|