Skip to content

Commit b70ff9a

Browse files
author
Amith Yamasani
committed
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
1 parent 25c925e commit b70ff9a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

core/res/res/layout/preference_holo.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
android:orientation="horizontal">
3434
<ImageView
3535
android:id="@+android:id/icon"
36-
android:layout_width="wrap_content"
37-
android:layout_height="wrap_content"
36+
android:layout_width="48dp"
37+
android:layout_height="48dp"
3838
android:layout_gravity="center"
3939
android:minWidth="48dp"
40-
android:paddingRight="@dimen/preference_item_padding_inner"
40+
android:scaleType="centerInside"
41+
android:layout_marginEnd="@dimen/preference_item_padding_inner"
4142
/>
4243
</LinearLayout>
4344

@@ -56,7 +57,7 @@
5657
android:textAppearance="?android:attr/textAppearanceMedium"
5758
android:ellipsize="marquee"
5859
android:fadingEdge="horizontal" />
59-
60+
6061
<TextView android:id="@+android:id/summary"
6162
android:layout_width="wrap_content"
6263
android:layout_height="wrap_content"

policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import android.os.SystemClock;
4242
import android.os.SystemProperties;
4343
import android.os.UserHandle;
44+
import android.os.UserManager;
4445
import android.provider.Settings;
4546
import android.telephony.TelephonyManager;
4647
import android.util.EventLog;
@@ -161,6 +162,9 @@ public class KeyguardViewMediator {
161162
/** High level access to the power manager for WakeLocks */
162163
private PowerManager mPM;
163164

165+
/** UserManager for querying number of users */
166+
private UserManager mUserManager;
167+
164168
/**
165169
* Used to keep the device awake while the keyguard is showing, i.e for
166170
* calls to {@link #pokeWakelock()}
@@ -436,6 +440,7 @@ public void pokeWakelock(long holdMs) {
436440
public KeyguardViewMediator(Context context, LockPatternUtils lockPatternUtils) {
437441
mContext = context;
438442
mPM = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
443+
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
439444
mWakeLock = mPM.newWakeLock(
440445
PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "keyguard");
441446
mWakeLock.setReferenceCounted(false);
@@ -779,7 +784,8 @@ private void doKeyguardLocked() {
779784
return;
780785
}
781786

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

0 commit comments

Comments
 (0)