am 5bf7800d: Merge "Force keyguard if there are multiple users" into jb-mr1-dev

* commit '5bf7800de6d14a55d0c6ee006425fa79c3f8d21e':
  Force keyguard if there are multiple users
This commit is contained in:
Amith Yamasani
2012-09-10 18:15:10 -07:00
committed by Android Git Automerger
2 changed files with 12 additions and 5 deletions

View File

@@ -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>
@@ -56,7 +57,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -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;
}