diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2010-07-23 17:48:11 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-07-23 17:48:11 -0700 |
commit | 1b05a79f7d3c77ac2135d8f1ab40f0b13854ffae (patch) | |
tree | c4aff7101bbe100480be5d713dea5ce15de5b31c /telephony | |
parent | 8a13d4e3e5a175baddb7b8ca542d9d9941cf24a6 (diff) | |
parent | 7cdd26ce30e61a108e4def932b96aca9f031e5d2 (diff) | |
download | frameworks_base-1b05a79f7d3c77ac2135d8f1ab40f0b13854ffae.zip frameworks_base-1b05a79f7d3c77ac2135d8f1ab40f0b13854ffae.tar.gz frameworks_base-1b05a79f7d3c77ac2135d8f1ab40f0b13854ffae.tar.bz2 |
am 7cdd26ce: Merge "Enables writing to USIM phonebook (fixes issue 8976)."
Merge commit '7cdd26ce30e61a108e4def932b96aca9f031e5d2' into gingerbread-plus-aosp
* commit '7cdd26ce30e61a108e4def932b96aca9f031e5d2':
Enables writing to USIM phonebook (fixes issue 8976).
Diffstat (limited to 'telephony')
3 files changed, 45 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/AdnRecordCache.java b/telephony/java/com/android/internal/telephony/AdnRecordCache.java index c8c0658..a175d49 100644 --- a/telephony/java/com/android/internal/telephony/AdnRecordCache.java +++ b/telephony/java/com/android/internal/telephony/AdnRecordCache.java @@ -186,7 +186,12 @@ public final class AdnRecordCache extends Handler implements IccConstants { } ArrayList<AdnRecord> oldAdnList; - oldAdnList = getRecordsIfLoaded(efid); + + if (efid == EF_PBR) { + oldAdnList = mUsimPhoneBookManager.loadEfFilesFromUsim(); + } else { + oldAdnList = getRecordsIfLoaded(efid); + } if (oldAdnList == null) { sendErrorResponse(response, "Adn list not exist for EF:" + efid); @@ -208,6 +213,17 @@ public final class AdnRecordCache extends Handler implements IccConstants { return; } + if (efid == EF_PBR) { + AdnRecord foundAdn = oldAdnList.get(index-1); + efid = foundAdn.efid; + extensionEF = foundAdn.extRecord; + index = foundAdn.recordNumber; + + newAdn.efid = efid; + newAdn.extRecord = extensionEF; + newAdn.recordNumber = index; + } + Message pendingResponse = userWriteResponse.get(efid); if (pendingResponse != null) { @@ -331,6 +347,7 @@ public final class AdnRecordCache extends Handler implements IccConstants { if (ar.exception == null) { adnLikeFiles.get(efid).set(index - 1, adn); + mUsimPhoneBookManager.invalidateCache(); } Message response = userWriteResponse.get(efid); diff --git a/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java b/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java index 48257cc..2f22d74 100644 --- a/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java +++ b/telephony/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java @@ -144,6 +144,9 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub { if (DBG) logd("updateAdnRecordsInEfBySearch: efid=" + efid + " ("+ oldTag + "," + oldPhoneNumber + ")"+ "==>" + " ("+ newTag + "," + newPhoneNumber + ")"+ " pin2=" + pin2); + + efid = updateEfForIccType(efid); + synchronized(mLock) { checkThread(); success = false; diff --git a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java index 41e527c..b642541 100644..100755 --- a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java +++ b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java @@ -53,6 +53,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { private ArrayList<byte[]> mIapFileRecord; private ArrayList<byte[]> mEmailFileRecord; private Map<Integer, ArrayList<String>> mEmailsForAdnRec; + private boolean mRefreshCache = false; private static final int EVENT_PBR_LOAD_DONE = 1; private static final int EVENT_USIM_ADN_LOAD_DONE = 2; @@ -91,11 +92,19 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { mEmailFileRecord = null; mPbrFile = null; mIsPbrPresent = true; + mRefreshCache = false; } public ArrayList<AdnRecord> loadEfFilesFromUsim() { synchronized (mLock) { - if (!mPhoneBookRecords.isEmpty()) return mPhoneBookRecords; + if (!mPhoneBookRecords.isEmpty()) { + if (mRefreshCache) { + mRefreshCache = false; + refreshCache(); + } + return mPhoneBookRecords; + } + if (!mIsPbrPresent) return null; // Check if the PBR file is present in the cache, if not read it @@ -116,6 +125,20 @@ public class UsimPhoneBookManager extends Handler implements IccConstants { return mPhoneBookRecords; } + private void refreshCache() { + if (mPbrFile == null) return; + mPhoneBookRecords.clear(); + + int numRecs = mPbrFile.mFileIds.size(); + for (int i = 0; i < numRecs; i++) { + readAdnFileAndWait(i); + } + } + + public void invalidateCache() { + mRefreshCache = true; + } + private void readPbrFileAndWait() { mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE)); try { |