Methods Summary |
---|
private static java.lang.CharSequence | concatenate(java.lang.CharSequence plmn, java.lang.CharSequence spn)
final boolean plmnValid = !TextUtils.isEmpty(plmn);
final boolean spnValid = !TextUtils.isEmpty(spn);
if (plmnValid && spnValid) {
if (plmn.equals(spn)) {
return plmn;
} else {
return new StringBuilder().append(plmn).append(mSeparator).append(spn).toString();
}
} else if (plmnValid) {
return plmn;
} else if (spnValid) {
return spn;
} else {
return "";
}
|
private java.lang.CharSequence | getCarrierHelpTextForSimState(com.android.internal.telephony.IccCardConstants.State simState, java.lang.String plmn, java.lang.String spn)
int carrierHelpTextId = 0;
StatusMode status = getStatusForIccState(simState);
switch (status) {
case NetworkLocked:
carrierHelpTextId = R.string.keyguard_instructions_when_pattern_disabled;
break;
case SimMissing:
carrierHelpTextId = R.string.keyguard_missing_sim_instructions_long;
break;
case SimPermDisabled:
carrierHelpTextId = R.string.keyguard_permanent_disabled_sim_instructions;
break;
case SimMissingLocked:
carrierHelpTextId = R.string.keyguard_missing_sim_instructions;
break;
case Normal:
case SimLocked:
case SimPukLocked:
break;
}
return mContext.getText(carrierHelpTextId);
|
private java.lang.CharSequence | getCarrierTextForSimState(com.android.internal.telephony.IccCardConstants.State simState, java.lang.CharSequence text)Top-level function for creating carrier text. Makes text based on simState, PLMN
and SPN as well as device capabilities, such as being emergency call capable.
CharSequence carrierText = null;
StatusMode status = getStatusForIccState(simState);
switch (status) {
case Normal:
carrierText = text;
break;
case SimNotReady:
// Null is reserved for denoting missing, in this case we have nothing to display.
carrierText = ""; // nothing to display yet.
break;
case NetworkLocked:
carrierText = makeCarrierStringOnEmergencyCapable(
mContext.getText(R.string.keyguard_network_locked_message), text);
break;
case SimMissing:
carrierText = null;
break;
case SimPermDisabled:
carrierText = getContext().getText(
R.string.keyguard_permanent_disabled_sim_message_short);
break;
case SimMissingLocked:
carrierText = null;
break;
case SimLocked:
carrierText = makeCarrierStringOnEmergencyCapable(
getContext().getText(R.string.keyguard_sim_locked_message),
text);
break;
case SimPukLocked:
carrierText = makeCarrierStringOnEmergencyCapable(
getContext().getText(R.string.keyguard_sim_puk_locked_message),
text);
break;
}
return carrierText;
|
private com.android.keyguard.CarrierText$StatusMode | getStatusForIccState(com.android.internal.telephony.IccCardConstants.State simState)Determine the current status of the lock screen given the SIM state and other stuff.
// Since reading the SIM may take a while, we assume it is present until told otherwise.
if (simState == null) {
return StatusMode.Normal;
}
final boolean missingAndNotProvisioned =
!KeyguardUpdateMonitor.getInstance(mContext).isDeviceProvisioned()
&& (simState == IccCardConstants.State.ABSENT ||
simState == IccCardConstants.State.PERM_DISABLED);
// Assume we're NETWORK_LOCKED if not provisioned
simState = missingAndNotProvisioned ? IccCardConstants.State.NETWORK_LOCKED : simState;
switch (simState) {
case ABSENT:
return StatusMode.SimMissing;
case NETWORK_LOCKED:
return StatusMode.SimMissingLocked;
case NOT_READY:
return StatusMode.SimNotReady;
case PIN_REQUIRED:
return StatusMode.SimLocked;
case PUK_REQUIRED:
return StatusMode.SimPukLocked;
case READY:
return StatusMode.Normal;
case PERM_DISABLED:
return StatusMode.SimPermDisabled;
case UNKNOWN:
return StatusMode.SimMissing;
}
return StatusMode.SimMissing;
|
private java.lang.CharSequence | makeCarrierStringOnEmergencyCapable(java.lang.CharSequence simMessage, java.lang.CharSequence emergencyCallMessage)
if (mLockPatternUtils.isEmergencyCallCapable()) {
return concatenate(simMessage, emergencyCallMessage);
}
return simMessage;
|
protected void | onAttachedToWindow()
super.onAttachedToWindow();
if (ConnectivityManager.from(mContext).isNetworkSupported(
ConnectivityManager.TYPE_MOBILE)) {
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
mKeyguardUpdateMonitor.registerCallback(mCallback);
} else {
// Don't listen and clear out the text when the device isn't a phone.
mKeyguardUpdateMonitor = null;
setText("");
}
|
protected void | onDetachedFromWindow()
super.onDetachedFromWindow();
if (mKeyguardUpdateMonitor != null) {
mKeyguardUpdateMonitor.removeCallback(mCallback);
}
|
protected void | onFinishInflate()
super.onFinishInflate();
mSeparator = getResources().getString(
com.android.internal.R.string.kg_text_message_separator);
final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
setSelected(screenOn); // Allow marquee to work.
|
protected void | updateCarrierText()
boolean allSimsMissing = true;
CharSequence displayText = null;
List<SubscriptionInfo> subs = mKeyguardUpdateMonitor.getSubscriptionInfo(false);
final int N = subs.size();
if (DEBUG) Log.d(TAG, "updateCarrierText(): " + N);
for (int i = 0; i < N; i++) {
State simState = mKeyguardUpdateMonitor.getSimState(subs.get(i).getSubscriptionId());
CharSequence carrierName = subs.get(i).getCarrierName();
CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName);
if (DEBUG) Log.d(TAG, "Handling " + simState + " " + carrierName);
if (carrierTextForSimState != null) {
allSimsMissing = false;
displayText = concatenate(displayText, carrierTextForSimState);
}
}
if (allSimsMissing) {
if (N != 0) {
// Shows "No SIM card | Emergency calls only" on devices that are voice-capable.
// This depends on mPlmn containing the text "Emergency calls only" when the radio
// has some connectivity. Otherwise, it should be null or empty and just show
// "No SIM card"
// Grab the first subscripton, because they all should contain the emergency text,
// described above.
displayText = makeCarrierStringOnEmergencyCapable(
getContext().getText(R.string.keyguard_missing_sim_message_short),
subs.get(0).getCarrierName());
} else {
// We don't have a SubscriptionInfo to get the emergency calls only from.
// Lets just make it ourselves.
displayText = makeCarrierStringOnEmergencyCapable(
getContext().getText(R.string.keyguard_missing_sim_message_short),
getContext().getText(com.android.internal.R.string.emergency_calls_only));
}
}
setText(displayText);
|