Merge "Enables writing to USIM phonebook (fixes issue 8976)."
This commit is contained in:
@@ -186,7 +186,12 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<AdnRecord> oldAdnList;
|
ArrayList<AdnRecord> oldAdnList;
|
||||||
oldAdnList = getRecordsIfLoaded(efid);
|
|
||||||
|
if (efid == EF_PBR) {
|
||||||
|
oldAdnList = mUsimPhoneBookManager.loadEfFilesFromUsim();
|
||||||
|
} else {
|
||||||
|
oldAdnList = getRecordsIfLoaded(efid);
|
||||||
|
}
|
||||||
|
|
||||||
if (oldAdnList == null) {
|
if (oldAdnList == null) {
|
||||||
sendErrorResponse(response, "Adn list not exist for EF:" + efid);
|
sendErrorResponse(response, "Adn list not exist for EF:" + efid);
|
||||||
@@ -208,6 +213,17 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
|||||||
return;
|
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);
|
Message pendingResponse = userWriteResponse.get(efid);
|
||||||
|
|
||||||
if (pendingResponse != null) {
|
if (pendingResponse != null) {
|
||||||
@@ -331,6 +347,7 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
|||||||
|
|
||||||
if (ar.exception == null) {
|
if (ar.exception == null) {
|
||||||
adnLikeFiles.get(efid).set(index - 1, adn);
|
adnLikeFiles.get(efid).set(index - 1, adn);
|
||||||
|
mUsimPhoneBookManager.invalidateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
Message response = userWriteResponse.get(efid);
|
Message response = userWriteResponse.get(efid);
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
|
|||||||
if (DBG) logd("updateAdnRecordsInEfBySearch: efid=" + efid +
|
if (DBG) logd("updateAdnRecordsInEfBySearch: efid=" + efid +
|
||||||
" ("+ oldTag + "," + oldPhoneNumber + ")"+ "==>" +
|
" ("+ oldTag + "," + oldPhoneNumber + ")"+ "==>" +
|
||||||
" ("+ newTag + "," + newPhoneNumber + ")"+ " pin2=" + pin2);
|
" ("+ newTag + "," + newPhoneNumber + ")"+ " pin2=" + pin2);
|
||||||
|
|
||||||
|
efid = updateEfForIccType(efid);
|
||||||
|
|
||||||
synchronized(mLock) {
|
synchronized(mLock) {
|
||||||
checkThread();
|
checkThread();
|
||||||
success = false;
|
success = false;
|
||||||
|
|||||||
25
telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
Normal file → Executable file
25
telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
Normal file → Executable file
@@ -53,6 +53,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
|||||||
private ArrayList<byte[]> mIapFileRecord;
|
private ArrayList<byte[]> mIapFileRecord;
|
||||||
private ArrayList<byte[]> mEmailFileRecord;
|
private ArrayList<byte[]> mEmailFileRecord;
|
||||||
private Map<Integer, ArrayList<String>> mEmailsForAdnRec;
|
private Map<Integer, ArrayList<String>> mEmailsForAdnRec;
|
||||||
|
private boolean mRefreshCache = false;
|
||||||
|
|
||||||
private static final int EVENT_PBR_LOAD_DONE = 1;
|
private static final int EVENT_PBR_LOAD_DONE = 1;
|
||||||
private static final int EVENT_USIM_ADN_LOAD_DONE = 2;
|
private static final int EVENT_USIM_ADN_LOAD_DONE = 2;
|
||||||
@@ -91,11 +92,19 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
|||||||
mEmailFileRecord = null;
|
mEmailFileRecord = null;
|
||||||
mPbrFile = null;
|
mPbrFile = null;
|
||||||
mIsPbrPresent = true;
|
mIsPbrPresent = true;
|
||||||
|
mRefreshCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AdnRecord> loadEfFilesFromUsim() {
|
public ArrayList<AdnRecord> loadEfFilesFromUsim() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (!mPhoneBookRecords.isEmpty()) return mPhoneBookRecords;
|
if (!mPhoneBookRecords.isEmpty()) {
|
||||||
|
if (mRefreshCache) {
|
||||||
|
mRefreshCache = false;
|
||||||
|
refreshCache();
|
||||||
|
}
|
||||||
|
return mPhoneBookRecords;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mIsPbrPresent) return null;
|
if (!mIsPbrPresent) return null;
|
||||||
|
|
||||||
// Check if the PBR file is present in the cache, if not read it
|
// 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;
|
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() {
|
private void readPbrFileAndWait() {
|
||||||
mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
|
mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user