* commit '7dc7e2c59eef0399332911d82472f6a1bb45252f': No longer trigger immersive cling on panic
This commit is contained in:
@@ -60,7 +60,6 @@ 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 SparseBooleanArray mUserPanicResets = new SparseBooleanArray();
|
|
||||||
|
|
||||||
private boolean mConfirmed;
|
private boolean mConfirmed;
|
||||||
private ClingWindowView mClingWindow;
|
private ClingWindowView mClingWindow;
|
||||||
@@ -86,8 +85,7 @@ public class ImmersiveModeConfirmation {
|
|||||||
public void loadSetting(int currentUserId) {
|
public void loadSetting(int currentUserId) {
|
||||||
mConfirmed = false;
|
mConfirmed = false;
|
||||||
mCurrentUserId = currentUserId;
|
mCurrentUserId = currentUserId;
|
||||||
if (DEBUG) Slog.d(TAG, String.format("loadSetting() mCurrentUserId=%d resetForPanic=%s",
|
if (DEBUG) Slog.d(TAG, String.format("loadSetting() mCurrentUserId=%d", mCurrentUserId));
|
||||||
mCurrentUserId, mUserPanicResets.get(mCurrentUserId, false)));
|
|
||||||
String value = null;
|
String value = null;
|
||||||
try {
|
try {
|
||||||
value = Settings.Secure.getStringForUser(mContext.getContentResolver(),
|
value = Settings.Secure.getStringForUser(mContext.getContentResolver(),
|
||||||
@@ -132,7 +130,6 @@ public class ImmersiveModeConfirmation {
|
|||||||
public boolean onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode) {
|
public boolean onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode) {
|
||||||
if (!isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {
|
if (!isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {
|
||||||
// turning the screen back on within the panic threshold
|
// turning the screen back on within the panic threshold
|
||||||
mHandler.sendEmptyMessage(H.PANIC);
|
|
||||||
return mClingWindow == null;
|
return mClingWindow == null;
|
||||||
}
|
}
|
||||||
if (isScreenOn && inImmersiveMode) {
|
if (isScreenOn && inImmersiveMode) {
|
||||||
@@ -151,14 +148,6 @@ public class ImmersiveModeConfirmation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 handleHide() {
|
private void handleHide() {
|
||||||
if (mClingWindow != null) {
|
if (mClingWindow != null) {
|
||||||
if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation");
|
if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation");
|
||||||
@@ -350,7 +339,6 @@ public class ImmersiveModeConfirmation {
|
|||||||
private final class H extends Handler {
|
private final class H extends Handler {
|
||||||
private static final int SHOW = 1;
|
private static final int SHOW = 1;
|
||||||
private static final int HIDE = 2;
|
private static final int HIDE = 2;
|
||||||
private static final int PANIC = 3;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
@@ -361,9 +349,6 @@ public class ImmersiveModeConfirmation {
|
|||||||
case HIDE:
|
case HIDE:
|
||||||
handleHide();
|
handleHide();
|
||||||
break;
|
break;
|
||||||
case PANIC:
|
|
||||||
handlePanic();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user