summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Utkarsh Nigam <utkarshnigam@google.com> 2024-09-15 22:10:24 +0000
committer Utkarsh Nigam <utkarshnigam@google.com> 2024-09-16 09:56:37 +0000
commit5cbdda5f2767f7201ebb790f337603dcffb63b05 (patch)
tree70d4a144666d3a037d5fcff718f8594199206b9d
parentb46ac8c40f46895d011821474c9646050b1769eb (diff)
Unwrap CompletionException for AndroidFuture(s) before translating them to failure response(s).
Change-Id: I3b5157402df1271ad43f59fe13b097bf586c05cd Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest CtsAppFunctionTestCases Bug: 360864791
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
index 269419f70b2f..2362b91c826e 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
@@ -38,6 +38,7 @@ import com.android.server.appfunctions.RemoteServiceCaller.RunServiceCallCallbac
import com.android.server.appfunctions.RemoteServiceCaller.ServiceUsageCompleteListener;
import java.util.Objects;
+import java.util.concurrent.CompletionException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -255,6 +256,10 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub {
}
private ExecuteAppFunctionResponse mapExceptionToExecuteAppFunctionResponse(Throwable e) {
+ if(e instanceof CompletionException) {
+ e = e.getCause();
+ }
+
if (e instanceof AppSearchException) {
AppSearchException appSearchException = (AppSearchException) e;
return ExecuteAppFunctionResponse.newFailure(