Loading src/java/com/android/internal/telephony/uicc/IccRecords.java +31 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.os.RegistrantList; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState; Loading @@ -34,7 +33,9 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; /** * {@hide} Loading Loading @@ -97,6 +98,13 @@ public abstract class IccRecords extends Handler implements IccConstants { private final Object mLock = new Object(); //Arbitrary offset for the Handler protected static final int HANDLER_ACTION_BASE = 0x12E500; protected static final int HANDLER_ACTION_NONE = HANDLER_ACTION_BASE + 0; protected static final int HANDLER_ACTION_SEND_RESPONSE = HANDLER_ACTION_BASE + 1; protected static AtomicInteger sNextRequestId = new AtomicInteger(1); protected final HashMap<Integer, Message> mPendingResponses = new HashMap<>(); // ***** Constants // Markers for mncLength Loading Loading @@ -204,6 +212,28 @@ public abstract class IccRecords extends Handler implements IccConstants { return mAdnCache; } /** * Adds a message to the pending requests list by generating a unique * (integer) hash key and returning it. The message should never be null. */ public int storePendingResponseMessage(Message msg) { int key = sNextRequestId.getAndIncrement(); synchronized (mPendingResponses) { mPendingResponses.put(key, msg); } return key; } /** * Returns the pending request, if any or null */ public Message retrievePendingResponseMessage(Integer key) { Message m; synchronized (mPendingResponses) { return mPendingResponses.remove(key); } } /** * Returns the ICC ID stripped at the first hex character. Some SIMs have ICC IDs * containing hex digits; {@link #getFullIccId()} should be used to get the full ID including Loading src/java/com/android/internal/telephony/uicc/SIMRecords.java +26 −4 Original line number Diff line number Diff line Loading @@ -180,8 +180,6 @@ public class SIMRecords extends IccRecords { private static final int EVENT_APP_LOCKED = 2 + SYSTEM_EVENT_BASE; private static final int EVENT_SIM_REFRESH = 3 + SYSTEM_EVENT_BASE; // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length. private static final String[] MCCMNC_CODES_HAVING_3DIGITS_MNC = { Loading Loading @@ -354,7 +352,7 @@ public class SIMRecords extends IccRecords { * When the operation is complete, onComplete will be sent to its handler * * @param alphaTag alpha-tagging of the dailing nubmer (up to 10 characters) * @param number dailing nubmer (up to 20 digits) * @param number dialing number (up to 20 digits) * if the number starts with '+', then set to international TOA * @param onComplete * onComplete.obj will be an AsyncResult Loading Loading @@ -1328,6 +1326,19 @@ public class SIMRecords extends IccRecords { } else { mFplmns = parseBcdPlmnList(data, "Forbidden"); } if (msg.arg1 == HANDLER_ACTION_SEND_RESPONSE) { if (VDBG) logv("getForbiddenPlmns(): send async response"); isRecordLoadResponse = false; Message response = retrievePendingResponseMessage(msg.arg2); if (response != null) { AsyncResult.forMessage( response, Arrays.copyOf(mFplmns, mFplmns.length), null); response.sendToTarget(); } else { loge("Failed to retrieve a response message for FPLMN"); break; } } break; case EVENT_CARRIER_CONFIG_CHANGED: Loading Loading @@ -1628,6 +1639,16 @@ public class SIMRecords extends IccRecords { } } /** * String[] of forbidden PLMNs will be sent to the Message's handler * in the result field of an AsyncResult in the response.obj. */ public void getForbiddenPlmns(Message response) { int key = storePendingResponseMessage(response); mFh.loadEFTransparent(EF_FPLMN, obtainMessage( EVENT_GET_FPLMN_DONE, HANDLER_ACTION_SEND_RESPONSE, key)); } @Override public void onReady() { fetchSimRecords(); Loading Loading @@ -1732,7 +1753,8 @@ public class SIMRecords extends IccRecords { mFh.loadEFTransparent(EF_EHPLMN, obtainMessage(EVENT_GET_EHPLMN_DONE)); mFh.loadEFTransparent(EF_FPLMN, obtainMessage(EVENT_GET_FPLMN_DONE)); mFh.loadEFTransparent(EF_FPLMN, obtainMessage( EVENT_GET_FPLMN_DONE, HANDLER_ACTION_NONE, -1)); mRecordsToLoad++; loadEfLiAndEfPl(); Loading Loading
src/java/com/android/internal/telephony/uicc/IccRecords.java +31 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.os.RegistrantList; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState; Loading @@ -34,7 +33,9 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; /** * {@hide} Loading Loading @@ -97,6 +98,13 @@ public abstract class IccRecords extends Handler implements IccConstants { private final Object mLock = new Object(); //Arbitrary offset for the Handler protected static final int HANDLER_ACTION_BASE = 0x12E500; protected static final int HANDLER_ACTION_NONE = HANDLER_ACTION_BASE + 0; protected static final int HANDLER_ACTION_SEND_RESPONSE = HANDLER_ACTION_BASE + 1; protected static AtomicInteger sNextRequestId = new AtomicInteger(1); protected final HashMap<Integer, Message> mPendingResponses = new HashMap<>(); // ***** Constants // Markers for mncLength Loading Loading @@ -204,6 +212,28 @@ public abstract class IccRecords extends Handler implements IccConstants { return mAdnCache; } /** * Adds a message to the pending requests list by generating a unique * (integer) hash key and returning it. The message should never be null. */ public int storePendingResponseMessage(Message msg) { int key = sNextRequestId.getAndIncrement(); synchronized (mPendingResponses) { mPendingResponses.put(key, msg); } return key; } /** * Returns the pending request, if any or null */ public Message retrievePendingResponseMessage(Integer key) { Message m; synchronized (mPendingResponses) { return mPendingResponses.remove(key); } } /** * Returns the ICC ID stripped at the first hex character. Some SIMs have ICC IDs * containing hex digits; {@link #getFullIccId()} should be used to get the full ID including Loading
src/java/com/android/internal/telephony/uicc/SIMRecords.java +26 −4 Original line number Diff line number Diff line Loading @@ -180,8 +180,6 @@ public class SIMRecords extends IccRecords { private static final int EVENT_APP_LOCKED = 2 + SYSTEM_EVENT_BASE; private static final int EVENT_SIM_REFRESH = 3 + SYSTEM_EVENT_BASE; // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length. private static final String[] MCCMNC_CODES_HAVING_3DIGITS_MNC = { Loading Loading @@ -354,7 +352,7 @@ public class SIMRecords extends IccRecords { * When the operation is complete, onComplete will be sent to its handler * * @param alphaTag alpha-tagging of the dailing nubmer (up to 10 characters) * @param number dailing nubmer (up to 20 digits) * @param number dialing number (up to 20 digits) * if the number starts with '+', then set to international TOA * @param onComplete * onComplete.obj will be an AsyncResult Loading Loading @@ -1328,6 +1326,19 @@ public class SIMRecords extends IccRecords { } else { mFplmns = parseBcdPlmnList(data, "Forbidden"); } if (msg.arg1 == HANDLER_ACTION_SEND_RESPONSE) { if (VDBG) logv("getForbiddenPlmns(): send async response"); isRecordLoadResponse = false; Message response = retrievePendingResponseMessage(msg.arg2); if (response != null) { AsyncResult.forMessage( response, Arrays.copyOf(mFplmns, mFplmns.length), null); response.sendToTarget(); } else { loge("Failed to retrieve a response message for FPLMN"); break; } } break; case EVENT_CARRIER_CONFIG_CHANGED: Loading Loading @@ -1628,6 +1639,16 @@ public class SIMRecords extends IccRecords { } } /** * String[] of forbidden PLMNs will be sent to the Message's handler * in the result field of an AsyncResult in the response.obj. */ public void getForbiddenPlmns(Message response) { int key = storePendingResponseMessage(response); mFh.loadEFTransparent(EF_FPLMN, obtainMessage( EVENT_GET_FPLMN_DONE, HANDLER_ACTION_SEND_RESPONSE, key)); } @Override public void onReady() { fetchSimRecords(); Loading Loading @@ -1732,7 +1753,8 @@ public class SIMRecords extends IccRecords { mFh.loadEFTransparent(EF_EHPLMN, obtainMessage(EVENT_GET_EHPLMN_DONE)); mFh.loadEFTransparent(EF_FPLMN, obtainMessage(EVENT_GET_FPLMN_DONE)); mFh.loadEFTransparent(EF_FPLMN, obtainMessage( EVENT_GET_FPLMN_DONE, HANDLER_ACTION_NONE, -1)); mRecordsToLoad++; loadEfLiAndEfPl(); Loading