From 67b293f4b5058aaed644c6d5bbb7c5296e2a2f21 Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Thu, 10 Oct 2024 15:35:04 +0000 Subject: Return early on "cannot execute function" Flag: android.app.appfunctions.flags.enable_app_function_manager Test: N/A Bug: 357551503 Change-Id: Iad317b19d17651088cb8215fbe1907a687b1b9f4 --- .../server/appfunctions/AppFunctionManagerServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (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 c5fef191c52c..5d574083b326 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java @@ -65,8 +65,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.infra.AndroidFuture; import com.android.internal.util.DumpUtils; import com.android.server.SystemService.TargetUser; -import com.android.server.appfunctions.RemoteServiceCaller.RunServiceCallCallback; -import com.android.server.appfunctions.RemoteServiceCaller.ServiceUsageCompleteListener; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -233,6 +231,9 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { "Caller does not have permission to execute the" + " appfunction", /* extras= */ null)); + throw new SecurityException( + "Caller does not have permission to execute the" + + " appfunction"); } }) .thenCompose( @@ -380,7 +381,8 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { runtimeMetadataSearchSession)); AppFunctionRuntimeMetadata newMetadata = new AppFunctionRuntimeMetadata.Builder(existingMetadata) - .setEnabled(enabledState).build(); + .setEnabled(enabledState) + .build(); AppSearchBatchResult putDocumentBatchResult = runtimeMetadataSearchSession .put( -- cgit v1.2.3-59-g8ed1b