summaryrefslogtreecommitdiff
path: root/com/android/internal/telephony/uicc/SIMRecords.java
diff options
context:
space:
mode:
Diffstat (limited to 'com/android/internal/telephony/uicc/SIMRecords.java')
-rw-r--r--com/android/internal/telephony/uicc/SIMRecords.java82
1 files changed, 27 insertions, 55 deletions
diff --git a/com/android/internal/telephony/uicc/SIMRecords.java b/com/android/internal/telephony/uicc/SIMRecords.java
index 4c8f4eeb..67c09000 100644
--- a/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/com/android/internal/telephony/uicc/SIMRecords.java
@@ -174,7 +174,8 @@ public class SIMRecords extends IccRecords {
private static final int SYSTEM_EVENT_BASE = 0x100;
private static final int EVENT_CARRIER_CONFIG_CHANGED = 1 + SYSTEM_EVENT_BASE;
private static final int EVENT_APP_LOCKED = 2 + SYSTEM_EVENT_BASE;
- private static final int EVENT_SIM_REFRESH = 3 + SYSTEM_EVENT_BASE;
+ private static final int EVENT_APP_NETWORK_LOCKED = 3 + SYSTEM_EVENT_BASE;
+
// Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length.
@@ -211,18 +212,18 @@ public class SIMRecords extends IccRecords {
mVmConfig = new VoiceMailConstants();
mRecordsRequested = false; // No load request is made till SIM ready
- mLockedRecordsRequested = false;
+ mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
// recordsToLoad is set to 0 because no requests are made yet
mRecordsToLoad = 0;
mCi.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
- mCi.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
// Start off by setting empty state
resetRecords();
mParentApp.registerForReady(this, EVENT_APP_READY, null);
mParentApp.registerForLocked(this, EVENT_APP_LOCKED, null);
+ mParentApp.registerForNetworkLocked(this, EVENT_APP_NETWORK_LOCKED, null);
if (DBG) log("SIMRecords X ctor this=" + this);
IntentFilter intentfilter = new IntentFilter();
@@ -243,10 +244,10 @@ public class SIMRecords extends IccRecords {
public void dispose() {
if (DBG) log("Disposing SIMRecords this=" + this);
//Unregister for all events
- mCi.unregisterForIccRefresh(this);
mCi.unSetOnSmsOnSim(this);
mParentApp.unregisterForReady(this);
mParentApp.unregisterForLocked(this);
+ mParentApp.unregisterForNetworkLocked(this);
mContext.unregisterReceiver(mReceiver);
resetRecords();
super.dispose();
@@ -291,7 +292,8 @@ public class SIMRecords extends IccRecords {
// read requests made so far are not valid. This is set to
// true only when fresh set of read requests are made.
mRecordsRequested = false;
- mLockedRecordsRequested = false;
+ mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
+ mLoaded.set(false);
}
//***** Public Methods
@@ -666,7 +668,8 @@ public class SIMRecords extends IccRecords {
break;
case EVENT_APP_LOCKED:
- onLocked();
+ case EVENT_APP_NETWORK_LOCKED:
+ onLocked(msg.what);
break;
/* IO events */
@@ -1213,14 +1216,6 @@ public class SIMRecords extends IccRecords {
((Message) ar.userObj).sendToTarget();
}
break;
- case EVENT_SIM_REFRESH:
- isRecordLoadResponse = false;
- ar = (AsyncResult) msg.obj;
- if (DBG) log("Sim REFRESH with exception: " + ar.exception);
- if (ar.exception == null) {
- handleSimRefresh((IccRefreshResponse) ar.result);
- }
- break;
case EVENT_GET_CFIS_DONE:
isRecordLoadResponse = true;
@@ -1410,7 +1405,8 @@ public class SIMRecords extends IccRecords {
}
}
- private void handleFileUpdate(int efid) {
+ @Override
+ protected void handleFileUpdate(int efid) {
switch(efid) {
case EF_MBDN:
mRecordsToLoad++;
@@ -1454,39 +1450,6 @@ public class SIMRecords extends IccRecords {
}
}
- private void handleSimRefresh(IccRefreshResponse refreshResponse){
- if (refreshResponse == null) {
- if (DBG) log("handleSimRefresh received without input");
- return;
- }
-
- if (!TextUtils.isEmpty(refreshResponse.aid)
- && !refreshResponse.aid.equals(mParentApp.getAid())) {
- // This is for different app. Ignore.
- return;
- }
-
- switch (refreshResponse.refreshResult) {
- case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE:
- if (DBG) log("handleSimRefresh with SIM_FILE_UPDATED");
- handleFileUpdate(refreshResponse.efId);
- break;
- case IccRefreshResponse.REFRESH_RESULT_INIT:
- if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
- // need to reload all files (that we care about)
- onIccRefreshInit();
- break;
- case IccRefreshResponse.REFRESH_RESULT_RESET:
- // Refresh reset is handled by the UiccCard object.
- if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
- break;
- default:
- // unknown refresh operation
- if (DBG) log("handleSimRefresh with unknown operation");
- break;
- }
- }
-
/**
* Dispatch 3GPP format message to registrant ({@code GsmCdmaPhone}) to pass to the 3GPP SMS
* dispatcher for delivery.
@@ -1561,7 +1524,7 @@ public class SIMRecords extends IccRecords {
if (getRecordsLoaded()) {
onAllRecordsLoaded();
- } else if (getLockedRecordsLoaded()) {
+ } else if (getLockedRecordsLoaded() || getNetworkLockedRecordsLoaded()) {
onLockedAllRecordsLoaded();
} else if (mRecordsToLoad < 0) {
loge("recordsToLoad <0, programmer error suspected");
@@ -1596,7 +1559,15 @@ public class SIMRecords extends IccRecords {
private void onLockedAllRecordsLoaded() {
setSimLanguageFromEF();
- mLockedRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
+ if (mLockedRecordsReqReason == LOCKED_RECORDS_REQ_REASON_LOCKED) {
+ mLockedRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
+ } else if (mLockedRecordsReqReason == LOCKED_RECORDS_REQ_REASON_NETWORK_LOCKED) {
+ mNetworkLockedRecordsLoadedRegistrants.notifyRegistrants(
+ new AsyncResult(null, null, null));
+ } else {
+ loge("onLockedAllRecordsLoaded: unexpected mLockedRecordsReqReason "
+ + mLockedRecordsReqReason);
+ }
}
@Override
@@ -1630,7 +1601,7 @@ public class SIMRecords extends IccRecords {
}
setVoiceMailByCountry(operator);
-
+ mLoaded.set(true);
mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
}
@@ -1716,9 +1687,10 @@ public class SIMRecords extends IccRecords {
fetchSimRecords();
}
- private void onLocked() {
+ private void onLocked(int msg) {
if (DBG) log("only fetch EF_LI, EF_PL and EF_ICCID in locked state");
- mLockedRecordsRequested = true;
+ mLockedRecordsReqReason = msg == EVENT_APP_LOCKED ? LOCKED_RECORDS_REQ_REASON_LOCKED :
+ LOCKED_RECORDS_REQ_REASON_NETWORK_LOCKED;
loadEfLiAndEfPl();
@@ -1868,8 +1840,8 @@ public class SIMRecords extends IccRecords {
public int getDisplayRule(ServiceState serviceState) {
int rule;
- if (mParentApp != null && mParentApp.getUiccCard() != null &&
- mParentApp.getUiccCard().getOperatorBrandOverride() != null) {
+ if (mParentApp != null && mParentApp.getUiccProfile() != null
+ && mParentApp.getUiccProfile().getOperatorBrandOverride() != null) {
// If the operator has been overridden, treat it as the SPN file on the SIM did not exist.
rule = SPN_RULE_SHOW_PLMN;
} else if (TextUtils.isEmpty(getServiceProviderName()) || mSpnDisplayCondition == -1) {