summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/CarrierTextController.java45
-rw-r--r--packages/SystemUI/src/com/android/keyguard/EmergencyButton.java3
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityModel.java6
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java71
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java33
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java18
12 files changed, 103 insertions, 121 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
index 21b52c1e5b57..06aba405fa3e 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
@@ -38,7 +38,6 @@ import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
-import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.WirelessUtils;
import com.android.systemui.Dependency;
@@ -106,7 +105,7 @@ public class CarrierTextController {
updateCarrierText();
}
- public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
if (slotId < 0 || slotId >= mSimSlotsNumber) {
Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId
+ " mTelephonyCapable: " + Boolean.toString(mTelephonyCapable));
@@ -191,7 +190,7 @@ public class CarrierTextController {
CharSequence[] carrierNames, int[] subOrderBySlot, boolean noSims) {
final CharSequence carrier = "";
CharSequence carrierTextForSimIOError = getCarrierTextForSimState(
- IccCardConstants.State.CARD_IO_ERROR, carrier);
+ TelephonyManager.SIM_STATE_CARD_IO_ERROR, carrier);
// mSimErrorState has the state of each sim indexed by slotID.
for (int index = 0; index < getTelephonyManager().getActiveModemCount(); index++) {
if (!mSimErrorState[index]) {
@@ -288,7 +287,7 @@ public class CarrierTextController {
carrierNames[i] = "";
subsIds[i] = subId;
subOrderBySlot[subs.get(i).getSimSlotIndex()] = i;
- IccCardConstants.State simState = mKeyguardUpdateMonitor.getSimState(subId);
+ int simState = mKeyguardUpdateMonitor.getSimState(subId);
CharSequence carrierName = subs.get(i).getCarrierName();
CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName);
if (DEBUG) {
@@ -298,7 +297,7 @@ public class CarrierTextController {
allSimsMissing = false;
carrierNames[i] = carrierTextForSimState;
}
- if (simState == IccCardConstants.State.READY) {
+ if (simState == TelephonyManager.SIM_STATE_READY) {
ServiceState ss = mKeyguardUpdateMonitor.mServiceStates.get(subId);
if (ss != null && ss.getDataRegState() == ServiceState.STATE_IN_SERVICE) {
// hack for WFC (IWLAN) not turning off immediately once
@@ -406,8 +405,7 @@ public class CarrierTextController {
*
* @return Carrier text if not in missing state, null otherwise.
*/
- private CharSequence getCarrierTextForSimState(IccCardConstants.State simState,
- CharSequence text) {
+ private CharSequence getCarrierTextForSimState(int simState, CharSequence text) {
CharSequence carrierText = null;
CarrierTextController.StatusMode status = getStatusForIccState(simState);
switch (status) {
@@ -498,37 +496,32 @@ public class CarrierTextController {
/**
* Determine the current status of the lock screen given the SIM state and other stuff.
*/
- private CarrierTextController.StatusMode getStatusForIccState(IccCardConstants.State simState) {
- // Since reading the SIM may take a while, we assume it is present until told otherwise.
- if (simState == null) {
- return CarrierTextController.StatusMode.Normal;
- }
-
+ private CarrierTextController.StatusMode getStatusForIccState(int simState) {
final boolean missingAndNotProvisioned =
!Dependency.get(KeyguardUpdateMonitor.class).isDeviceProvisioned()
- && (simState == IccCardConstants.State.ABSENT
- || simState == IccCardConstants.State.PERM_DISABLED);
+ && (simState == TelephonyManager.SIM_STATE_ABSENT
+ || simState == TelephonyManager.SIM_STATE_PERM_DISABLED);
// Assume we're NETWORK_LOCKED if not provisioned
- simState = missingAndNotProvisioned ? IccCardConstants.State.NETWORK_LOCKED : simState;
+ simState = missingAndNotProvisioned ? TelephonyManager.SIM_STATE_NETWORK_LOCKED : simState;
switch (simState) {
- case ABSENT:
+ case TelephonyManager.SIM_STATE_ABSENT:
return CarrierTextController.StatusMode.SimMissing;
- case NETWORK_LOCKED:
+ case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
return CarrierTextController.StatusMode.SimMissingLocked;
- case NOT_READY:
+ case TelephonyManager.SIM_STATE_NOT_READY:
return CarrierTextController.StatusMode.SimNotReady;
- case PIN_REQUIRED:
+ case TelephonyManager.SIM_STATE_PIN_REQUIRED:
return CarrierTextController.StatusMode.SimLocked;
- case PUK_REQUIRED:
+ case TelephonyManager.SIM_STATE_PUK_REQUIRED:
return CarrierTextController.StatusMode.SimPukLocked;
- case READY:
+ case TelephonyManager.SIM_STATE_READY:
return CarrierTextController.StatusMode.Normal;
- case PERM_DISABLED:
+ case TelephonyManager.SIM_STATE_PERM_DISABLED:
return CarrierTextController.StatusMode.SimPermDisabled;
- case UNKNOWN:
+ case TelephonyManager.SIM_STATE_UNKNOWN:
return CarrierTextController.StatusMode.SimUnknown;
- case CARD_IO_ERROR:
+ case TelephonyManager.SIM_STATE_CARD_IO_ERROR:
return CarrierTextController.StatusMode.SimIoError;
}
return CarrierTextController.StatusMode.SimUnknown;
@@ -575,7 +568,7 @@ public class CarrierTextController {
return list;
}
- private CharSequence getCarrierHelpTextForSimState(IccCardConstants.State simState,
+ private CharSequence getCarrierHelpTextForSimState(int simState,
String plmn, String spn) {
int carrierHelpTextId = 0;
CarrierTextController.StatusMode status = getStatusForIccState(simState);
diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
index ecd8c8d34aa2..867014b6b5e1 100644
--- a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java
@@ -37,7 +37,6 @@ import android.widget.Button;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.util.EmergencyAffordanceManager;
import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.Dependency;
@@ -59,7 +58,7 @@ public class EmergencyButton extends Button {
KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
@Override
- public void onSimStateChanged(int subId, int slotId, State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
updateEmergencyCallButton();
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityModel.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityModel.java
index 64b4d32f3a1f..17abfae3c7e1 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityModel.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityModel.java
@@ -20,8 +20,8 @@ import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
-import com.android.internal.telephony.IccCardConstants;
import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.Dependency;
@@ -66,12 +66,12 @@ public class KeyguardSecurityModel {
KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);
if (mIsPukScreenAvailable && SubscriptionManager.isValidSubscriptionId(
- monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED))) {
+ monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PUK_REQUIRED))) {
return SecurityMode.SimPuk;
}
if (SubscriptionManager.isValidSubscriptionId(
- monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED))) {
+ monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PIN_REQUIRED))) {
return SecurityMode.SimPin;
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
index b1502b9a0d63..b960de58789b 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
@@ -38,8 +38,6 @@ import android.view.WindowManager;
import android.widget.ImageView;
import com.android.internal.telephony.ITelephony;
-import com.android.internal.telephony.IccCardConstants;
-import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.PhoneConstants;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -66,10 +64,10 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
@Override
- public void onSimStateChanged(int subId, int slotId, State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
switch(simState) {
- case READY: {
+ case TelephonyManager.SIM_STATE_READY: {
mRemainingAttempts = -1;
resetState();
break;
@@ -157,7 +155,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
private void handleSubInfoChangeIfNeeded() {
KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);
- int subId = monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED);
+ int subId = monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PIN_REQUIRED);
if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
mSubId = subId;
mShowDefaultMessage = true;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
index 70237a053e1e..7e08ab385020 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
@@ -37,8 +37,6 @@ import android.view.WindowManager;
import android.widget.ImageView;
import com.android.internal.telephony.ITelephony;
-import com.android.internal.telephony.IccCardConstants;
-import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.PhoneConstants;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -69,12 +67,12 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
@Override
- public void onSimStateChanged(int subId, int slotId, State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
switch(simState) {
// If the SIM is unlocked via a key sequence through the emergency dialer, it will
// move into the READY state and the PUK lock keyguard should be removed.
- case READY: {
+ case TelephonyManager.SIM_STATE_READY: {
mRemainingAttempts = -1;
mShowDefaultMessage = true;
// mCallback can be null if onSimStateChanged callback is called when keyguard
@@ -210,7 +208,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
private void handleSubInfoChangeIfNeeded() {
KeyguardUpdateMonitor monitor = Dependency.get(KeyguardUpdateMonitor.class);
- int subId = monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED);
+ int subId = monitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PUK_REQUIRED);
if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
mSubId = subId;
mShowDefaultMessage = true;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 0b0922a7766f..1d4b9ef0b625 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -93,7 +93,6 @@ import android.util.SparseBooleanArray;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.IccCardConstants;
-import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.widget.LockPatternUtils;
@@ -1055,7 +1054,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// and processed previously.
if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) {
// Guarantee mTelephonyCapable state after SysUI crash and restart
- if (args.simState == State.ABSENT) {
+ if (args.simState == TelephonyManager.SIM_STATE_ABSENT) {
mHandler.obtainMessage(MSG_TELEPHONY_CAPABLE, true).sendToTarget();
}
return;
@@ -1226,18 +1225,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* the intent and provide a {@link SimCard.State} result.
*/
private static class SimData {
- public State simState;
+ public int simState;
public int slotId;
public int subId;
- SimData(State state, int slot, int id) {
+ SimData(int state, int slot, int id) {
simState = state;
slotId = slot;
subId = id;
}
static SimData fromIntent(Intent intent) {
- State state;
+ int state;
if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {
throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED");
}
@@ -1251,33 +1250,33 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (IccCardConstants.INTENT_VALUE_ABSENT_ON_PERM_DISABLED.equals(
absentReason)) {
- state = IccCardConstants.State.PERM_DISABLED;
+ state = TelephonyManager.SIM_STATE_PERM_DISABLED;
} else {
- state = IccCardConstants.State.ABSENT;
+ state = TelephonyManager.SIM_STATE_ABSENT;
}
} else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
- state = IccCardConstants.State.READY;
+ state = TelephonyManager.SIM_STATE_READY;
} else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
final String lockedReason = intent
.getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON);
if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
- state = IccCardConstants.State.PIN_REQUIRED;
+ state = TelephonyManager.SIM_STATE_PIN_REQUIRED;
} else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
- state = IccCardConstants.State.PUK_REQUIRED;
+ state = TelephonyManager.SIM_STATE_PUK_REQUIRED;
} else {
- state = IccCardConstants.State.UNKNOWN;
+ state = TelephonyManager.SIM_STATE_UNKNOWN;
}
} else if (IccCardConstants.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) {
- state = IccCardConstants.State.NETWORK_LOCKED;
+ state = TelephonyManager.SIM_STATE_NETWORK_LOCKED;
} else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) {
- state = IccCardConstants.State.CARD_IO_ERROR;
+ state = TelephonyManager.SIM_STATE_CARD_IO_ERROR;
} else if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)
|| IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)) {
// This is required because telephony doesn't return to "READY" after
// these state transitions. See bug 7197471.
- state = IccCardConstants.State.READY;
+ state = TelephonyManager.SIM_STATE_READY;
} else {
- state = IccCardConstants.State.UNKNOWN;
+ state = TelephonyManager.SIM_STATE_UNKNOWN;
}
return new SimData(state, slotId, subId);
}
@@ -1525,7 +1524,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
handleBatteryUpdate((BatteryStatus) msg.obj);
break;
case MSG_SIM_STATE_CHANGE:
- handleSimStateChange(msg.arg1, msg.arg2, (State) msg.obj);
+ handleSimStateChange(msg.arg1, msg.arg2, (int) msg.obj);
break;
case MSG_RINGER_MODE_CHANGED:
handleRingerModeChange(msg.arg1);
@@ -2260,7 +2259,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* Handle {@link #MSG_SIM_STATE_CHANGE}
*/
@VisibleForTesting
- void handleSimStateChange(int subId, int slotId, State state) {
+ void handleSimStateChange(int subId, int slotId, int state) {
checkIsHandlerThread();
if (DEBUG_SIM_STATES) {
Log.d(TAG, "handleSimStateChange(subId=" + subId + ", slotId="
@@ -2272,7 +2271,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
Log.w(TAG, "invalid subId in handleSimStateChange()");
/* Only handle No SIM(ABSENT) and Card Error(CARD_IO_ERROR) due to
* handleServiceStateChange() handle other case */
- if (state == State.ABSENT) {
+ if (state == TelephonyManager.SIM_STATE_ABSENT) {
updateTelephonyCapable(true);
// Even though the subscription is not valid anymore, we need to notify that the
// SIM card was removed so we can update the UI.
@@ -2281,10 +2280,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// Set the SIM state of all SimData associated with that slot to ABSENT se we
// do not move back into PIN/PUK locked and not detect the change below.
if (data.slotId == slotId) {
- data.simState = State.ABSENT;
+ data.simState = TelephonyManager.SIM_STATE_ABSENT;
}
}
- } else if (state == State.CARD_IO_ERROR) {
+ } else if (state == TelephonyManager.SIM_STATE_CARD_IO_ERROR) {
updateTelephonyCapable(true);
} else {
return;
@@ -2303,7 +2302,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
data.subId = subId;
data.slotId = slotId;
}
- if ((changed || becameAbsent) && state != State.UNKNOWN) {
+ if ((changed || becameAbsent) && state != TelephonyManager.SIM_STATE_UNKNOWN) {
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
@@ -2542,7 +2541,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
@MainThread
public void reportSimUnlocked(int subId) {
if (DEBUG_SIM_STATES) Log.v(TAG, "reportSimUnlocked(subId=" + subId + ")");
- handleSimStateChange(subId, getSlotId(subId), State.READY);
+ handleSimStateChange(subId, getSlotId(subId), TelephonyManager.SIM_STATE_READY);
}
/**
@@ -2607,11 +2606,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
return false;
}
- public State getSimState(int subId) {
+ public int getSimState(int subId) {
if (mSimDatas.containsKey(subId)) {
return mSimDatas.get(subId).simState;
} else {
- return State.UNKNOWN;
+ return TelephonyManager.SIM_STATE_UNKNOWN;
}
}
@@ -2644,22 +2643,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* @return true if and only if the state has changed for the specified {@code slotId}
*/
private boolean refreshSimState(int subId, int slotId) {
-
- // This is awful. It exists because there are two APIs for getting the SIM status
- // that don't return the complete set of values and have different types. In Keyguard we
- // need IccCardConstants, but TelephonyManager would only give us
- // TelephonyManager.SIM_STATE*, so we retrieve it manually.
final TelephonyManager tele =
(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
- int simState = (tele != null) ?
+ int state = (tele != null) ?
tele.getSimState(slotId) : TelephonyManager.SIM_STATE_UNKNOWN;
- State state;
- try {
- state = State.intToState(simState);
- } catch (IllegalArgumentException ex) {
- Log.w(TAG, "Unknown sim state: " + simState);
- state = State.UNKNOWN;
- }
SimData data = mSimDatas.get(subId);
final boolean changed;
if (data == null) {
@@ -2676,10 +2663,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
/**
* If the {@code state} is currently requiring a SIM PIN, PUK, or is disabled.
*/
- public static boolean isSimPinSecure(IccCardConstants.State state) {
- return (state == IccCardConstants.State.PIN_REQUIRED
- || state == IccCardConstants.State.PUK_REQUIRED
- || state == IccCardConstants.State.PERM_DISABLED);
+ public static boolean isSimPinSecure(int state) {
+ return (state == TelephonyManager.SIM_STATE_PIN_REQUIRED
+ || state == TelephonyManager.SIM_STATE_PUK_REQUIRED
+ || state == TelephonyManager.SIM_STATE_PERM_DISABLED);
}
public DisplayClientState getCachedDisplayClientState() {
@@ -2741,7 +2728,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
*
* @return subid or {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID} if none found
*/
- public int getNextSubIdForState(State state) {
+ public int getNextSubIdForState(int state) {
List<SubscriptionInfo> list = getSubscriptionInfo(false /* forceReload */);
int resultId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
int bestSlotId = Integer.MAX_VALUE; // Favor lowest slot first
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 0fef755b5aba..b4b83d67d36e 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -23,7 +23,6 @@ import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.view.WindowManagerPolicyConstants;
-import com.android.internal.telephony.IccCardConstants;
import com.android.systemui.statusbar.KeyguardIndicationController;
import java.util.TimeZone;
@@ -136,7 +135,7 @@ public class KeyguardUpdateMonitorCallback {
* @param slotId
* @param simState
*/
- public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { }
+ public void onSimStateChanged(int subId, int slotId, int simState) { }
/**
* Called when the user's info changed.
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index c876fa6984df..f026e686afe5 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -18,9 +18,6 @@ package com.android.systemui.keyguard;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-import static com.android.internal.telephony.IccCardConstants.State.ABSENT;
-import static com.android.internal.telephony.IccCardConstants.State.PIN_REQUIRED;
-import static com.android.internal.telephony.IccCardConstants.State.PUK_REQUIRED;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT;
@@ -61,7 +58,7 @@ import android.telephony.TelephonyManager;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
-import android.util.SparseArray;
+import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManagerPolicyConstants;
@@ -72,7 +69,6 @@ import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IKeyguardDrawnCallback;
import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardStateCallback;
-import com.android.internal.telephony.IccCardConstants;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardConstants;
@@ -293,7 +289,7 @@ public class KeyguardViewMediator extends SystemUI {
* Last SIM state reported by the telephony system.
* Index is the slotId - in case of multiple SIM cards.
*/
- private final SparseArray<IccCardConstants.State> mLastSimStates = new SparseArray<>();
+ private final SparseIntArray mLastSimStates = new SparseIntArray();
private boolean mDeviceInteractive;
private boolean mGoingToSleep;
@@ -433,7 +429,7 @@ public class KeyguardViewMediator extends SystemUI {
}
@Override
- public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
if (DEBUG_SIM_STATES) {
Log.d(TAG, "onSimStateChanged(subId=" + subId + ", slotId=" + slotId
@@ -455,14 +451,15 @@ public class KeyguardViewMediator extends SystemUI {
boolean simWasLocked;
synchronized (KeyguardViewMediator.this) {
- IccCardConstants.State lastState = mLastSimStates.get(slotId);
- simWasLocked = (lastState == PIN_REQUIRED || lastState == PUK_REQUIRED);
+ int lastState = mLastSimStates.get(slotId);
+ simWasLocked = (lastState == TelephonyManager.SIM_STATE_PIN_REQUIRED
+ || lastState == TelephonyManager.SIM_STATE_PUK_REQUIRED);
mLastSimStates.append(slotId, simState);
}
switch (simState) {
- case NOT_READY:
- case ABSENT:
+ case TelephonyManager.SIM_STATE_NOT_READY:
+ case TelephonyManager.SIM_STATE_ABSENT:
// only force lock screen in case of missing sim if user hasn't
// gone through setup wizard
synchronized (KeyguardViewMediator.this) {
@@ -476,7 +473,7 @@ public class KeyguardViewMediator extends SystemUI {
resetStateLocked();
}
}
- if (simState == ABSENT) {
+ if (simState == TelephonyManager.SIM_STATE_ABSENT) {
// MVNO SIMs can become transiently NOT_READY when switching networks,
// so we should only lock when they are ABSENT.
if (simWasLocked) {
@@ -487,8 +484,8 @@ public class KeyguardViewMediator extends SystemUI {
}
}
break;
- case PIN_REQUIRED:
- case PUK_REQUIRED:
+ case TelephonyManager.SIM_STATE_PIN_REQUIRED:
+ case TelephonyManager.SIM_STATE_PUK_REQUIRED:
synchronized (KeyguardViewMediator.this) {
if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG,
@@ -500,7 +497,7 @@ public class KeyguardViewMediator extends SystemUI {
}
}
break;
- case PERM_DISABLED:
+ case TelephonyManager.SIM_STATE_PERM_DISABLED:
synchronized (KeyguardViewMediator.this) {
if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG, "PERM_DISABLED and "
@@ -513,7 +510,7 @@ public class KeyguardViewMediator extends SystemUI {
}
}
break;
- case READY:
+ case TelephonyManager.SIM_STATE_READY:
synchronized (KeyguardViewMediator.this) {
if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
if (mShowing && simWasLocked) {
@@ -1334,9 +1331,9 @@ 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 boolean absent = SubscriptionManager.isValidSubscriptionId(
- mUpdateMonitor.getNextSubIdForState(ABSENT));
+ mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_ABSENT));
final boolean disabled = SubscriptionManager.isValidSubscriptionId(
- mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.PERM_DISABLED));
+ mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PERM_DISABLED));
final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure()
|| ((absent || disabled) && requireSim);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
index 843c37f84973..0a7ee3b0ebf0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
@@ -20,11 +20,11 @@ import android.net.ConnectivityManager;
import android.os.Bundle;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;
-import com.android.internal.telephony.IccCardConstants.State;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.settingslib.WirelessUtils;
@@ -138,9 +138,9 @@ public class OperatorNameView extends TextView implements DemoMode, DarkReceiver
final int N = subs.size();
for (int i = 0; i < N; i++) {
int subId = subs.get(i).getSubscriptionId();
- State simState = mKeyguardUpdateMonitor.getSimState(subId);
+ int simState = mKeyguardUpdateMonitor.getSimState(subId);
CharSequence carrierName = subs.get(i).getCarrierName();
- if (!TextUtils.isEmpty(carrierName) && simState == State.READY) {
+ if (!TextUtils.isEmpty(carrierName) && simState == TelephonyManager.SIM_STATE_READY) {
ServiceState ss = mKeyguardUpdateMonitor.getServiceState(subId);
if (ss != null && ss.getState() == ServiceState.STATE_IN_SERVICE) {
displayText = carrierName;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 4927ec8a9a47..60589843002e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -39,7 +39,6 @@ import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.Nullable;
import com.android.internal.graphics.ColorUtils;
-import com.android.internal.telephony.IccCardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.Dependency;
@@ -154,8 +153,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
new KeyguardUpdateMonitorCallback() {
@Override
- public void onSimStateChanged(int subId, int slotId,
- IccCardConstants.State simState) {
+ public void onSimStateChanged(int subId, int slotId, int simState) {
mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
update();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 01cd2b49d059..bfecaaab46b9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -33,6 +33,7 @@ import android.os.UserManager;
import android.provider.Settings.Global;
import android.service.notification.ZenModeConfig;
import android.telecom.TelecomManager;
+import android.telephony.TelephonyManager;
import android.text.format.DateFormat;
import android.util.Log;
@@ -127,7 +128,7 @@ public class PhoneStatusBarPolicy
// Assume it's all good unless we hear otherwise. We don't always seem
// to get broadcasts that it *is* there.
- IccCardConstants.State mSimState = IccCardConstants.State.READY;
+ int mSimState = TelephonyManager.SIM_STATE_READY;
private boolean mZenVisible;
private boolean mVolumeVisible;
@@ -307,25 +308,25 @@ public class PhoneStatusBarPolicy
private final void updateSimState(Intent intent) {
String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
- mSimState = IccCardConstants.State.ABSENT;
+ mSimState = TelephonyManager.SIM_STATE_READY;
} else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) {
- mSimState = IccCardConstants.State.CARD_IO_ERROR;
+ mSimState = TelephonyManager.SIM_STATE_CARD_IO_ERROR;
} else if (IccCardConstants.INTENT_VALUE_ICC_CARD_RESTRICTED.equals(stateExtra)) {
- mSimState = IccCardConstants.State.CARD_RESTRICTED;
+ mSimState = TelephonyManager.SIM_STATE_CARD_RESTRICTED;
} else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
- mSimState = IccCardConstants.State.READY;
+ mSimState = TelephonyManager.SIM_STATE_READY;
} else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
final String lockedReason =
intent.getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON);
if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
- mSimState = IccCardConstants.State.PIN_REQUIRED;
+ mSimState = TelephonyManager.SIM_STATE_PIN_REQUIRED;
} else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
- mSimState = IccCardConstants.State.PUK_REQUIRED;
+ mSimState = TelephonyManager.SIM_STATE_PUK_REQUIRED;
} else {
- mSimState = IccCardConstants.State.NETWORK_LOCKED;
+ mSimState = TelephonyManager.SIM_STATE_NETWORK_LOCKED;
}
} else {
- mSimState = IccCardConstants.State.UNKNOWN;
+ mSimState = TelephonyManager.SIM_STATE_UNKNOWN;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java
index 353d6a4970af..e675a7f373b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EmergencyCryptkeeperText.java
@@ -24,11 +24,11 @@ import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;
-import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -83,6 +83,18 @@ public class EmergencyCryptkeeperText extends TextView {
getContext().unregisterReceiver(mReceiver);
}
+ private boolean iccCardExist(int simState) {
+ return ((simState == TelephonyManager.SIM_STATE_PIN_REQUIRED)
+ || (simState == TelephonyManager.SIM_STATE_PUK_REQUIRED)
+ || (simState == TelephonyManager.SIM_STATE_NETWORK_LOCKED)
+ || (simState == TelephonyManager.SIM_STATE_READY)
+ || (simState == TelephonyManager.SIM_STATE_NOT_READY)
+ || (simState == TelephonyManager.SIM_STATE_PERM_DISABLED)
+ || (simState == TelephonyManager.SIM_STATE_CARD_IO_ERROR)
+ || (simState == TelephonyManager.SIM_STATE_CARD_RESTRICTED)
+ || (simState == TelephonyManager.SIM_STATE_LOADED));
+ }
+
public void update() {
boolean hasMobile = ConnectivityManager.from(mContext)
.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
@@ -102,9 +114,9 @@ public class EmergencyCryptkeeperText extends TextView {
final int N = subs.size();
for (int i = 0; i < N; i++) {
int subId = subs.get(i).getSubscriptionId();
- IccCardConstants.State simState = mKeyguardUpdateMonitor.getSimState(subId);
+ int simState = mKeyguardUpdateMonitor.getSimState(subId);
CharSequence carrierName = subs.get(i).getCarrierName();
- if (simState.iccCardExist() && !TextUtils.isEmpty(carrierName)) {
+ if (iccCardExist(simState) && !TextUtils.isEmpty(carrierName)) {
allSimsMissing = false;
displayText = carrierName;
}