Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b0a28d5 authored by Benjamin Franz's avatar Benjamin Franz Committed by android-build-merger
Browse files

Merge "Disable immersive mode confirmation when device is in lock task mode" into pi-dev

am: d47cdda5

Change-Id: I42a29c7c041b682ff8fb5a158025d9737d6930e5
parents 4c7af018 d47cdda5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -469,6 +469,7 @@ public class LockTaskController {
            if (mLockTaskModeState == LOCK_TASK_MODE_PINNED) {
                getStatusBarService().showPinningEnterExitToast(false /* entering */);
            }
            mWindowManager.onLockTaskStateChanged(LOCK_TASK_MODE_NONE);
        } catch (RemoteException ex) {
            throw new RuntimeException(ex);
        } finally {
@@ -580,6 +581,7 @@ public class LockTaskController {
            if (lockTaskModeState == LOCK_TASK_MODE_PINNED) {
                getStatusBarService().showPinningEnterExitToast(true /* entering */);
            }
            mWindowManager.onLockTaskStateChanged(lockTaskModeState);
            mLockTaskModeState = lockTaskModeState;
            setStatusBarState(lockTaskModeState, userId);
            setKeyguardState(lockTaskModeState, userId);
+10 −1
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.policy;

import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;

import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.ActivityManager;
@@ -78,6 +81,7 @@ public class ImmersiveModeConfirmation {
    // Local copy of vr mode enabled state, to avoid calling into VrManager with
    // the lock held.
    boolean mVrModeEnabled = false;
    private int mLockTaskState = LOCK_TASK_MODE_NONE;

    public ImmersiveModeConfirmation(Context context) {
        mContext = ActivityThread.currentActivityThread().getSystemUiContext();
@@ -148,7 +152,8 @@ public class ImmersiveModeConfirmation {
                    && userSetupComplete
                    && !mVrModeEnabled
                    && !navBarEmpty
                    && !UserManager.isDeviceInDemoMode(mContext)) {
                    && !UserManager.isDeviceInDemoMode(mContext)
                    && (mLockTaskState != LOCK_TASK_MODE_LOCKED)) {
                mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs);
            }
        } else {
@@ -401,4 +406,8 @@ public class ImmersiveModeConfirmation {
            }
        }
    };

    void onLockTaskModeChangedLw(int lockTaskState) {
        mLockTaskState = lockTaskState;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -8811,4 +8811,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                return Integer.toString(behavior);
        }
    }

    @Override
    public void onLockTaskStateChangedLw(int lockTaskState) {
        mImmersiveModeConfirmation.onLockTaskModeChangedLw(lockTaskState);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.Manifest;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.CompatibilityInfo;
@@ -1731,4 +1732,15 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
     * on the next user activity.
     */
    public void requestUserActivityNotification();

    /**
     * Called when the state of lock task mode changes. This should be used to disable immersive
     * mode confirmation.
     *
     * @param lockTaskState the new lock task mode state. One of
     *                      {@link ActivityManager#LOCK_TASK_MODE_NONE},
     *                      {@link ActivityManager#LOCK_TASK_MODE_LOCKED},
     *                      {@link ActivityManager#LOCK_TASK_MODE_PINNED}.
     */
    void onLockTaskStateChangedLw(int lockTaskState);
}
+15 −1
Original line number Diff line number Diff line
@@ -7438,5 +7438,19 @@ public class WindowManagerService extends IWindowManager.Stub
        mH.obtainMessage(H.SET_RUNNING_REMOTE_ANIMATION, pid, runningRemoteAnimation ? 1 : 0)
                .sendToTarget();
    }
}

    /**
     * Called when the state of lock task mode changes. This should be used to disable immersive
     * mode confirmation.
     *
     * @param lockTaskState the new lock task mode state. One of
     *                      {@link ActivityManager#LOCK_TASK_MODE_NONE},
     *                      {@link ActivityManager#LOCK_TASK_MODE_LOCKED},
     *                      {@link ActivityManager#LOCK_TASK_MODE_PINNED}.
     */
    public void onLockTaskStateChanged(int lockTaskState) {
        synchronized (mWindowMap) {
            mPolicy.onLockTaskStateChangedLw(lockTaskState);
        }
    }
}
Loading