summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-17 23:33:46 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-01-17 23:33:46 +0000
commit09aab419f339921d11c2e22e78a091111a9314f6 (patch)
tree3079efdacc05d01c2d75cd3e25cd27dce06ebdb0
parentbcc067f50dade44df941dbedb0ae03636f6413d8 (diff)
parent78f2ef1970b347f5f8312bbbeb821bb950a1e67a (diff)
downloadvoip-09aab419f339921d11c2e22e78a091111a9314f6.tar.gz
Merge "Cleanup voip-common API usage in Telephony." am: e5c95414ee am: 77d71ac5fb am: 78f2ef1970
Change-Id: Ifb0a6c2084d520b02f8fb0605d16231984be6cc2
-rw-r--r--src/java/android/net/sip/ISipService.aidl2
-rw-r--r--src/java/android/net/sip/SipManager.java52
-rw-r--r--src/java/android/net/sip/SipProfile.java4
-rw-r--r--src/java/com/android/server/sip/SipService.java11
4 files changed, 39 insertions, 30 deletions
diff --git a/src/java/android/net/sip/ISipService.aidl b/src/java/android/net/sip/ISipService.aidl
index 84750c7..f88ed6c 100644
--- a/src/java/android/net/sip/ISipService.aidl
+++ b/src/java/android/net/sip/ISipService.aidl
@@ -39,5 +39,5 @@ interface ISipService {
in ISipSessionListener listener, String opPackageName);
ISipSession getPendingSession(String callId, String opPackageName);
- SipProfile[] getListOfProfiles(String opPackageName);
+ List<SipProfile> getListOfProfiles(String opPackageName);
}
diff --git a/src/java/android/net/sip/SipManager.java b/src/java/android/net/sip/SipManager.java
index 0cb1feb..43b816b 100644
--- a/src/java/android/net/sip/SipManager.java
+++ b/src/java/android/net/sip/SipManager.java
@@ -16,6 +16,8 @@
package android.net.sip;
+import android.annotation.NonNull;
+import android.annotation.SdkConstant;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -26,6 +28,8 @@ import android.os.ServiceManager;
import android.telephony.Rlog;
import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
/**
* Provides APIs for SIP tasks, such as initiating SIP connections, and provides access to related
@@ -81,19 +85,19 @@ public class SipManager {
public static final String EXTRA_OFFER_SD = "android:sipOfferSD";
/**
- * Action to broadcast when SipService is up.
- * Internal use only.
- * @hide
+ * Intent action sent when the SipManager becomes available.
*/
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SIP_SERVICE_UP =
- "android.net.sip.SIP_SERVICE_UP";
+ "android.net.sip.action.SIP_SERVICE_UP";
+
/**
- * Action string for the incoming call intent for the Phone app.
- * Internal use only.
- * @hide
+ * Intent action sent when there is a new incoming SIP call.
*/
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SIP_INCOMING_CALL =
- "com.android.phone.SIP_INCOMING_CALL";
+ "android.net.sip.action.SIP_INCOMING_CALL";
+
/**
* Action string for the add-phone intent.
* Internal use only.
@@ -101,23 +105,28 @@ public class SipManager {
*/
public static final String ACTION_SIP_ADD_PHONE =
"com.android.phone.SIP_ADD_PHONE";
+
/**
- * Action string for the remove-phone intent.
- * Internal use only.
- * @hide
+ * Intent action sent when a SIP profile has been removed.
*/
- public static final String ACTION_SIP_REMOVE_PHONE =
- "com.android.phone.SIP_REMOVE_PHONE";
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_SIP_REMOVE_PROFILE =
+ "android.net.sip.action.SIP_REMOVE_PROFILE";
/**
- * Action string for the SIP call option configuration changed intent.
- * This is used to communicate change to the SIP call option, triggering re-registration of
- * the SIP phone accounts.
- * Internal use only.
- * @hide
+ * Intent action sent when the SIP accounts or other configuration has changed.
+ * This should trigger a re-registration of the SIP PhoneAccounts.
*/
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SIP_CALL_OPTION_CHANGED =
- "com.android.phone.SIP_CALL_OPTION_CHANGED";
+ "android.net.sip.action.SIP_CALL_OPTION_CHANGED";
+
+ /**
+ * Intent action used by Telephony to start the SIP service after about.
+ */
+ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_START_SIP =
+ "android.net.sip.action.START_SIP";
/**
* Part of the ACTION_SIP_ADD_PHONE and ACTION_SIP_REMOVE_PHONE intents.
@@ -601,14 +610,13 @@ public class SipManager {
/**
* Gets the list of profiles hosted by the SIP service. The user information
* (username, password and display name) are crossed out.
- * @hide
*/
- public SipProfile[] getListOfProfiles() throws SipException {
+ public @NonNull List<SipProfile> getListOfProfiles() throws SipException {
try {
checkSipServiceConnection();
return mSipService.getListOfProfiles(mContext.getOpPackageName());
} catch (RemoteException e) {
- return new SipProfile[0];
+ return new ArrayList<>();
}
}
diff --git a/src/java/android/net/sip/SipProfile.java b/src/java/android/net/sip/SipProfile.java
index 0ef754c..98069c0 100644
--- a/src/java/android/net/sip/SipProfile.java
+++ b/src/java/android/net/sip/SipProfile.java
@@ -480,7 +480,6 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
/**
* Sets the calling process's Uid in the sip service.
- * @hide
*/
public void setCallingUid(int uid) {
mCallingUid = uid;
@@ -488,7 +487,8 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
/**
* Gets the calling process's Uid in the sip settings.
- * @hide
+ *
+ * @return the calling process's Uid in the sip settings.
*/
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 e691d35..15f3cec 100644
--- a/src/java/com/android/server/sip/SipService.java
+++ b/src/java/com/android/server/sip/SipService.java
@@ -52,6 +52,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -128,18 +129,18 @@ public final class SipService extends ISipService.Stub {
}
@Override
- public synchronized SipProfile[] getListOfProfiles(String opPackageName) {
+ public synchronized List<SipProfile> getListOfProfiles(String opPackageName) {
if (!canUseSip(opPackageName, "getListOfProfiles")) {
- return new SipProfile[0];
+ return new ArrayList<>();
}
boolean isCallerRadio = isCallerRadio();
- ArrayList<SipProfile> profiles = new ArrayList<SipProfile>();
+ ArrayList<SipProfile> profiles = new ArrayList<>();
for (SipSessionGroupExt group : mSipGroups.values()) {
if (isCallerRadio || isCallerCreator(group)) {
profiles.add(group.getLocalProfile());
}
}
- return profiles.toArray(new SipProfile[profiles.size()]);
+ return profiles;
}
@Override
@@ -350,7 +351,7 @@ public final class SipService extends ISipService.Stub {
private void notifyProfileRemoved(SipProfile localProfile) {
if (DBG) log("notify: profile removed: " + localProfile);
- Intent intent = new Intent(SipManager.ACTION_SIP_REMOVE_PHONE);
+ Intent intent = new Intent(SipManager.ACTION_SIP_REMOVE_PROFILE);
intent.putExtra(SipManager.EXTRA_LOCAL_URI, localProfile.getUriString());
mContext.sendBroadcast(intent);
if (mSipGroups.size() == 0) {