diff options
author | Wink Saville <wink@google.com> | 2012-02-01 14:48:14 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-01 14:48:14 -0800 |
commit | 064d2d65697ecd95c72e2724cf066f8ad162d240 (patch) | |
tree | 9481cc1cff3fa9208292f3dfb25a9c40d9c75163 | |
parent | f46723b41f723ebfc9ed18c7c409b319f4b5e539 (diff) | |
parent | 8f241458051c8bd2a68b0e8b9fe0d0f326a0a56b (diff) | |
download | frameworks_base-064d2d65697ecd95c72e2724cf066f8ad162d240.zip frameworks_base-064d2d65697ecd95c72e2724cf066f8ad162d240.tar.gz frameworks_base-064d2d65697ecd95c72e2724cf066f8ad162d240.tar.bz2 |
Merge "Telephony: Fix sim_refresh as per ril v6"
8 files changed, 125 insertions, 30 deletions
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index ee39850..7900a9d 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -93,11 +93,6 @@ public interface CommandsInterface { static final int USSD_MODE_NOTIFY = 0; static final int USSD_MODE_REQUEST = 1; - // SIM Refresh results, passed up from RIL. - static final int SIM_REFRESH_FILE_UPDATED = 0; // Single file updated - static final int SIM_REFRESH_INIT = 1; // SIM initialized; reload all - static final int SIM_REFRESH_RESET = 2; // SIM reset; may be locked - // GSM SMS fail cause for acknowledgeLastIncomingSMS. From TS 23.040, 9.2.3.22. static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED = 0xD3; static final int GSM_SMS_FAIL_CAUSE_USIM_APP_TOOLKIT_BUSY = 0xD4; diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index f4308a0..a9ef762 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -48,7 +48,7 @@ public abstract class IccCard { protected String mLogTag; protected boolean mDbg; - private IccCardStatus mIccCardStatus = null; + protected IccCardStatus mIccCardStatus = null; protected State mState = null; private final Object mStateMonitor = new Object(); @@ -911,4 +911,24 @@ public abstract class IccCard { private void log(String msg) { Log.d(mLogTag, "[IccCard] " + msg); } + + protected abstract int getCurrentApplicationIndex(); + + public String getAid() { + String aid = ""; + int appIndex = getCurrentApplicationIndex(); + + if (appIndex >= 0 && appIndex < IccCardStatus.CARD_MAX_APPS) { + IccCardApplication app = mIccCardStatus.getApplication(appIndex); + if (app != null) { + aid = app.aid; + } else { + Log.e(mLogTag, "[IccCard] getAid: no current application index=" + appIndex); + } + } else { + Log.e(mLogTag, "[IccCard] getAid: Invalid Subscription Application index=" + appIndex); + } + + return aid; + } } diff --git a/telephony/java/com/android/internal/telephony/IccRefreshResponse.java b/telephony/java/com/android/internal/telephony/IccRefreshResponse.java new file mode 100644 index 0000000..6806703 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IccRefreshResponse.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +/** + * See also RIL_SimRefresh in include/telephony/ril.h + * + * {@hide} + */ + +public class IccRefreshResponse { + + public static final int REFRESH_RESULT_FILE_UPDATE = 0; /* Single file was updated */ + public static final int REFRESH_RESULT_INIT = 1; /* The Icc has been initialized */ + public static final int REFRESH_RESULT_RESET = 2; /* The Icc was reset */ + + public int refreshResult; /* Sim Refresh result */ + public int efId; /* EFID */ + public String aid; /* null terminated string, e.g., + from 0xA0, 0x00 -> 0x41, + 0x30, 0x30, 0x30 */ + /* Example: a0000000871002f310ffff89080000ff */ + + @Override + public String toString() { + return "{" + refreshResult + ", " + aid +", " + efId + "}"; + } +} diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 718a4fd..156eb32 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -52,6 +52,7 @@ import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.CdmaInformationRecords; +import com.android.internal.telephony.IccRefreshResponse; import java.io.ByteArrayInputStream; import java.io.DataInputStream; @@ -2419,7 +2420,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_STK_EVENT_NOTIFY: ret = responseString(p); break; case RIL_UNSOL_STK_CALL_SETUP: ret = responseInts(p); break; case RIL_UNSOL_SIM_SMS_STORAGE_FULL: ret = responseVoid(p); break; - case RIL_UNSOL_SIM_REFRESH: ret = responseInts(p); break; + case RIL_UNSOL_SIM_REFRESH: ret = responseSimRefresh(p); break; case RIL_UNSOL_CALL_RING: ret = responseCallRing(p); break; case RIL_UNSOL_RESTRICTED_STATE_CHANGED: ret = responseInts(p); break; case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: ret = responseVoid(p); break; @@ -2976,6 +2977,16 @@ public final class RIL extends BaseCommands implements CommandsInterface { } private Object + responseSimRefresh(Parcel p) { + IccRefreshResponse response = new IccRefreshResponse(); + + response.refreshResult = p.readInt(); + response.efId = p.readInt(); + response.aid = p.readString(); + return response; + } + + private Object responseCallList(Parcel p) { int num; int voiceSettings; diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimCard.java b/telephony/java/com/android/internal/telephony/cdma/RuimCard.java index 02eb86d..674fada 100644 --- a/telephony/java/com/android/internal/telephony/cdma/RuimCard.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimCard.java @@ -44,5 +44,13 @@ public final class RuimCard extends IccCard { public String getServiceProviderName () { return mPhone.mIccRecords.getServiceProviderName(); } + + @Override + protected int getCurrentApplicationIndex() { + if (mIccCardStatus == null) { + return -1; + } + return mIccCardStatus.getCdmaSubscriptionAppIndex(); + } } diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java index b057e46..17a200e 100755 --- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java @@ -29,6 +29,7 @@ import com.android.internal.telephony.AdnRecord; import com.android.internal.telephony.AdnRecordCache; import com.android.internal.telephony.AdnRecordLoader; import com.android.internal.telephony.CommandsInterface; +import com.android.internal.telephony.IccRefreshResponse; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.cdma.RuimCard; import com.android.internal.telephony.MccTable; @@ -300,7 +301,7 @@ public final class RuimRecords extends IccRecords { isRecordLoadResponse = false; ar = (AsyncResult)msg.obj; if (ar.exception == null) { - handleRuimRefresh((int[])(ar.result)); + handleRuimRefresh((IccRefreshResponse)ar.result); } break; @@ -409,24 +410,30 @@ public final class RuimRecords extends IccRecords { ((CDMAPhone) phone).notifyMessageWaitingIndicator(); } - private void handleRuimRefresh(int[] result) { - if (result == null || result.length == 0) { - if (DBG) log("handleRuimRefresh without input"); + private void handleRuimRefresh(IccRefreshResponse refreshResponse) { + if (refreshResponse == null) { + if (DBG) log("handleRuimRefresh received without input"); return; } - switch ((result[0])) { - case CommandsInterface.SIM_REFRESH_FILE_UPDATED: + if (refreshResponse.aid != null && + !refreshResponse.aid.equals(phone.getIccCard().getAid())) { + // This is for different app. Ignore. + return; + } + + switch (refreshResponse.refreshResult) { + case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE: if (DBG) log("handleRuimRefresh with SIM_REFRESH_FILE_UPDATED"); adnCache.reset(); fetchRuimRecords(); break; - case CommandsInterface.SIM_REFRESH_INIT: + case IccRefreshResponse.REFRESH_RESULT_INIT: if (DBG) log("handleRuimRefresh with SIM_REFRESH_INIT"); // need to reload all files (that we care about) fetchRuimRecords(); break; - case CommandsInterface.SIM_REFRESH_RESET: + case IccRefreshResponse.REFRESH_RESULT_RESET: if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET"); phone.mCM.setRadioPower(false, null); /* Note: no need to call setRadioPower(true). Assuming the desired diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index 7c423c7..b2fa051 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -39,6 +39,7 @@ import com.android.internal.telephony.MccTable; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneBase; import com.android.internal.telephony.SmsMessageBase; +import com.android.internal.telephony.IccRefreshResponse; import java.util.ArrayList; @@ -1049,7 +1050,7 @@ public class SIMRecords extends IccRecords { ar = (AsyncResult)msg.obj; if (DBG) log("Sim REFRESH with exception: " + ar.exception); if (ar.exception == null) { - handleSimRefresh((int[])(ar.result)); + handleSimRefresh((IccRefreshResponse)ar.result); } break; case EVENT_GET_CFIS_DONE: @@ -1130,27 +1131,31 @@ public class SIMRecords extends IccRecords { } } - private void handleSimRefresh(int[] result) { - if (result == null || result.length == 0) { - if (DBG) log("handleSimRefresh without input"); + private void handleSimRefresh(IccRefreshResponse refreshResponse){ + if (refreshResponse == null) { + if (DBG) log("handleSimRefresh received without input"); return; } - switch ((result[0])) { - case CommandsInterface.SIM_REFRESH_FILE_UPDATED: - if (DBG) log("handleSimRefresh with SIM_REFRESH_FILE_UPDATED"); - // result[1] contains the EFID of the updated file. - int efid = result[1]; - handleFileUpdate(efid); + if (refreshResponse.aid != null && + !refreshResponse.aid.equals(phone.getIccCard().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 CommandsInterface.SIM_REFRESH_INIT: - if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT"); + case IccRefreshResponse.REFRESH_RESULT_INIT: + if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT"); // need to reload all files (that we care about) adnCache.reset(); fetchSimRecords(); break; - case CommandsInterface.SIM_REFRESH_RESET: - if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET"); + case IccRefreshResponse.REFRESH_RESULT_RESET: + if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET"); phone.mCM.setRadioPower(false, null); /* Note: no need to call setRadioPower(true). Assuming the desired * radio power state is still ON (as tracked by ServiceStateTracker), @@ -1162,7 +1167,7 @@ public class SIMRecords extends IccRecords { break; default: // unknown refresh operation - if (DBG) log("handleSimRefresh with unknown operation"); + if (DBG) log("handleSimRefresh with unknown operation"); break; } } diff --git a/telephony/java/com/android/internal/telephony/gsm/SimCard.java b/telephony/java/com/android/internal/telephony/gsm/SimCard.java index e34e10a..0e68e07 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SimCard.java +++ b/telephony/java/com/android/internal/telephony/gsm/SimCard.java @@ -39,4 +39,11 @@ public final class SimCard extends IccCard { return mPhone.mIccRecords.getServiceProviderName(); } + @Override + protected int getCurrentApplicationIndex() { + if (mIccCardStatus == null) { + return -1; + } + return mIccCardStatus.getGsmUmtsSubscriptionAppIndex(); + } } |