Suppress immersive mode cling in LockTask mode.

We don't want to show the immersive mode cling when the device is in
LockTask mode, as the status bar swipe gesture is unavailable.

Bug: 68305547
Test: manual, with DEBUG_SHOW_EVERY_TIME
Change-Id: Id11516267800e0b0c8de1da52a43b2dded5181be
This commit is contained in:
Charles He
2017-10-26 15:24:29 +01:00
parent ab57e18da1
commit 29fef4329c

View File

@@ -52,7 +52,6 @@ import android.widget.Button;
import android.widget.FrameLayout;
import com.android.internal.R;
import com.android.server.vr.VrManagerService;
/**
* Helper to manage showing/hiding a confirmation prompt when the navigation bar is hidden
@@ -148,6 +147,7 @@ public class ImmersiveModeConfirmation {
&& userSetupComplete
&& !mVrModeEnabled
&& !navBarEmpty
&& !isLockTaskModeLocked()
&& !UserManager.isDeviceInDemoMode(mContext)) {
mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs);
}
@@ -156,6 +156,20 @@ public class ImmersiveModeConfirmation {
}
}
/**
* @return {@code true} if and only if the device is currently in LockTask mode managed by
* {@link android.app.admin.DevicePolicyManager}. Note that this differs from the screen pinning
* mode which is initiated by the user.
*/
private boolean isLockTaskModeLocked() {
try {
return ActivityManager.getService().getLockTaskModeState()
== ActivityManager.LOCK_TASK_MODE_LOCKED;
} catch (RemoteException e) {
return false;
}
}
public boolean onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode,
boolean navBarEmpty) {
if (!isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {