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

Commit b70ff9a1 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Force keyguard if there are multiple users

Otherwise there would be no way to switch users if a user chooses None as lock screen.

Also adjust some layout params for Preference items to align the icons and text.

Change-Id: Ib11bb961edaef90de280bc7137d10b68765aea98
parent 25c925e6
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -33,11 +33,12 @@
        android:orientation="horizontal">
        <ImageView
            android:id="@+android:id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_gravity="center"
            android:minWidth="48dp"
            android:paddingRight="@dimen/preference_item_padding_inner"
            android:scaleType="centerInside"
            android:layout_marginEnd="@dimen/preference_item_padding_inner"
             />
    </LinearLayout>

+7 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.EventLog;
@@ -161,6 +162,9 @@ public class KeyguardViewMediator {
    /** High level access to the power manager for WakeLocks */
    private PowerManager mPM;

    /** UserManager for querying number of users */
    private UserManager mUserManager;

    /**
     * Used to keep the device awake while the keyguard is showing, i.e for
     * calls to {@link #pokeWakelock()}
@@ -436,6 +440,7 @@ public class KeyguardViewMediator {
    public KeyguardViewMediator(Context context, LockPatternUtils lockPatternUtils) {
        mContext = context;
        mPM = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        mWakeLock = mPM.newWakeLock(
                PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "keyguard");
        mWakeLock.setReferenceCounted(false);
@@ -779,7 +784,8 @@ public class KeyguardViewMediator {
            return;
        }

        if (mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
        if (mUserManager.getUsers().size() < 2
                && mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
            return;
        }