From a54aa305c48a53ba7e747491e1d3a436db8537a1 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Fri, 7 Feb 2025 10:51:31 +0000 Subject: Handle function not found Exception Flag: android.app.appfunctions.flags.enable_app_function_manager Test: atest CtsAppFunctionTests Bug: 394571314 Change-Id: I9fef3f5cd20b49a687a1b35573c52da0fe43039c --- .../android/server/appfunctions/AppFunctionManagerServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (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 43764442e2cf..d0ee7af1bbfb 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java @@ -27,6 +27,7 @@ import android.annotation.WorkerThread; import android.app.appfunctions.AppFunctionException; import android.app.appfunctions.AppFunctionManager; import android.app.appfunctions.AppFunctionManagerHelper; +import android.app.appfunctions.AppFunctionManagerHelper.AppFunctionNotFoundException; import android.app.appfunctions.AppFunctionRuntimeMetadata; import android.app.appfunctions.AppFunctionStaticMetadataHelper; import android.app.appfunctions.ExecuteAppFunctionAidlRequest; @@ -513,7 +514,9 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { e = e.getCause(); } int resultCode = AppFunctionException.ERROR_SYSTEM_ERROR; - if (e instanceof AppSearchException appSearchException) { + if (e instanceof AppFunctionNotFoundException) { + resultCode = AppFunctionException.ERROR_FUNCTION_NOT_FOUND; + } else if (e instanceof AppSearchException appSearchException) { resultCode = mapAppSearchResultFailureCodeToExecuteAppFunctionResponse( appSearchException.getResultCode()); -- cgit v1.2.3-59-g8ed1b