Merge "Add change to show Invalid card when erroneous card is inserted." am: 4bc825aecc am: 8279494137
am: 9778539847
Change-Id: Ie5915e645a4e7a35fd934f54d6d3bf25ad4fcca3
This commit is contained in:
@@ -48,6 +48,9 @@
|
|||||||
to unlock the keyguard. Displayed in one line in a large font. -->
|
to unlock the keyguard. Displayed in one line in a large font. -->
|
||||||
<string name="keyguard_password_wrong_pin_code">Incorrect PIN code.</string>
|
<string name="keyguard_password_wrong_pin_code">Incorrect PIN code.</string>
|
||||||
|
|
||||||
|
<!-- Shown in the lock screen when there is SIM card IO error. -->
|
||||||
|
<string name="keyguard_sim_error_message_short">Invalid Card.</string>
|
||||||
|
|
||||||
<!-- When the lock screen is showing, the phone is plugged in and the battery is fully
|
<!-- When the lock screen is showing, the phone is plugged in and the battery is fully
|
||||||
charged, say that it is charged. -->
|
charged, say that it is charged. -->
|
||||||
<string name="keyguard_charged">Charged</string>
|
<string name="keyguard_charged">Charged</string>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.android.internal.telephony.IccCardConstants;
|
|||||||
import com.android.internal.telephony.IccCardConstants.State;
|
import com.android.internal.telephony.IccCardConstants.State;
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.settingslib.WirelessUtils;
|
import com.android.settingslib.WirelessUtils;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
public class CarrierText extends TextView {
|
public class CarrierText extends TextView {
|
||||||
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
||||||
@@ -52,6 +53,8 @@ public class CarrierText extends TextView {
|
|||||||
|
|
||||||
private WifiManager mWifiManager;
|
private WifiManager mWifiManager;
|
||||||
|
|
||||||
|
private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()];
|
||||||
|
|
||||||
private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
|
private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshCarrierInfo() {
|
public void onRefreshCarrierInfo() {
|
||||||
@@ -65,6 +68,22 @@ public class CarrierText extends TextView {
|
|||||||
public void onStartedWakingUp() {
|
public void onStartedWakingUp() {
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) {
|
||||||
|
if (slotId < 0) {
|
||||||
|
Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DEBUG) Log.d(TAG,"onSimStateChanged: " + getStatusForIccState(simState));
|
||||||
|
if (getStatusForIccState(simState) == StatusMode.SimIoError) {
|
||||||
|
mSimErrorState[slotId] = true;
|
||||||
|
updateCarrierText();
|
||||||
|
} else if (mSimErrorState[slotId]) {
|
||||||
|
mSimErrorState[slotId] = false;
|
||||||
|
updateCarrierText();
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* The status of this lock screen. Primarily used for widgets on LockScreen.
|
* The status of this lock screen. Primarily used for widgets on LockScreen.
|
||||||
@@ -77,7 +96,8 @@ public class CarrierText extends TextView {
|
|||||||
SimPukLocked, // SIM card is PUK locked because SIM entered wrong too many times
|
SimPukLocked, // SIM card is PUK locked because SIM entered wrong too many times
|
||||||
SimLocked, // SIM card is currently locked
|
SimLocked, // SIM card is currently locked
|
||||||
SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure
|
SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure
|
||||||
SimNotReady; // SIM is not ready yet. May never be on devices w/o a SIM.
|
SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM.
|
||||||
|
SimIoError; // SIM card is faulty
|
||||||
}
|
}
|
||||||
|
|
||||||
public CarrierText(Context context) {
|
public CarrierText(Context context) {
|
||||||
@@ -101,6 +121,35 @@ public class CarrierText extends TextView {
|
|||||||
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if there are faulty cards. Adds the text depending on the slot of the card
|
||||||
|
* @param text: current carrier text based on the sim state
|
||||||
|
* @param noSims: whether a valid sim card is inserted
|
||||||
|
* @return text
|
||||||
|
*/
|
||||||
|
private CharSequence updateCarrierTextWithSimIoError(CharSequence text, boolean noSims) {
|
||||||
|
final CharSequence carrier = "";
|
||||||
|
CharSequence carrierTextForSimIOError = getCarrierTextForSimState(
|
||||||
|
IccCardConstants.State.CARD_IO_ERROR, carrier);
|
||||||
|
for (int index = 0; index < mSimErrorState.length; index++) {
|
||||||
|
if (mSimErrorState[index]) {
|
||||||
|
// In the case when no sim cards are detected but a faulty card is inserted
|
||||||
|
// overwrite the text and only show "Invalid card"
|
||||||
|
if (noSims) {
|
||||||
|
return concatenate(carrierTextForSimIOError,
|
||||||
|
getContext().getText(com.android.internal.R.string.emergency_calls_only));
|
||||||
|
} else if (index == 0) {
|
||||||
|
// prepend "Invalid card" when faulty card is inserted in slot 0
|
||||||
|
text = concatenate(carrierTextForSimIOError, text);
|
||||||
|
} else {
|
||||||
|
// concatenate "Invalid card" when faulty card is inserted in slot 1
|
||||||
|
text = concatenate(text, carrierTextForSimIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateCarrierText() {
|
protected void updateCarrierText() {
|
||||||
boolean allSimsMissing = true;
|
boolean allSimsMissing = true;
|
||||||
boolean anySimReadyAndInService = false;
|
boolean anySimReadyAndInService = false;
|
||||||
@@ -179,6 +228,7 @@ public class CarrierText extends TextView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayText = updateCarrierTextWithSimIoError(displayText, allSimsMissing);
|
||||||
// APM (airplane mode) != no carrier state. There are carrier services
|
// APM (airplane mode) != no carrier state. There are carrier services
|
||||||
// (e.g. WFC = Wi-Fi calling) which may operate in APM.
|
// (e.g. WFC = Wi-Fi calling) which may operate in APM.
|
||||||
if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
|
if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
|
||||||
@@ -270,6 +320,11 @@ public class CarrierText extends TextView {
|
|||||||
getContext().getText(R.string.keyguard_sim_puk_locked_message),
|
getContext().getText(R.string.keyguard_sim_puk_locked_message),
|
||||||
text);
|
text);
|
||||||
break;
|
break;
|
||||||
|
case SimIoError:
|
||||||
|
carrierText = makeCarrierStringOnEmergencyCapable(
|
||||||
|
getContext().getText(R.string.keyguard_sim_error_message_short),
|
||||||
|
text);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return carrierText;
|
return carrierText;
|
||||||
@@ -319,6 +374,8 @@ public class CarrierText extends TextView {
|
|||||||
return StatusMode.SimPermDisabled;
|
return StatusMode.SimPermDisabled;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
return StatusMode.SimMissing;
|
return StatusMode.SimMissing;
|
||||||
|
case CARD_IO_ERROR:
|
||||||
|
return StatusMode.SimIoError;
|
||||||
}
|
}
|
||||||
return StatusMode.SimMissing;
|
return StatusMode.SimMissing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -899,6 +899,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
} else if (IccCardConstants.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) {
|
} else if (IccCardConstants.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) {
|
||||||
state = IccCardConstants.State.NETWORK_LOCKED;
|
state = IccCardConstants.State.NETWORK_LOCKED;
|
||||||
|
} else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) {
|
||||||
|
state = IccCardConstants.State.CARD_IO_ERROR;
|
||||||
} else if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)
|
} else if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)
|
||||||
|| IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)) {
|
|| IccCardConstants.INTENT_VALUE_ICC_IMSI.equals(stateExtra)) {
|
||||||
// This is required because telephony doesn't return to "READY" after
|
// This is required because telephony doesn't return to "READY" after
|
||||||
|
|||||||
Reference in New Issue
Block a user