From 5cbdda5f2767f7201ebb790f337603dcffb63b05 Mon Sep 17 00:00:00 2001 From: Utkarsh Nigam Date: Sun, 15 Sep 2024 22:10:24 +0000 Subject: 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 --- .../android/server/appfunctions/AppFunctionManagerServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services/appfunctions/java') 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( -- cgit v1.2.3-59-g8ed1b