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

Commit 05074ac4 authored by Tony Mak's avatar Tony Mak Committed by android-build-merger
Browse files

Merge "Fix IME is not working after reboot in kiosk mode" into pi-dev am: fb933aef

am: 54245482

Change-Id: I175da66281470b0ee4d64fd70b8ee4f57039f61c
parents b28dcbf0 54245482
Loading
Loading
Loading
Loading
+24 −1
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.SparseIntArray;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils;
import com.android.server.LocalServices;
import com.android.server.LocalServices;
@@ -729,9 +730,31 @@ public class LockTaskController {
        } else if (lockTaskModeState == LOCK_TASK_MODE_LOCKED) {
        } else if (lockTaskModeState == LOCK_TASK_MODE_LOCKED) {
            if (isKeyguardAllowed(userId)) {
            if (isKeyguardAllowed(userId)) {
                mWindowManager.reenableKeyguard(mToken);
                mWindowManager.reenableKeyguard(mToken);
            } else {
                // If keyguard is not secure and it is locked, dismiss the keyguard before
                // disabling it, which avoids the platform to think the keyguard is still on.
                if (mWindowManager.isKeyguardLocked() && !mWindowManager.isKeyguardSecure()) {
                    mWindowManager.dismissKeyguard(new IKeyguardDismissCallback.Stub() {
                        @Override
                        public void onDismissError() throws RemoteException {
                            Slog.i(TAG, "setKeyguardState: failed to dismiss keyguard");
                        }

                        @Override
                        public void onDismissSucceeded() throws RemoteException {
                            mHandler.post(
                                    () -> mWindowManager.disableKeyguard(mToken, LOCK_TASK_TAG));
                        }

                        @Override
                        public void onDismissCancelled() throws RemoteException {
                            Slog.i(TAG, "setKeyguardState: dismiss cancelled");
                        }
                    }, null);
                } else {
                } else {
                    mWindowManager.disableKeyguard(mToken, LOCK_TASK_TAG);
                    mWindowManager.disableKeyguard(mToken, LOCK_TASK_TAG);
                }
                }
            }


        } else { // lockTaskModeState == LOCK_TASK_MODE_PINNED
        } else { // lockTaskModeState == LOCK_TASK_MODE_PINNED
            mWindowManager.disableKeyguard(mToken, LOCK_TASK_TAG);
            mWindowManager.disableKeyguard(mToken, LOCK_TASK_TAG);