diff options
author | 2023-01-17 18:14:36 -0800 | |
---|---|---|
committer | 2023-02-06 21:10:01 +0000 | |
commit | acd4dad5970699150be99e7edfb6edaf0545b210 (patch) | |
tree | 67c6374518dfdff4c2fd0d3cd9952f101cd7e8ab | |
parent | da8c7655e478a04a6578fbfa0559e7583d13a7cb (diff) |
Address Call Streaming API review comments.
1. Make CallStreamingService and StreamingCall SystemApi and hide
2. Add android.permission.BIND_STREAMING_SERVICE
3. Change StreamingCall#DisplayName to CharSequence
4. Hide StreamingCall constructor
5. Fix CallControl#startCallStreaming doc
Bug: 265304561
Test: build; add cts
API-Coverage-Bug: 268061643
Change-Id: I29771cfbf60553eb8325e40b2cd11c5828a445e4
-rw-r--r-- | core/api/current.txt | 28 | ||||
-rw-r--r-- | core/api/system-current.txt | 30 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 7 | ||||
-rw-r--r-- | telecomm/java/android/telecom/CallControl.java | 4 | ||||
-rw-r--r-- | telecomm/java/android/telecom/CallStreamingService.java | 27 | ||||
-rw-r--r-- | telecomm/java/android/telecom/StreamingCall.java | 17 |
6 files changed, 75 insertions, 38 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index de540bf93e4b..d494c2d6a5f2 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -41820,18 +41820,6 @@ package android.telecom { method public android.telecom.CallScreeningService.CallResponse.Builder setSkipNotification(boolean); } - public abstract class CallStreamingService extends android.app.Service { - ctor public CallStreamingService(); - method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent); - method public void onCallStreamingStarted(@NonNull android.telecom.StreamingCall); - method public void onCallStreamingStateChanged(int); - method public void onCallStreamingStopped(); - field public static final String SERVICE_INTERFACE = "android.telecom.CallStreamingService"; - field public static final int STREAMING_FAILED_ALREADY_STREAMING = 1; // 0x1 - field public static final int STREAMING_FAILED_NO_SENDER = 2; // 0x2 - field public static final int STREAMING_FAILED_SENDER_BINDING_ERROR = 3; // 0x3 - } - public abstract class Conference extends android.telecom.Conferenceable { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); @@ -42504,22 +42492,6 @@ package android.telecom { field @NonNull public static final android.os.Parcelable.Creator<android.telecom.StatusHints> CREATOR; } - public final class StreamingCall implements android.os.Parcelable { - ctor public StreamingCall(@NonNull android.content.ComponentName, @NonNull String, @NonNull android.net.Uri, @NonNull android.os.Bundle); - method public int describeContents(); - method @NonNull public android.net.Uri getAddress(); - method @NonNull public android.content.ComponentName getComponentName(); - method @NonNull public String getDisplayName(); - method @NonNull public android.os.Bundle getExtras(); - method public int getState(); - method public void requestStreamingState(int); - method public void writeToParcel(@NonNull android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator<android.telecom.StreamingCall> CREATOR; - field public static final int STATE_DISCONNECTED = 3; // 0x3 - field public static final int STATE_HOLDING = 2; // 0x2 - field public static final int STATE_STREAMING = 1; // 0x1 - } - public class TelecomManager { method public void acceptHandover(android.net.Uri, int, android.telecom.PhoneAccountHandle); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ANSWER_PHONE_CALLS, android.Manifest.permission.MODIFY_PHONE_STATE}) public void acceptRingingCall(); diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 4a0b2eb502dd..0ffbe73a962d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -46,6 +46,7 @@ package android { field public static final String BIND_ATTENTION_SERVICE = "android.permission.BIND_ATTENTION_SERVICE"; field public static final String BIND_AUGMENTED_AUTOFILL_SERVICE = "android.permission.BIND_AUGMENTED_AUTOFILL_SERVICE"; field public static final String BIND_CALL_DIAGNOSTIC_SERVICE = "android.permission.BIND_CALL_DIAGNOSTIC_SERVICE"; + field public static final String BIND_CALL_STREAMING_SERVICE = "android.permission.BIND_CALL_STREAMING_SERVICE"; field public static final String BIND_CELL_BROADCAST_SERVICE = "android.permission.BIND_CELL_BROADCAST_SERVICE"; field @Deprecated public static final String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE"; field public static final String BIND_CONTENT_CAPTURE_SERVICE = "android.permission.BIND_CONTENT_CAPTURE_SERVICE"; @@ -13075,6 +13076,19 @@ package android.telecom { method @NonNull @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean); } + public abstract class CallStreamingService extends android.app.Service { + ctor public CallStreamingService(); + method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent); + method public void onCallStreamingStarted(@NonNull android.telecom.StreamingCall); + method public void onCallStreamingStateChanged(int); + method public void onCallStreamingStopped(); + field public static final String SERVICE_INTERFACE = "android.telecom.CallStreamingService"; + field public static final int STREAMING_FAILED_ALREADY_STREAMING = 1; // 0x1 + field public static final int STREAMING_FAILED_NO_SENDER = 2; // 0x2 + field public static final int STREAMING_FAILED_SENDER_BINDING_ERROR = 3; // 0x3 + field public static final int STREAMING_FAILED_UNKNOWN = 0; // 0x0 + } + public abstract class Conference extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); method @Deprecated public final long getConnectTimeMillis(); @@ -13298,6 +13312,22 @@ package android.telecom { method @Deprecated public android.content.ComponentName getPackageName(); } + public final class StreamingCall implements android.os.Parcelable { + ctor public StreamingCall(@NonNull android.content.ComponentName, @NonNull CharSequence, @NonNull android.net.Uri, @NonNull android.os.Bundle); + method public int describeContents(); + method @NonNull public android.net.Uri getAddress(); + method @NonNull public android.content.ComponentName getComponentName(); + method @NonNull public CharSequence getDisplayName(); + method @NonNull public android.os.Bundle getExtras(); + method public int getState(); + method public void requestStreamingState(int); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telecom.StreamingCall> CREATOR; + field public static final int STATE_DISCONNECTED = 3; // 0x3 + field public static final int STATE_HOLDING = 2; // 0x2 + field public static final int STATE_STREAMING = 1; // 0x1 + } + public final class TelecomAnalytics implements android.os.Parcelable { ctor public TelecomAnalytics(java.util.List<android.telecom.TelecomAnalytics.SessionTiming>, java.util.List<android.telecom.ParcelableCallAnalytics>); method public int describeContents(); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 0b6b0a1350cb..9dc3140d0a2b 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2822,6 +2822,13 @@ <permission android:name="android.permission.BIND_INCALL_SERVICE" android:protectionLevel="signature|privileged" /> + <!-- Must be required by a {@link android.telecom.CallStreamingService}, + to ensure that only the system can bind to it. + <p>Protection level: signature + @SystemApi @hide--> + <permission android:name="android.permission.BIND_CALL_STREAMING_SERVICE" + android:protectionLevel="signature" /> + <!-- Allows to query ongoing call details and manage ongoing calls <p>Protection level: signature|appop --> <permission android:name="android.permission.MANAGE_ONGOING_CALLS" diff --git a/telecomm/java/android/telecom/CallControl.java b/telecomm/java/android/telecom/CallControl.java index f3c91f664dee..2135e276e591 100644 --- a/telecomm/java/android/telecom/CallControl.java +++ b/telecomm/java/android/telecom/CallControl.java @@ -197,10 +197,10 @@ public final class CallControl { * of the requested operation. * * {@link OutcomeReceiver#onResult} will be called if Telecom has successfully - * rejected the incoming call. + * started the call streaming. * * {@link OutcomeReceiver#onError} will be called if Telecom has failed to - * reject the incoming call. A {@link CallException} will be passed that + * start the call streaming. A {@link CallException} will be passed that * details why the operation failed. */ public void startCallStreaming(@CallbackExecutor @NonNull Executor executor, diff --git a/telecomm/java/android/telecom/CallStreamingService.java b/telecomm/java/android/telecom/CallStreamingService.java index 7f1112830222..3f538a7f262d 100644 --- a/telecomm/java/android/telecom/CallStreamingService.java +++ b/telecomm/java/android/telecom/CallStreamingService.java @@ -19,6 +19,7 @@ package android.telecom; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SdkConstant; +import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; import android.os.Handler; @@ -38,10 +39,22 @@ import java.lang.annotation.RetentionPolicy; /** * This service is implemented by an app that wishes to provide functionality for a general call * streaming sender for voip calls. - * - * TODO: add doc of how to be the general streaming sender - * + * <p> + * Below is an example manifest registration for a {@code CallStreamingService}. + * <pre> + * {@code + * <service android:name=".EgCallStreamingService" + * android:permission="android.permission.BIND_CALL_STREAMING_SERVICE" > + * ... + * <intent-filter> + * <action android:name="android.telecom.CallStreamingService" /> + * </intent-filter> + * </service> + * } + * </pre> + * @hide */ +@SystemApi public abstract class CallStreamingService extends Service { /** * The {@link android.content.Intent} that must be declared as handled by the service. @@ -122,6 +135,13 @@ public abstract class CallStreamingService extends Service { /** * Call streaming request reject reason used with * {@link CallEventCallback#onCallStreamingFailed(int)} to indicate that telecom is rejecting a + * call streaming request due to unknown reason. + */ + public static final int STREAMING_FAILED_UNKNOWN = 0; + + /** + * Call streaming request reject reason used with + * {@link CallEventCallback#onCallStreamingFailed(int)} to indicate that telecom is rejecting a * call streaming request because there's an ongoing streaming call on this device. */ public static final int STREAMING_FAILED_ALREADY_STREAMING = 1; @@ -149,6 +169,7 @@ public abstract class CallStreamingService extends Service { */ @IntDef(prefix = {"STREAMING_FAILED"}, value = { + STREAMING_FAILED_UNKNOWN, STREAMING_FAILED_ALREADY_STREAMING, STREAMING_FAILED_NO_SENDER, STREAMING_FAILED_SENDER_BINDING_ERROR diff --git a/telecomm/java/android/telecom/StreamingCall.java b/telecomm/java/android/telecom/StreamingCall.java index 4b27dd6f1e59..d4f43225139b 100644 --- a/telecomm/java/android/telecom/StreamingCall.java +++ b/telecomm/java/android/telecom/StreamingCall.java @@ -18,6 +18,7 @@ package android.telecom; import android.annotation.IntDef; import android.annotation.NonNull; +import android.annotation.SystemApi; import android.content.ComponentName; import android.net.Uri; import android.os.Bundle; @@ -30,7 +31,10 @@ import java.lang.annotation.RetentionPolicy; /** * Represents a voip call requested to stream to another device that the general streaming sender * app should present to the receiver. + * + * @hide */ +@SystemApi public final class StreamingCall implements Parcelable { /** * The state of a {@code StreamingCall} when newly created. General streaming sender should @@ -50,9 +54,12 @@ public final class StreamingCall implements Parcelable { */ public static final int STATE_DISCONNECTED = 3; + /** + * @hide + */ private StreamingCall(@NonNull Parcel in) { mComponentName = in.readParcelable(ComponentName.class.getClassLoader()); - mDisplayName = in.readString16NoHelper(); + mDisplayName = in.readCharSequence(); mAddress = in.readParcelable(Uri.class.getClassLoader()); mExtras = in.readBundle(); mState = in.readInt(); @@ -79,7 +86,7 @@ public final class StreamingCall implements Parcelable { @Override public void writeToParcel(@androidx.annotation.NonNull Parcel dest, int flags) { dest.writeParcelable(mComponentName, flags); - dest.writeString16NoHelper(mDisplayName); + dest.writeCharSequence(mDisplayName); dest.writeParcelable(mAddress, flags); dest.writeBundle(mExtras); dest.writeInt(mState); @@ -98,14 +105,14 @@ public final class StreamingCall implements Parcelable { public @interface StreamingCallState {} private final ComponentName mComponentName; - private final String mDisplayName; + private final CharSequence mDisplayName; private final Uri mAddress; private final Bundle mExtras; @StreamingCallState private int mState; private StreamingCallAdapter mAdapter = null; - public StreamingCall(@NonNull ComponentName componentName, @NonNull String displayName, + public StreamingCall(@NonNull ComponentName componentName, @NonNull CharSequence displayName, @NonNull Uri address, @NonNull Bundle extras) { mComponentName = componentName; mDisplayName = displayName; @@ -137,7 +144,7 @@ public final class StreamingCall implements Parcelable { * {@code StreamingCall} to the receiver side. */ @NonNull - public String getDisplayName() { + public CharSequence getDisplayName() { return mDisplayName; } |