Merge "Use new APIs from SIM phonebook provider"
diff --git a/src/com/android/phone/SimPhonebookProvider.java b/src/com/android/phone/SimPhonebookProvider.java
index 4a15950..b921398 100644
--- a/src/com/android/phone/SimPhonebookProvider.java
+++ b/src/com/android/phone/SimPhonebookProvider.java
@@ -16,6 +16,9 @@
 
 package com.android.phone;
 
+import static com.android.internal.telephony.IccProvider.STR_NEW_TAG;
+import static com.android.internal.telephony.IccProvider.STR_NEW_NUMBER;
+
 import android.Manifest;
 import android.annotation.TestApi;
 import android.content.ContentProvider;
@@ -662,8 +665,11 @@
     private boolean updateRecord(PhonebookArgs args, AdnRecord existingRecord, String pin2,
             String newName, String newPhone) {
         try {
+            ContentValues values = new ContentValues();
+            values.put(STR_NEW_TAG, newName);
+            values.put(STR_NEW_NUMBER, newPhone);
             return mIccPhoneBookSupplier.get().updateAdnRecordsInEfByIndexForSubscriber(
-                    args.subscriptionId, existingRecord.getEfid(), newName, newPhone,
+                    args.subscriptionId, existingRecord.getEfid(), values,
                     existingRecord.getRecId(),
                     pin2);
         } catch (RemoteException e) {
diff --git a/tests/src/com/android/phone/SimPhonebookProviderTest.java b/tests/src/com/android/phone/SimPhonebookProviderTest.java
index 4ab92a7..f897fac 100644
--- a/tests/src/com/android/phone/SimPhonebookProviderTest.java
+++ b/tests/src/com/android/phone/SimPhonebookProviderTest.java
@@ -51,6 +51,7 @@
 import androidx.test.rule.provider.ProviderTestRule;
 
 import com.android.internal.telephony.IIccPhoneBook;
+import com.android.internal.telephony.uicc.AdnCapacity;
 import com.android.internal.telephony.uicc.AdnRecord;
 import com.android.internal.telephony.uicc.IccConstants;
 
@@ -1394,15 +1395,18 @@
         }
 
         @Override
-        public boolean updateAdnRecordsInEfBySearch(int efid, String oldTag, String oldPhoneNumber,
-                String newTag, String newPhoneNumber, String pin2) {
-            return updateAdnRecordsInEfBySearchForSubscriber(
-                    mDefaultSubscriptionId, efid,
-                    oldTag, oldPhoneNumber, newTag, newPhoneNumber, pin2);
+        public boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid,
+                ContentValues values, String pin2) {
+            final String oldTag = values.getAsString(IccProvider.STR_TAG);
+            final String oldPhoneNumber = values.getAsString(IccProvider.STR_NUMBER);
+            final String newTag = values.getAsString(IccProvider.STR_NEW_TAG);
+            final String newPhoneNumber = values.getAsString(IccProvider.STR_NEW_NUMBER);
+            return updateAdnRecordsInEfBySearchForSubscriber(subId, efid, oldTag, oldPhoneNumber,
+                    newTag, newPhoneNumber, pin2);
+
         }
 
-        @Override
-        public boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid, String oldTag,
+        private boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid, String oldTag,
                 String oldPhoneNumber, String newTag, String newPhoneNumber, String pin2) {
             if (!oldTag.isEmpty() || !oldPhoneNumber.isEmpty()) {
                 throw new IllegalArgumentException(
@@ -1413,14 +1417,16 @@
         }
 
         @Override
-        public boolean updateAdnRecordsInEfByIndex(int efid, String newTag, String newPhoneNumber,
-                int index, String pin2) {
-            return updateAdnRecordsInEfByIndexForSubscriber(mDefaultSubscriptionId,
-                    efid, newTag, newPhoneNumber, index, pin2);
+        public boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid,
+                ContentValues values, int index, String pin2) {
+            final String newTag = values.getAsString(IccProvider.STR_NEW_TAG);
+            final String newPhoneNumber = values.getAsString(IccProvider.STR_NEW_NUMBER);
+            return updateAdnRecordsInEfByIndexForSubscriber(subId, efid, newTag, newPhoneNumber,
+                    index, pin2);
+
         }
 
-        @Override
-        public boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, String newTag,
+        private boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, String newTag,
                 String newPhoneNumber, int index, String pin2) {
             AdnRecord[] records = mRecords.computeIfAbsent(Pair.create(subId, efid), unused ->
                     createEmptyRecords(efid, 100));
@@ -1443,6 +1449,11 @@
             int count = mRecords.get(key).length;
             return new int[]{recordSize, recordSize * count, count};
         }
+
+        @Override
+        public AdnCapacity getAdnRecordsCapacityForSubscriber(int subId) {
+            return new AdnCapacity(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+        }
     }
 
     /**