Merge "API review cleanups."
diff --git a/src/java/android/net/sip/ISipService.aidl b/src/java/android/net/sip/ISipService.aidl
index f88ed6c..adbf1cb 100644
--- a/src/java/android/net/sip/ISipService.aidl
+++ b/src/java/android/net/sip/ISipService.aidl
@@ -39,5 +39,5 @@
             in ISipSessionListener listener, String opPackageName);
     ISipSession getPendingSession(String callId, String opPackageName);
 
-    List<SipProfile> getListOfProfiles(String opPackageName);
+    List<SipProfile> getProfiles(String opPackageName);
 }
diff --git a/src/java/android/net/sip/SipAudioCall.java b/src/java/android/net/sip/SipAudioCall.java
index a1a5ae8..363995c 100644
--- a/src/java/android/net/sip/SipAudioCall.java
+++ b/src/java/android/net/sip/SipAudioCall.java
@@ -18,6 +18,7 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.SystemApi;
 import android.content.Context;
 import android.media.AudioManager;
 import android.net.rtp.AudioCodec;
@@ -960,7 +961,9 @@
      * @return the {@link AudioGroup} object or null if the RTP stream has not
      *      yet been set up
      * @see #getAudioStream
+     * @hide
      */
+    @SystemApi
     public @Nullable AudioGroup getAudioGroup() {
         synchronized (mLock) {
             if (mAudioGroup != null) return mAudioGroup;
@@ -978,7 +981,9 @@
      * settings of the first object (that merges others) override others'.
      *
      * @see #getAudioStream
+     * @hide
      */
+    @SystemApi
     public void setAudioGroup(@NonNull AudioGroup group) {
         synchronized (mLock) {
             if (DBG) log("setAudioGroup: group=" + group);
diff --git a/src/java/android/net/sip/SipManager.java b/src/java/android/net/sip/SipManager.java
index 43b816b..39f66de 100644
--- a/src/java/android/net/sip/SipManager.java
+++ b/src/java/android/net/sip/SipManager.java
@@ -18,6 +18,7 @@
 
 import android.annotation.NonNull;
 import android.annotation.SdkConstant;
+import android.annotation.SystemApi;
 import android.app.PendingIntent;
 import android.content.Context;
 import android.content.Intent;
@@ -86,15 +87,19 @@
 
     /**
      * Intent action sent when the SipManager becomes available.
+     * @hide
      */
     @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+    @SystemApi
     public static final String ACTION_SIP_SERVICE_UP =
             "android.net.sip.action.SIP_SERVICE_UP";
 
     /**
      * Intent action sent when there is a new incoming SIP call.
+     * @hide
      */
     @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+    @SystemApi
     public static final String ACTION_SIP_INCOMING_CALL =
             "android.net.sip.action.SIP_INCOMING_CALL";
 
@@ -108,23 +113,29 @@
 
     /**
      * Intent action sent when a SIP profile has been removed.
+     * @hide
      */
     @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+    @SystemApi
     public static final String ACTION_SIP_REMOVE_PROFILE =
             "android.net.sip.action.SIP_REMOVE_PROFILE";
 
     /**
      * Intent action sent when the SIP accounts or other configuration has changed.
      * This should trigger a re-registration of the SIP PhoneAccounts.
+     * @hide
      */
     @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+    @SystemApi
     public static final String ACTION_SIP_CALL_OPTION_CHANGED =
             "android.net.sip.action.SIP_CALL_OPTION_CHANGED";
 
     /**
      * Intent action used by Telephony to start the SIP service after about.
+     * @hide
      */
     @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+    @SystemApi
     public static final String ACTION_START_SIP =
             "android.net.sip.action.START_SIP";
 
@@ -610,13 +621,15 @@
     /**
      * Gets the list of profiles hosted by the SIP service. The user information
      * (username, password and display name) are crossed out.
+     * @hide
      */
-    public @NonNull List<SipProfile> getListOfProfiles() throws SipException {
+    @SystemApi
+    public @NonNull List<SipProfile> getProfiles() throws SipException {
         try {
             checkSipServiceConnection();
-            return mSipService.getListOfProfiles(mContext.getOpPackageName());
+            return mSipService.getProfiles(mContext.getOpPackageName());
         } catch (RemoteException e) {
-            return new ArrayList<>();
+            throw new SipException(e.getMessage());
         }
     }
 
diff --git a/src/java/android/net/sip/SipProfile.java b/src/java/android/net/sip/SipProfile.java
index 98069c0..14b0334 100644
--- a/src/java/android/net/sip/SipProfile.java
+++ b/src/java/android/net/sip/SipProfile.java
@@ -16,6 +16,7 @@
 
 package android.net.sip;
 
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.text.TextUtils;
@@ -489,7 +490,9 @@
      * Gets the calling process's Uid in the sip settings.
      *
      * @return the calling process's Uid in the sip settings.
+     * @hide
      */
+    @SystemApi
     public int getCallingUid() {
         return mCallingUid;
     }
diff --git a/src/java/com/android/server/sip/SipService.java b/src/java/com/android/server/sip/SipService.java
index a766f95..7c6daf8 100644
--- a/src/java/com/android/server/sip/SipService.java
+++ b/src/java/com/android/server/sip/SipService.java
@@ -129,9 +129,10 @@
     }
 
     @Override
-    public synchronized List<SipProfile> getListOfProfiles(String opPackageName) {
-        if (!canUseSip(opPackageName, "getListOfProfiles")) {
-            return new ArrayList<>();
+    public synchronized List<SipProfile> getProfiles(String opPackageName) throws RemoteException {
+        if (!canUseSip(opPackageName, "getProfiles")) {
+            throw new RemoteException(String.format("Package %s cannot use Sip service",
+                    opPackageName));
         }
         boolean isCallerRadio = isCallerRadio();
         ArrayList<SipProfile> profiles = new ArrayList<>();