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

Commit 327424d6 authored by Adam Cohen's avatar Adam Cohen Committed by Android (Google) Code Review
Browse files

Merge "Plumbing to allow keyguard to be shown with user switcher (issue 7175023)" into jb-mr1-dev

parents 284b2053 f752202b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.IRemoteCallback;
import android.view.IApplicationToken;
import android.view.IDisplayContentChangeListener;
@@ -209,9 +210,9 @@ interface IWindowManager
    boolean hasNavigationBar();

    /**
     * Lock the device immediately.
     * Lock the device immediately with the specified options (can be null).
     */
    void lockNow();
    void lockNow(in Bundle options);

    /**
     * Gets the token for the focused window.
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.view.animation.Animation;
@@ -1096,7 +1097,7 @@ public interface WindowManagerPolicy {
    /**
     * Lock the device now.
     */
    public void lockNow();
    public void lockNow(Bundle options);

    /**
     * Set the last used input method window state. This state is used to make IME transition
+21 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
@@ -98,6 +99,26 @@ public class LockPatternUtils {
     */
    public static final int MIN_PATTERN_REGISTER_FAIL = MIN_LOCK_PATTERN_SIZE;

    /**
     * Tells the keyguard to show the user switcher when the keyguard is created.
     */
    public static final String KEYGUARD_SHOW_USER_SWITCHER = "showuserswitcher";

    /**
     * Tells the keyguard to show the security challenge when the keyguard is created.
     */
    public static final String KEYGUARD_SHOW_SECURITY_CHALLENGE = "showsecuritychallenge";

    /**
     * Options used to lock the device upon user switch.
     */
    public static final Bundle USER_SWITCH_LOCK_OPTIONS = new Bundle();

    static {
        USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_USER_SWITCHER, true);
        USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_SECURITY_CHALLENGE, true);
    }

    /**
     * The bit in LOCK_BIOMETRIC_WEAK_FLAGS to be used to indicate whether liveliness should
     * be used
+19 −4
Original line number Diff line number Diff line
@@ -4047,21 +4047,36 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    Runnable mScreenLockTimeout = new Runnable() {
    class ScreenLockTimeout implements Runnable {
        Bundle options;

        @Override
        public void run() {
            synchronized (this) {
                if (localLOGV) Log.v(TAG, "mScreenLockTimeout activating keyguard");
                if (mKeyguardMediator != null) {
                    mKeyguardMediator.doKeyguardTimeout();
                    mKeyguardMediator.doKeyguardTimeout(options);
                }
                mLockScreenTimerActive = false;
                options = null;
            }
        }

        public void setLockOptions(Bundle options) {
            this.options = options;
        }
    }
    };

    public void lockNow() {
    ScreenLockTimeout mScreenLockTimeout = new ScreenLockTimeout();

    public void lockNow(Bundle options) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
        mHandler.removeCallbacks(mScreenLockTimeout);
        if (options != null) {
            // In case multiple calls are made to lockNow, we don't wipe out the options
            // until the runnable actually executes.
            mScreenLockTimeout.setLockOptions(options);
        }
        mHandler.post(mScreenLockTimeout);
    }

+0 −6
Original line number Diff line number Diff line
@@ -119,12 +119,6 @@ public class KeyguardMultiUserSelectorView extends FrameLayout implements View.O
                public void run() {
                    try {
                        ActivityManagerNative.getDefault().switchUser(avatar.getUserInfo().id);
                        WindowManagerGlobal.getWindowManagerService().lockNow();
                        // Set the new active user, and make it appear active
                        avatar.resetPressedState();
                        mCallback.showSecurityView();
                        mActiveUserAvatar = avatar;
                        mActiveUserAvatar.setActive(true, false, 0, null);
                    } catch (RemoteException re) {
                        Log.e(TAG, "Couldn't switch user " + re);
                    }
Loading