From 22c8b961528e92907eb7e886fa656de063579b1e Mon Sep 17 00:00:00 2001 From: Grace Jia Date: Thu, 28 Oct 2021 17:04:29 -0700 Subject: Add API for external call audio route. Test: CTS test Change-Id: Ibd1c2880e732f39281f5f6616465bf2c680c1b0d --- telecomm/java/android/telecom/Call.java | 12 +++++++++++- telecomm/java/android/telecom/CallAudioState.java | 19 +++++++++++++++---- telecomm/java/android/telecom/Connection.java | 9 +++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) (limited to 'telecomm/java/android') diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index d94fafc6a5bf..ce9530c196ef 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -701,8 +701,15 @@ public final class Call { */ public static final int PROPERTY_CROSS_SIM = 0x00004000; + /** + * Connection is a tethered external call. + * Indicates that the {@link Connection} is fixed on this device but the audio streams are + * re-routed to another device. + */ + public static final int PROPERTY_TETHERED_CALL = 0x00008000; + //****************************************************************************************** - // Next PROPERTY value: 0x00004000 + // Next PROPERTY value: 0x00010000 //****************************************************************************************** private final @CallState int mState; @@ -899,6 +906,9 @@ public final class Call { if (hasProperty(properties, PROPERTY_CROSS_SIM)) { builder.append(" PROPERTY_CROSS_SIM"); } + if (hasProperty(properties, PROPERTY_TETHERED_CALL)) { + builder.append(" PROPERTY_TETHERED_CALL"); + } builder.append("]"); return builder.toString(); } diff --git a/telecomm/java/android/telecom/CallAudioState.java b/telecomm/java/android/telecom/CallAudioState.java index 4b9098504bc7..55957bd85eaa 100644 --- a/telecomm/java/android/telecom/CallAudioState.java +++ b/telecomm/java/android/telecom/CallAudioState.java @@ -27,7 +27,6 @@ import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -42,7 +41,8 @@ import java.util.stream.Collectors; public final class CallAudioState implements Parcelable { /** @hide */ @Retention(RetentionPolicy.SOURCE) - @IntDef(value={ROUTE_EARPIECE, ROUTE_BLUETOOTH, ROUTE_WIRED_HEADSET, ROUTE_SPEAKER}, + @IntDef(value = {ROUTE_EARPIECE, ROUTE_BLUETOOTH, ROUTE_WIRED_HEADSET, ROUTE_SPEAKER, + ROUTE_EXTERNAL}, flag=true) public @interface CallAudioRoute {} @@ -58,6 +58,9 @@ public final class CallAudioState implements Parcelable { /** Direct the audio stream through the device's speakerphone. */ public static final int ROUTE_SPEAKER = 0x00000008; + /** Direct the audio stream through another device. */ + public static final int ROUTE_EXTERNAL = 0x00000010; + /** * Direct the audio stream through the device's earpiece or wired headset if one is * connected. @@ -70,7 +73,7 @@ public final class CallAudioState implements Parcelable { * @hide **/ public static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET | - ROUTE_SPEAKER; + ROUTE_SPEAKER | ROUTE_EXTERNAL; private final boolean isMuted; private final int route; @@ -189,7 +192,11 @@ public final class CallAudioState implements Parcelable { */ @CallAudioRoute public int getSupportedRouteMask() { - return supportedRouteMask; + if (route == ROUTE_EXTERNAL) { + return ROUTE_EXTERNAL; + } else { + return supportedRouteMask; + } } /** @@ -233,6 +240,10 @@ public final class CallAudioState implements Parcelable { listAppend(buffer, "SPEAKER"); } + if ((route & ROUTE_EXTERNAL) == ROUTE_EXTERNAL) { + listAppend(buffer, "EXTERNAL"); + } + return buffer.toString(); } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 9fec96b7f549..22a37d050cf4 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -561,6 +561,15 @@ public abstract class Connection extends Conferenceable { */ public static final int PROPERTY_CROSS_SIM = 1 << 13; + /** + * Connection is a tethered external call. + *

+ * Indicates that the {@link Connection} is fixed on this device but the audio streams are + * re-routed to another device. + *

+ */ + public static final int PROPERTY_TETHERED_CALL = 1 << 14; + //********************************************************************************************** // Next PROPERTY value: 1<<14 //********************************************************************************************** -- cgit v1.2.3-59-g8ed1b