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

Commit 88140b4f authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Let IMMS call isKeyguardSecure() for the correct user"

parents d5e557e4 e6540d2b
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ import android.annotation.UiThread;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -337,7 +336,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub

    // Ongoing notification
    private NotificationManager mNotificationManager;
    KeyguardManager mKeyguardManager;
    @Nullable private StatusBarManagerInternal mStatusBarManagerInternal;
    private final Notification.Builder mImeSwitcherNotification;
    private final PendingIntent mImeSwitchPendingIntent;
@@ -1941,7 +1939,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                final int currentUserId = mSettings.getCurrentUserId();
                mSettings.switchCurrentUser(currentUserId,
                        !mUserManagerInternal.isUserUnlockingOrUnlocked(currentUserId));
                mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
                mNotificationManager = mContext.getSystemService(NotificationManager.class);
                mStatusBarManagerInternal =
                        LocalServices.getService(StatusBarManagerInternal.class);
@@ -3005,7 +3002,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        if (!mShowOngoingImeSwitcherForPhones) return false;
        if (mMenuController.getSwitchingDialogLocked() != null) return false;
        if (mWindowManagerInternal.isKeyguardShowingAndNotOccluded()
                && mKeyguardManager != null && mKeyguardManager.isKeyguardSecure()) return false;
                && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId())) {
            return false;
        }
        if ((visibility & InputMethodService.IME_ACTIVE) == 0
                || (visibility & InputMethodService.IME_INVISIBLE) != 0) {
            return false;
+2 −5
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;

import android.annotation.Nullable;
import android.app.AlertDialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
@@ -56,7 +55,6 @@ final class InputMethodMenuController {
    private final InputMethodUtils.InputMethodSettings mSettings;
    private final InputMethodSubtypeSwitchingController mSwitchingController;
    private final ArrayMap<String, InputMethodInfo> mMethodMap;
    private final KeyguardManager mKeyguardManager;
    private final WindowManagerInternal mWindowManagerInternal;

    private AlertDialog.Builder mDialogBuilder;
@@ -76,7 +74,6 @@ final class InputMethodMenuController {
        mSettings = mService.mSettings;
        mSwitchingController = mService.mSwitchingController;
        mMethodMap = mService.mMethodMap;
        mKeyguardManager = mService.mKeyguardManager;
        mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
    }

@@ -209,8 +206,8 @@ final class InputMethodMenuController {
    }

    private boolean isScreenLocked() {
        return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked()
                && mKeyguardManager.isKeyguardSecure();
        return mWindowManagerInternal.isKeyguardLocked()
                && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId());
    }

    void updateKeyboardFromSettingsLocked() {
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.ClipData;
import android.content.Context;
import android.graphics.Matrix;
@@ -451,6 +452,15 @@ public abstract class WindowManagerInternal {
    */
    public abstract boolean isKeyguardShowingAndNotOccluded();

    /**
     * Return whether the keyguard is secured by a PIN, pattern or password or a SIM card is
     * currently locked.
     *
     * @param userId User ID to be queried about.
     * @return {@code true} if a PIN, pattern or password is set or a SIM card is locked.
     */
    public abstract boolean isKeyguardSecure(@UserIdInt int userId);

    /**
     * Gets the frame of a window given its token.
     *
+5 −0
Original line number Diff line number Diff line
@@ -7762,6 +7762,11 @@ public class WindowManagerService extends IWindowManager.Stub
            return WindowManagerService.this.isKeyguardShowingAndNotOccluded();
        }

        @Override
        public boolean isKeyguardSecure(@UserIdInt int userId) {
            return mPolicy.isKeyguardSecure(userId);
        }

        @Override
        public void showGlobalActions() {
            WindowManagerService.this.showGlobalActions();