String key = pair[0].trim(); String val = pair[1].trim(); if (STR_TAG.equals(key)) { tag = normalizeValue(val);
} else if (STR_NUMBER.equals(key)) { number = normalizeValue(val); } else if (STR_PIN2.equals(key)) { pin2 = normalizeValue(val); } }
if (TextUtils.isEmpty(tag)) { return 0; }
if (efType == FDN && TextUtils.isEmpty(pin2)) { return 0; }
boolean success = deleteIccRecordFromEf(efType, tag, number, pin2); if (!success) { return 0; } return 1; } @Override
public int update(Uri url, ContentValues values, String where,
String[] whereArgs) { int efType;
String pin2 = null; if (DBG) log(\
int match = URL_MATCHER.match(url); switch (match) { case ADN:
efType = IccConstants.EF_ADN; break; case FDN:
efType = IccConstants.EF_FDN; pin2 = values.getAsString(\break; default:
throw new UnsupportedOperationException(\+ url); }
String tag = values.getAsString(\String number = values.getAsString(\String newTag = values.getAsString(\String newNumber = values.getAsString(\
boolean success = updateIccRecordInEf(efType, tag, number, newTag, newNumber, pin2);
if (!success) { return 0; } return 1; }
private ArrayList loadFromEf(int efType) { ArrayList results = new ArrayList(); List adnRecords = null; if (DBG)
log(\try {
IIccPhoneBook iccIpb = IIccPhoneBook.Stub
.asInterface(ServiceManager.getService(\if (iccIpb != null) {
adnRecords = iccIpb.getAdnRecordsInEf(efType); }
} catch (RemoteException ex) { // ignore it
} catch (SecurityException ex) { if (DBG)
log(ex.toString()); }
if (adnRecords != null) { // Load the results
int N = adnRecords.size(); if (DBG)
log(\for (int i = 0; i < N; i++) {
loadRecord(adnRecords.get(i), results); } } else {
// No results to load
Log.w(TAG, \results.clear(); } if (DBG)
log(\return results; }
private boolean addIccRecordToEf(int efType, String name, String number, String pin2) { if (DBG)
log(\+ \boolean success = false;
// TODO: do we need to call getAdnRecordsInEf() before calling // updateAdnRecordsInEfBySearch()? In any case, we will leave // the UI level logic to fill that prereq if necessary. But
// hopefully, we can remove this requirement. try {
IIccPhoneBook iccIpb = IIccPhoneBook.Stub
.asInterface(ServiceManager.getService(\if (iccIpb != null) {
success = iccIpb.updateAdnRecordsInEfBySearch(efType, \name, number, pin2); }
} catch (RemoteException ex) { // ignore it
} catch (SecurityException ex) { if (DBG)
log(ex.toString()); } if (DBG)
log(\return success; }
private boolean updateIccRecordInEf(int efType, String oldName, String oldNumber, String newName, String newNumber, String pin2) { if (DBG)
log(\+ oldName + \+ newName + \