summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/keyguard
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2014-11-12 19:29:51 -0800
committerJorim Jaggi <jjaggi@google.com>2014-11-20 21:36:52 +0100
commit52a6133f4ba8b1d08f5158d802790d6a1b16568d (patch)
tree80e4cf7088f82703f021a3b8b1ecc9861189b568 /packages/SystemUI/src/com/android/systemui/keyguard
parent419754545ea0768a7fa715daddedef75b7b31bfa (diff)
downloadframeworks_base-52a6133f4ba8b1d08f5158d802790d6a1b16568d.zip
frameworks_base-52a6133f4ba8b1d08f5158d802790d6a1b16568d.tar.gz
frameworks_base-52a6133f4ba8b1d08f5158d802790d6a1b16568d.tar.bz2
Add multi-sim support to keyguard
Use new telephony APIs. Clean up SIM state machine code. Use cached copy of SubscriptionInfo. Make SIM PIN and SIM PUK work. Tested on single and multi-SIM devices. Fixes bug 18147652 Change-Id: Ic69a4d2898999a5438e6a70b5851705bc05443f1
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/keyguard')
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 20e418c..5ec61fa 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -42,6 +42,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.EventLog;
import android.util.Log;
@@ -56,6 +57,7 @@ import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardShowCallback;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardConstants;
import com.android.keyguard.KeyguardDisplayManager;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -115,7 +117,8 @@ public class KeyguardViewMediator extends SystemUI {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000;
- final static boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
+ private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
private final static boolean DBG_WAKE = false;
private final static String TAG = "KeyguardViewMediator";
@@ -358,8 +361,12 @@ public class KeyguardViewMediator extends SystemUI {
}
@Override
- public void onSimStateChanged(IccCardConstants.State simState) {
- if (DEBUG) Log.d(TAG, "onSimStateChanged: " + simState);
+ public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
+
+ if (DEBUG_SIM_STATES) {
+ Log.d(TAG, "onSimStateChanged(subId=" + subId + ", slotId=" + slotId
+ + ",state=" + simState + ")");
+ }
switch (simState) {
case NOT_READY:
@@ -369,7 +376,7 @@ public class KeyguardViewMediator extends SystemUI {
synchronized (this) {
if (shouldWaitForProvisioning()) {
if (!isShowing()) {
- if (DEBUG) Log.d(TAG, "ICC_ABSENT isn't showing,"
+ if (DEBUG_SIM_STATES) Log.d(TAG, "ICC_ABSENT isn't showing,"
+ " we need to show the keyguard since the "
+ "device isn't provisioned yet.");
doKeyguardLocked(null);
@@ -383,7 +390,8 @@ public class KeyguardViewMediator extends SystemUI {
case PUK_REQUIRED:
synchronized (this) {
if (!isShowing()) {
- if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't "
+ if (DEBUG_SIM_STATES) Log.d(TAG,
+ "INTENT_VALUE_ICC_LOCKED and keygaurd isn't "
+ "showing; need to show keyguard so user can enter sim pin");
doKeyguardLocked(null);
} else {
@@ -394,11 +402,11 @@ public class KeyguardViewMediator extends SystemUI {
case PERM_DISABLED:
synchronized (this) {
if (!isShowing()) {
- if (DEBUG) Log.d(TAG, "PERM_DISABLED and "
+ if (DEBUG_SIM_STATES) Log.d(TAG, "PERM_DISABLED and "
+ "keygaurd isn't showing.");
doKeyguardLocked(null);
} else {
- if (DEBUG) Log.d(TAG, "PERM_DISABLED, resetStateLocked to"
+ if (DEBUG_SIM_STATES) Log.d(TAG, "PERM_DISABLED, resetStateLocked to"
+ "show permanently disabled message in lockscreen.");
resetStateLocked();
}
@@ -411,6 +419,9 @@ public class KeyguardViewMediator extends SystemUI {
}
}
break;
+ default:
+ if (DEBUG_SIM_STATES) Log.v(TAG, "Ignoring state: " + simState);
+ break;
}
}
@@ -909,13 +920,13 @@ public class KeyguardViewMediator extends SystemUI {
}
// if the setup wizard hasn't run yet, don't show
- final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim",
- false);
- final IccCardConstants.State state = mUpdateMonitor.getSimState();
- final boolean lockedOrMissing = state.isPinLocked()
- || ((state == IccCardConstants.State.ABSENT
- || state == IccCardConstants.State.PERM_DISABLED)
- && requireSim);
+ final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false);
+ final boolean absent = mUpdateMonitor.getNextSubIdForState(
+ IccCardConstants.State.ABSENT) != SubscriptionManager.INVALID_SUB_ID;
+ final boolean disabled = mUpdateMonitor.getNextSubIdForState(
+ IccCardConstants.State.PERM_DISABLED) != SubscriptionManager.INVALID_SUB_ID;
+ final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure()
+ || ((absent || disabled) && requireSim);
if (!lockedOrMissing && shouldWaitForProvisioning()) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"