Allow dismissing ImmersiveModeCling without touch
The immersive mode confirmation was not dismissable without touching it because it wasn't focusable. Change-Id: I89cdb7d4bd44e302859e731034c4395529f5e5fc Fixes: 30469869
This commit is contained in:
@@ -25,7 +25,9 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -36,7 +38,6 @@ import android.service.vr.IVrManager;
|
|||||||
import android.service.vr.IVrStateCallbacks;
|
import android.service.vr.IVrStateCallbacks;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.SparseBooleanArray;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -66,6 +67,7 @@ public class ImmersiveModeConfirmation {
|
|||||||
private final H mHandler;
|
private final H mHandler;
|
||||||
private final long mShowDelayMs;
|
private final long mShowDelayMs;
|
||||||
private final long mPanicThresholdMs;
|
private final long mPanicThresholdMs;
|
||||||
|
private final IBinder mWindowToken = new Binder();
|
||||||
|
|
||||||
private boolean mConfirmed;
|
private boolean mConfirmed;
|
||||||
private ClingWindowView mClingWindow;
|
private ClingWindowView mClingWindow;
|
||||||
@@ -190,13 +192,13 @@ public class ImmersiveModeConfirmation {
|
|||||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
|
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
|
||||||
0
|
0
|
||||||
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
|
||||||
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
|
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
|
||||||
,
|
,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
|
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
|
||||||
lp.setTitle("ImmersiveModeConfirmation");
|
lp.setTitle("ImmersiveModeConfirmation");
|
||||||
lp.windowAnimations = com.android.internal.R.style.Animation_ImmersiveModeConfirmation;
|
lp.windowAnimations = com.android.internal.R.style.Animation_ImmersiveModeConfirmation;
|
||||||
|
lp.token = getWindowToken();
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +210,13 @@ public class ImmersiveModeConfirmation {
|
|||||||
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
|
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the window token that's used by all ImmersiveModeConfirmation windows.
|
||||||
|
*/
|
||||||
|
public IBinder getWindowToken() {
|
||||||
|
return mWindowToken;
|
||||||
|
}
|
||||||
|
|
||||||
private class ClingWindowView extends FrameLayout {
|
private class ClingWindowView extends FrameLayout {
|
||||||
private static final int BGCOLOR = 0x80000000;
|
private static final int BGCOLOR = 0x80000000;
|
||||||
private static final int OFFSET_DP = 96;
|
private static final int OFFSET_DP = 96;
|
||||||
|
|||||||
@@ -7418,11 +7418,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
private int updateSystemUiVisibilityLw() {
|
private int updateSystemUiVisibilityLw() {
|
||||||
// If there is no window focused, there will be nobody to handle the events
|
// If there is no window focused, there will be nobody to handle the events
|
||||||
// anyway, so just hang on in whatever state we're in until things settle down.
|
// anyway, so just hang on in whatever state we're in until things settle down.
|
||||||
final WindowState win = mFocusedWindow != null ? mFocusedWindow
|
WindowState winCandidate = mFocusedWindow != null ? mFocusedWindow
|
||||||
: mTopFullscreenOpaqueWindowState;
|
: mTopFullscreenOpaqueWindowState;
|
||||||
if (win == null) {
|
if (winCandidate == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (winCandidate.getAttrs().token == mImmersiveModeConfirmation.getWindowToken()) {
|
||||||
|
// The immersive mode confirmation should never affect the system bar visibility,
|
||||||
|
// otherwise it will unhide the navigation bar and hide itself.
|
||||||
|
winCandidate = isStatusBarKeyguard() ? mStatusBar : mTopFullscreenOpaqueWindowState;
|
||||||
|
if (winCandidate == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final WindowState win = winCandidate;
|
||||||
if ((win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 && mHideLockScreen == true) {
|
if ((win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 && mHideLockScreen == true) {
|
||||||
// We are updating at a point where the keyguard has gotten
|
// We are updating at a point where the keyguard has gotten
|
||||||
// focus, but we were last in a state where the top window is
|
// focus, but we were last in a state where the top window is
|
||||||
|
|||||||
Reference in New Issue
Block a user