summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Grant Menke <grantmenke@google.com> 2024-11-22 11:40:10 -0800
committer Grant Menke <grantmenke@google.com> 2024-12-04 11:07:49 -0800
commit61512276a69001af73eb5c9d322e1b0243465faa (patch)
tree9489f9d38ac3b6b7a59d8d3485d7d9778bb6a97f
parent2bbce8623da09b2398f3b81b89db5ae10dbf2a92 (diff)
Allow privileged apps to accept and end VOIP calls.
This change updates relevant docs to describe that TelecomManager APIs allow privileged app invocations to accept and end VOIP calls. This CL also adds support for checking if an app is the sytem UI app which is considered privileged. This functionality was requested by the accessibility team in order to support their talkback double tap gesture feature. Bug: 353579043 Flag: com.android.server.telecom.flags.allow_system_apps_resolve_voip_calls Test: atest TelecomServiceImplTest Change-Id: Ia0a8dbd7bcdd88b5a8cc4b0f908f935d77f6c734
-rw-r--r--services/core/java/com/android/server/telecom/TelecomLoaderService.java6
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java9
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomLoader.aidl2
3 files changed, 14 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/telecom/TelecomLoaderService.java b/services/core/java/com/android/server/telecom/TelecomLoaderService.java
index 63a3e5ae7d8b..a38fc5bb6e45 100644
--- a/services/core/java/com/android/server/telecom/TelecomLoaderService.java
+++ b/services/core/java/com/android/server/telecom/TelecomLoaderService.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
+import android.content.pm.PackageManagerInternal;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -63,7 +64,10 @@ public class TelecomLoaderService extends SystemService {
// as this loader (process="system") that's redundant here.
try {
ITelecomLoader telecomLoader = ITelecomLoader.Stub.asInterface(service);
- ITelecomService telecomService = telecomLoader.createTelecomService(mServiceRepo);
+ PackageManagerInternal packageManagerInternal =
+ LocalServices.getService(PackageManagerInternal.class);
+ ITelecomService telecomService = telecomLoader.createTelecomService(mServiceRepo,
+ packageManagerInternal.getSystemUiServiceComponent().getPackageName());
SmsApplication.getDefaultMmsApplication(mContext, false);
ServiceManager.addService(Context.TELECOM_SERVICE, telecomService.asBinder());
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index d89c9c16eb09..7082f0028a5e 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2049,11 +2049,15 @@ public class TelecomManager {
/**
* Ends the foreground call on the device.
* <p>
- * If there is a ringing call, calling this method rejects the ringing call. Otherwise the
+ * If there is a ringing call, calling this method rejects the ringing call. Otherwise, the
* foreground call is ended.
* <p>
* Note: this method CANNOT be used to end ongoing emergency calls and will return {@code false}
* if an attempt is made to end an emergency call.
+ * <p>
+ * Note: If the foreground call on this device is self-managed, this method will only end
+ * the call if the caller of this method is privileged (i.e. system, shell, or root) or system
+ * UI.
*
* @return {@code true} if there is a call which will be rejected or terminated, {@code false}
* otherwise.
@@ -2082,6 +2086,9 @@ public class TelecomManager {
* the incoming call requests. This means, for example, that an incoming call requesting
* {@link VideoProfile#STATE_BIDIRECTIONAL} will be answered, accepting that state.
*
+ * If the ringing incoming call is self-managed, this method will only accept the call if the
+ * caller of this method is privileged (i.e. system, shell, or root) or system UI.
+ *
* @deprecated Companion apps for wearable devices should use the {@link InCallService} API
* instead.
*/
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomLoader.aidl b/telecomm/java/com/android/internal/telecom/ITelecomLoader.aidl
index eda0f5b24958..c4a3670e4f14 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomLoader.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomLoader.aidl
@@ -24,5 +24,5 @@ import com.android.internal.telecom.IInternalServiceRetriever;
* Allows the TelecomLoaderService to pass additional dependencies required for creation.
*/
interface ITelecomLoader {
- ITelecomService createTelecomService(IInternalServiceRetriever retriever);
+ ITelecomService createTelecomService(IInternalServiceRetriever retriever, String sysUiName);
}