summaryrefslogtreecommitdiff
path: root/telecomm
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/Connection.java13
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java29
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl5
3 files changed, 47 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index bbf34df8fe84..724a9e477b95 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -767,6 +767,19 @@ public abstract class Connection extends Conferenceable {
"android.telecom.extra.AUDIO_CODEC";
/**
+ * Float connection extra key used to store the audio codec bitrate in kbps for the current
+ * {@link Connection}.
+ */
+ public static final String EXTRA_AUDIO_CODEC_BITRATE_KBPS =
+ "android.telecom.extra.AUDIO_CODEC_BITRATE_KBPS";
+
+ /**
+ * Float connection extra key used to store the audio codec bandwidth in khz for the current
+ * {@link Connection}.
+ */
+ public static final String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ =
+ "android.telecom.extra.AUDIO_CODEC_BANDWIDTH_KHZ";
+ /**
* Connection event used to inform Telecom that it should play the on hold tone. This is used
* to play a tone when the peer puts the current call on hold. Sent to Telecom via
* {@link #sendConnectionEvent(String, Bundle)}.
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 724c17177f76..fbb1701dd52a 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
@@ -1589,6 +1590,30 @@ public class TelecomManager {
}
/**
+ * Returns whether the caller has {@link InCallService} access for companion apps.
+ *
+ * A companion app is an app associated with a physical wearable device via the
+ * {@link android.companion.CompanionDeviceManager} API.
+ *
+ * @return {@code true} if the caller has {@link InCallService} access for
+ * companion app; {@code false} otherwise.
+ */
+ public boolean hasCompanionInCallServiceAccess() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecomService().hasCompanionInCallServiceAccess(
+ mContext.getOpPackageName());
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException calling hasCompanionInCallServiceAccess().", e);
+ if (!isSystemProcess()) {
+ e.rethrowAsRuntimeException();
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns whether there is an ongoing call originating from a managed
* {@link ConnectionService}. An ongoing call can be in dialing, ringing, active or holding
* states.
@@ -2384,6 +2409,10 @@ public class TelecomManager {
}
}
+ private boolean isSystemProcess() {
+ return Process.myUid() == Process.SYSTEM_UID;
+ }
+
private ITelecomService getTelecomService() {
if (mTelecomServiceOverride != null) {
return mTelecomServiceOverride;
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index a28a999e8d19..6dc096daf4ea 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -179,6 +179,11 @@ interface ITelecomService {
boolean isInCall(String callingPackage, String callingFeatureId);
/**
+ * @see TelecomServiceImpl#hasCompanionInCallServiceAccess
+ */
+ boolean hasCompanionInCallServiceAccess(String callingPackage);
+
+ /**
* @see TelecomServiceImpl#isInManagedCall
*/
boolean isInManagedCall(String callingPackage, String callingFeatureId);