diff options
author | arunvoddu <arunvoddu@google.com> | 2022-09-11 17:36:28 +0000 |
---|---|---|
committer | arunvoddu <arunvoddu@google.com> | 2022-11-02 12:57:16 +0000 |
commit | 16c293a1d499b751635bca30177b222ee4b6f03c (patch) | |
tree | b55704ffcda584e86335f12982e2993736105a08 /src/java/com/android/internal/telephony/uicc | |
parent | 57ecfe4f4770edde230d9e9394c73ace13425c95 (diff) | |
download | telephony-16c293a1d499b751635bca30177b222ee4b6f03c.tar.gz |
UT for AdnRecordCache file
Bug: 244637886
Test: Atest Verification done
Change-Id: Id2b8aa7ee512530f9bdcf7599ffc9be427994162
Diffstat (limited to 'src/java/com/android/internal/telephony/uicc')
-rw-r--r-- | src/java/com/android/internal/telephony/uicc/AdnRecordCache.java | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java b/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java index ba06c5d46c..90c94914f8 100644 --- a/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java +++ b/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java @@ -23,6 +23,7 @@ import android.os.Handler; import android.os.Message; import android.util.SparseArray; +import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.gsm.UsimPhoneBookManager; import java.util.ArrayList; @@ -59,14 +60,16 @@ public class AdnRecordCache extends Handler implements IccConstants { static final int EVENT_UPDATE_ADN_DONE = 2; //***** Constructor - - - AdnRecordCache(IccFileHandler fh) { mFh = fh; mUsimPhoneBookManager = new UsimPhoneBookManager(mFh, this); } + public AdnRecordCache(IccFileHandler fh, UsimPhoneBookManager usimPhoneBookManager) { + mFh = fh; + mUsimPhoneBookManager = usimPhoneBookManager; + } + //***** Called from SIMRecords /** @@ -191,7 +194,6 @@ public class AdnRecordCache extends Handler implements IccConstants { */ public void updateAdnBySearch(int efid, AdnRecord oldAdn, AdnRecord newAdn, String pin2, Message response) { - int extensionEF; extensionEF = extensionEfForEf(efid); @@ -200,7 +202,6 @@ public class AdnRecordCache extends Handler implements IccConstants { Integer.toHexString(efid).toUpperCase(Locale.ROOT)); return; } - ArrayList<AdnRecord> oldAdnList; if (efid == EF_PBR) { @@ -208,13 +209,11 @@ public class AdnRecordCache extends Handler implements IccConstants { } else { oldAdnList = getRecordsIfLoaded(efid); } - if (oldAdnList == null) { sendErrorResponse(response, "Adn list not exist for EF:0x" + Integer.toHexString(efid).toUpperCase(Locale.ROOT)); return; } - int index = -1; int count = 1; for (Iterator<AdnRecord> it = oldAdnList.iterator(); it.hasNext(); ) { @@ -224,7 +223,6 @@ public class AdnRecordCache extends Handler implements IccConstants { } count++; } - if (index == -1) { sendErrorResponse(response, "Adn record don't exist for " + oldAdn); return; @@ -343,7 +341,6 @@ public class AdnRecordCache extends Handler implements IccConstants { handleMessage(Message msg) { AsyncResult ar; int efid; - switch(msg.what) { case EVENT_LOAD_ALL_ADN_LIKE_DONE: /* arg1 is efid, obj.result is ArrayList<AdnRecord>*/ @@ -382,4 +379,24 @@ public class AdnRecordCache extends Handler implements IccConstants { break; } } + + @VisibleForTesting + protected void setAdnLikeWriters(int key, ArrayList<Message> waiters) { + mAdnLikeWaiters.put(EF_MBDN, waiters); + } + + @VisibleForTesting + protected void setAdnLikeFiles(int key, ArrayList<AdnRecord> adnRecordList) { + mAdnLikeFiles.put(EF_MBDN, adnRecordList); + } + + @VisibleForTesting + protected void setUserWriteResponse(int key, Message message) { + mUserWriteResponse.put(EF_MBDN, message); + } + + @VisibleForTesting + protected UsimPhoneBookManager getUsimPhoneBookManager() { + return mUsimPhoneBookManager; + } } |