diff options
| author | 2017-10-30 17:13:50 +0000 | |
|---|---|---|
| committer | 2017-10-30 17:13:50 +0000 | |
| commit | 97a0ae3a49b4e595d8c7ca79a9e8e5d41b9d4252 (patch) | |
| tree | 015c159660c1d01538bdac31c6561ee4bd30130e | |
| parent | e020c0077d7f9ebbadda0ecf8abebba231df773a (diff) | |
| parent | 29fef4329c846a4d593e2abd06c2c42596bdb1a9 (diff) | |
Merge "Suppress immersive mode cling in LockTask mode."
| -rw-r--r-- | services/core/java/com/android/server/policy/ImmersiveModeConfirmation.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/policy/ImmersiveModeConfirmation.java b/services/core/java/com/android/server/policy/ImmersiveModeConfirmation.java index c6ec287d9c6a..edd2fdb1b33a 100644 --- a/services/core/java/com/android/server/policy/ImmersiveModeConfirmation.java +++ b/services/core/java/com/android/server/policy/ImmersiveModeConfirmation.java @@ -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)) { |