Merge "expose callerInfo to systemAPI" am: f71573ff24 am: fd26d00178
am: ade79e2b37

Change-Id: Icc9c062ab835b0aa7d2883a11243ec81cb9b4f21
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 7ee5c37..8b13709 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -56,7 +56,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telecom.IVideoProvider;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.internal.telephony.SmsApplication;
 import com.android.internal.util.Preconditions;
 
@@ -1135,11 +1135,11 @@
     }
 
     public String getName() {
-        return mCallerInfo == null ? null : mCallerInfo.name;
+        return mCallerInfo == null ? null : mCallerInfo.getName();
     }
 
     public String getPhoneNumber() {
-        return mCallerInfo == null ? null : mCallerInfo.phoneNumber;
+        return mCallerInfo == null ? null : mCallerInfo.getPhoneNumber();
     }
 
     public Bitmap getPhotoIcon() {
@@ -2293,7 +2293,7 @@
         if (mCallerInfo == null || !mCallerInfo.contactExists) {
             return getHandle();
         }
-        return Contacts.getLookupUri(mCallerInfo.contactIdOrZero, mCallerInfo.lookupKey);
+        return Contacts.getLookupUri(mCallerInfo.getContactId(), mCallerInfo.lookupKey);
     }
 
     Uri getRingtone() {
@@ -2726,7 +2726,7 @@
         mCallerInfo = callerInfo;
         Log.i(this, "CallerInfo received for %s: %s", Log.piiHandle(mHandle), callerInfo);
 
-        if (mCallerInfo.contactDisplayPhotoUri == null ||
+        if (mCallerInfo.getContactDisplayPhotoUri() == null ||
                 mCallerInfo.cachedPhotoIcon != null || mCallerInfo.cachedPhoto != null) {
             for (Listener l : mListeners) {
                 l.onCallerInfoChanged(this);
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 719277e..664cbd3 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -41,7 +41,7 @@
 
 // TODO: Needed for move to system service: import com.android.internal.R;
 import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.callfiltering.CallFilteringResult;
 
 import java.util.Arrays;
diff --git a/src/com/android/server/telecom/CallerInfoAsyncQueryFactory.java b/src/com/android/server/telecom/CallerInfoAsyncQueryFactory.java
index 500f16e..0a61493 100644
--- a/src/com/android/server/telecom/CallerInfoAsyncQueryFactory.java
+++ b/src/com/android/server/telecom/CallerInfoAsyncQueryFactory.java
@@ -15,7 +15,7 @@
  */
 package com.android.server.telecom;
 
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfoAsyncQuery;
 
 import android.content.Context;
 
diff --git a/src/com/android/server/telecom/CallerInfoLookupHelper.java b/src/com/android/server/telecom/CallerInfoLookupHelper.java
index a919921..931eeb6 100644
--- a/src/com/android/server/telecom/CallerInfoLookupHelper.java
+++ b/src/com/android/server/telecom/CallerInfoLookupHelper.java
@@ -18,8 +18,6 @@
 
 import android.annotation.Nullable;
 import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
@@ -30,10 +28,9 @@
 import android.util.Pair;
 
 import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfo;
+import android.telephony.CallerInfoAsyncQuery;
 
-import java.io.InputStream;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -194,14 +191,14 @@
                         for (OnQueryCompleteListener l : info.listeners) {
                             l.onCallerInfoQueryComplete(handle, ci);
                         }
-                        if (ci.contactDisplayPhotoUri == null) {
+                        if (ci.getContactDisplayPhotoUri() == null) {
                             Log.i(CallerInfoLookupHelper.this, "There is no photo for this " +
                                     "contact, skipping photo query");
                             mQueryEntries.remove(handle);
                         } else {
                             info.callerInfo = ci;
                             info.imageQueryPending = true;
-                            startPhotoLookup(handle, ci.contactDisplayPhotoUri);
+                            startPhotoLookup(handle, ci.getContactDisplayPhotoUri());
                         }
                     } else {
                         Log.i(CallerInfoLookupHelper.this, "CI query for handle %s has completed," +
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index d66d8ae..fa13a8d 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -69,7 +69,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.AsyncEmergencyContactNotifier;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.util.IndentingPrintWriter;
diff --git a/src/com/android/server/telecom/MissedCallNotifier.java b/src/com/android/server/telecom/MissedCallNotifier.java
index 500122b..c4a09ee 100644
--- a/src/com/android/server/telecom/MissedCallNotifier.java
+++ b/src/com/android/server/telecom/MissedCallNotifier.java
@@ -20,7 +20,7 @@
 import android.os.UserHandle;
 import android.telecom.PhoneAccountHandle;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 
 /**
  * Creates a notification for calls that the user missed (neither answered nor rejected).
@@ -75,11 +75,11 @@
         }
 
         public String getPhoneNumber() {
-            return mCallerInfo == null ? null : mCallerInfo.phoneNumber;
+            return mCallerInfo == null ? null : mCallerInfo.getPhoneNumber();
         }
 
         public String getName() {
-            return mCallerInfo == null ? null : mCallerInfo.name;
+            return mCallerInfo == null ? null : mCallerInfo.getName();
         }
     }
 
diff --git a/src/com/android/server/telecom/RingtoneFactory.java b/src/com/android/server/telecom/RingtoneFactory.java
index 4ea5008..42b1fb3 100644
--- a/src/com/android/server/telecom/RingtoneFactory.java
+++ b/src/com/android/server/telecom/RingtoneFactory.java
@@ -21,7 +21,6 @@
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.media.AudioAttributes;
-import android.media.AudioManager;
 import android.media.RingtoneManager;
 import android.media.Ringtone;
 import android.media.VolumeShaper;
@@ -31,11 +30,10 @@
 import android.provider.Settings;
 
 import android.telecom.Log;
-import android.telecom.PhoneAccount;
 import android.text.TextUtils;
 
 import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 
 import java.util.List;
 
diff --git a/src/com/android/server/telecom/callfiltering/AsyncBlockCheckFilter.java b/src/com/android/server/telecom/callfiltering/AsyncBlockCheckFilter.java
index edc68dd..fbc79e6 100644
--- a/src/com/android/server/telecom/callfiltering/AsyncBlockCheckFilter.java
+++ b/src/com/android/server/telecom/callfiltering/AsyncBlockCheckFilter.java
@@ -26,7 +26,7 @@
 import android.telecom.Logging.Session;
 import android.telecom.TelecomManager;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.CallerInfoLookupHelper;
 import com.android.server.telecom.LogUtils;
diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
index 42d9a59..249d878 100644
--- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
+++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
@@ -29,7 +29,7 @@
 import android.telephony.CarrierConfigManager;
 import android.text.TextUtils;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.CallScreeningServiceHelper;
 import com.android.server.telecom.CallerInfoLookupHelper;
diff --git a/src/com/android/server/telecom/callfiltering/DirectToVoicemailCallFilter.java b/src/com/android/server/telecom/callfiltering/DirectToVoicemailCallFilter.java
index 16d731b..8992a3b 100644
--- a/src/com/android/server/telecom/callfiltering/DirectToVoicemailCallFilter.java
+++ b/src/com/android/server/telecom/callfiltering/DirectToVoicemailCallFilter.java
@@ -20,7 +20,7 @@
 import android.provider.CallLog.Calls;
 import android.telecom.Log;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.CallerInfoLookupHelper;
 import com.android.server.telecom.LogUtils;
diff --git a/src/com/android/server/telecom/components/TelecomService.java b/src/com/android/server/telecom/components/TelecomService.java
index 0eab83f..dcb366d 100644
--- a/src/com/android/server/telecom/components/TelecomService.java
+++ b/src/com/android/server/telecom/components/TelecomService.java
@@ -29,7 +29,7 @@
 import android.os.SystemClock;
 import android.telecom.Log;
 
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfoAsyncQuery;
 import com.android.server.telecom.AsyncRingtonePlayer;
 import com.android.server.telecom.BluetoothAdapterProxy;
 import com.android.server.telecom.BluetoothPhoneServiceImpl;
diff --git a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
index 7fee263..66873c2 100644
--- a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
+++ b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
@@ -62,7 +62,7 @@
 import android.text.TextDirectionHeuristics;
 import android.text.TextUtils;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 
 import java.lang.Override;
 import java.lang.String;
@@ -601,7 +601,7 @@
                                                 return;
                                             }
                                             if (info == null ||
-                                                    info.contactDisplayPhotoUri == null) {
+                                                    info.getContactDisplayPhotoUri() == null) {
                                                 // If there is no photo or if the caller info is
                                                 // null, just show the notification.
                                                 CallInfo callInfo = callInfoFactory.makeCallInfo(
diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
index 04f0e66..b8a5c19 100644
--- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java
+++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
@@ -59,7 +59,7 @@
 import androidx.test.filters.FlakyTest;
 
 import com.android.internal.telecom.IInCallAdapter;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 
 import com.google.common.base.Predicate;
 
diff --git a/tests/src/com/android/server/telecom/tests/CallScreeningServiceControllerTest.java b/tests/src/com/android/server/telecom/tests/CallScreeningServiceControllerTest.java
index 24cc8d2..59ea094 100644
--- a/tests/src/com/android/server/telecom/tests/CallScreeningServiceControllerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallScreeningServiceControllerTest.java
@@ -34,7 +34,7 @@
 import android.telephony.CarrierConfigManager;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.CallScreeningServiceHelper;
 import com.android.server.telecom.CallerInfoLookupHelper;
diff --git a/tests/src/com/android/server/telecom/tests/CallerInfoAsyncQueryFactoryFixture.java b/tests/src/com/android/server/telecom/tests/CallerInfoAsyncQueryFactoryFixture.java
index 5f9555c..75ad3c6 100644
--- a/tests/src/com/android/server/telecom/tests/CallerInfoAsyncQueryFactoryFixture.java
+++ b/tests/src/com/android/server/telecom/tests/CallerInfoAsyncQueryFactoryFixture.java
@@ -16,8 +16,8 @@
 
 package com.android.server.telecom.tests;
 
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfo;
+import android.telephony.CallerInfoAsyncQuery;
 import com.android.server.telecom.CallerInfoAsyncQueryFactory;
 
 import android.content.Context;
diff --git a/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java b/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
index d4bff89..a93b8a4 100644
--- a/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
@@ -37,8 +37,8 @@
 
 import androidx.test.InstrumentationRegistry;
 
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
+import android.telephony.CallerInfo;
+import android.telephony.CallerInfoAsyncQuery;
 import com.android.server.telecom.CallerInfoAsyncQueryFactory;
 import com.android.server.telecom.CallerInfoLookupHelper;
 import com.android.server.telecom.ContactsAsyncHelper;
@@ -125,7 +125,7 @@
     public void testSimpleLookup() {
         CallerInfoLookupHelper.OnQueryCompleteListener listener = mock(
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
-        mCallerInfo1.contactDisplayPhotoUri = CONTACTS_PHOTO_URI;
+        mCallerInfo1.SetContactDisplayPhotoUri(CONTACTS_PHOTO_URI);
 
         mCallerInfoLookupHelper.startLookup(URI1, listener);
         waitForActionCompletion();
@@ -164,7 +164,7 @@
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
         CallerInfoLookupHelper.OnQueryCompleteListener otherListener = mock(
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
-        mCallerInfo1.contactDisplayPhotoUri = CONTACTS_PHOTO_URI;
+        mCallerInfo1.SetContactDisplayPhotoUri(CONTACTS_PHOTO_URI);
 
         mCallerInfoLookupHelper.startLookup(URI1, callListener);
         mCallerInfoLookupHelper.startLookup(URI1, otherListener);
@@ -205,7 +205,7 @@
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
         CallerInfoLookupHelper.OnQueryCompleteListener otherListener = mock(
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
-        mCallerInfo1.contactDisplayPhotoUri = CONTACTS_PHOTO_URI;
+        mCallerInfo1.SetContactDisplayPhotoUri(CONTACTS_PHOTO_URI);
 
         mCallerInfoLookupHelper.startLookup(URI1, callListener);
         waitForActionCompletion();
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index 065c9b8..3c4be68 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -49,7 +49,7 @@
 import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.AsyncRingtonePlayer;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.CallAudioManager;
diff --git a/tests/src/com/android/server/telecom/tests/DirectToVoicemailCallFilterTest.java b/tests/src/com/android/server/telecom/tests/DirectToVoicemailCallFilterTest.java
index e62a9fc..4502da7 100644
--- a/tests/src/com/android/server/telecom/tests/DirectToVoicemailCallFilterTest.java
+++ b/tests/src/com/android/server/telecom/tests/DirectToVoicemailCallFilterTest.java
@@ -20,7 +20,7 @@
 import android.provider.CallLog.Calls;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.Call;
 import com.android.server.telecom.callfiltering.CallFilterResultCallback;
 import com.android.server.telecom.CallerInfoLookupHelper;
diff --git a/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java b/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
index 404fcbd..101bf97 100644
--- a/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
@@ -39,7 +39,7 @@
 import android.telephony.TelephonyManager;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
 import com.android.server.telecom.CallerInfoLookupHelper;
 import com.android.server.telecom.Constants;
 import com.android.server.telecom.DefaultDialerCache;