make callerInfo a systemAPI

move callinfo from telephony.internal to andorid.telephony package

Bug: 140908357
Test: Build
Change-Id: Ie4a6dbb16f6c4ed327134c1cb7579836ddba5d35
(cherry picked from commit 522943d2018794c6fc5ee8286fba62e677d9dd10)
Merged-in: Ie4a6dbb16f6c4ed327134c1cb7579836ddba5d35
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index e46cfc0..6c3f0bf 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -45,8 +45,8 @@
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallManager;
 import com.android.internal.telephony.CallStateException;
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfo;
+import android.telephony.CallerInfoAsyncQuery;
 import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.MmiCode;
@@ -835,7 +835,7 @@
             // Store CNAP information retrieved from the Connection (we want to do this
             // here regardless of whether the number is empty or not).
             cit.currentInfo.cnapName =  c.getCnapName();
-            cit.currentInfo.name = cit.currentInfo.cnapName; // This can still get overwritten
+            cit.currentInfo.setName(cit.currentInfo.cnapName); // This can still get overwritten
                                                              // by ContactInfo later
             cit.currentInfo.numberPresentation = c.getNumberPresentation();
             cit.currentInfo.namePresentation = c.getCnapNamePresentation();
@@ -854,7 +854,7 @@
                 number = modifyForSpecialCnapCases(context, cit.currentInfo, number,
                         cit.currentInfo.numberPresentation);
 
-                cit.currentInfo.phoneNumber = number;
+                cit.currentInfo.setPhoneNumber(number);
                 // For scenarios where we may receive a valid number from the network but a
                 // restricted/unavailable presentation, we do not want to perform a contact query
                 // (see note on isFinal above). So we set isFinal to true here as well.
@@ -913,14 +913,14 @@
                     // Store CNAP information retrieved from the Connection
                     cit.currentInfo.cnapName =  c.getCnapName();
                     // This can still get overwritten by ContactInfo
-                    cit.currentInfo.name = cit.currentInfo.cnapName;
+                    cit.currentInfo.setName(cit.currentInfo.cnapName);
                     cit.currentInfo.numberPresentation = c.getNumberPresentation();
                     cit.currentInfo.namePresentation = c.getCnapNamePresentation();
 
                     updatedNumber = modifyForSpecialCnapCases(context, cit.currentInfo,
                             updatedNumber, cit.currentInfo.numberPresentation);
 
-                    cit.currentInfo.phoneNumber = updatedNumber;
+                    cit.currentInfo.setPhoneNumber(updatedNumber);
                     if (DBG) {
                         log("startGetCallerInfo: updatedNumber="
                                 + toLogSafePhoneNumber(updatedNumber));
@@ -951,7 +951,7 @@
                     // Store CNAP information retrieved from the Connection
                     cit.currentInfo.cnapName = c.getCnapName();  // This can still get
                                                                  // overwritten by ContactInfo
-                    cit.currentInfo.name = cit.currentInfo.cnapName;
+                    cit.currentInfo.setName(cit.currentInfo.cnapName);
                     cit.currentInfo.numberPresentation = c.getNumberPresentation();
                     cit.currentInfo.namePresentation = c.getCnapNamePresentation();
 
@@ -1032,7 +1032,7 @@
                     // ...but copy over the (few) things we care about
                     // from the original CallerInfo object:
                     if (newCi != null) {
-                        newCi.phoneNumber = ci.phoneNumber; // To get formatted phone number
+                        newCi.setPhoneNumber(ci.getPhoneNumber()); // To get formatted phone number
                         newCi.geoDescription = ci.geoDescription; // To get geo description string
                         ci = newCi;
                     }
@@ -1054,14 +1054,14 @@
 
         String compactName = null;
         if (ci != null) {
-            if (TextUtils.isEmpty(ci.name)) {
+            if (TextUtils.isEmpty(ci.getName())) {
                 // Perform any modifications for special CNAP cases to
                 // the phone number being displayed, if applicable.
-                compactName = modifyForSpecialCnapCases(context, ci, ci.phoneNumber,
+                compactName = modifyForSpecialCnapCases(context, ci, ci.getPhoneNumber(),
                                                         ci.numberPresentation);
             } else {
                 // Don't call modifyForSpecialCnapCases on regular name. See b/2160795.
-                compactName = ci.name;
+                compactName = ci.getName();
             }
         }
 
diff --git a/tests/src/com/android/phone/CnapTest.java b/tests/src/com/android/phone/CnapTest.java
index 7161ba8..534d02a 100644
--- a/tests/src/com/android/phone/CnapTest.java
+++ b/tests/src/com/android/phone/CnapTest.java
@@ -19,12 +19,9 @@
 import android.content.Context;
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
-import com.android.internal.telephony.CallerInfo;
-import com.android.phone.PhoneUtils;
+import android.telephony.CallerInfo;
+
 import static com.android.internal.telephony.PhoneConstants.PRESENTATION_ALLOWED;
-import static com.android.internal.telephony.PhoneConstants.PRESENTATION_PAYPHONE;
-import static com.android.internal.telephony.PhoneConstants.PRESENTATION_RESTRICTED;
 import static com.android.internal.telephony.PhoneConstants.PRESENTATION_UNKNOWN;
 
 // Test suite for the Caller Name Presentation (CNAP) handling.