Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cbdda5f authored by Utkarsh Nigam's avatar Utkarsh Nigam
Browse files

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
parent b46ac8c4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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(