From 67167c3b4524e709fda6baa67a98612a0f4d2cad Mon Sep 17 00:00:00 2001 From: Oluwarotimi Adesina Date: Wed, 30 Oct 2024 20:18:25 +0000 Subject: Split the isAppFunctionEnabled method into two overloads Flag: android.app.appfunctions.flags.enable_app_function_manager Test: CTS Bug: 376426049 Change-Id: I94c7a73983fea746dbf0815c77cc5e3705974c5d --- .../appfunctions/sidecar/AppFunctionManager.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libs/appfunctions/java') diff --git a/libs/appfunctions/java/com/google/android/appfunctions/sidecar/AppFunctionManager.java b/libs/appfunctions/java/com/google/android/appfunctions/sidecar/AppFunctionManager.java index 6870446fc3a0..2075104ff868 100644 --- a/libs/appfunctions/java/com/google/android/appfunctions/sidecar/AppFunctionManager.java +++ b/libs/appfunctions/java/com/google/android/appfunctions/sidecar/AppFunctionManager.java @@ -16,9 +16,11 @@ package com.google.android.appfunctions.sidecar; +import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; +import android.annotation.RequiresPermission; import android.annotation.SuppressLint; import android.annotation.UserHandleAware; import android.content.Context; @@ -103,6 +105,12 @@ public final class AppFunctionManager { *

See {@link android.app.appfunctions.AppFunctionManager#executeAppFunction} for the * documented behaviour of this method. */ + @RequiresPermission( + anyOf = { + Manifest.permission.EXECUTE_APP_FUNCTIONS_TRUSTED, + Manifest.permission.EXECUTE_APP_FUNCTIONS + }, + conditional = true) public void executeAppFunction( @NonNull ExecuteAppFunctionRequest sidecarRequest, @NonNull @CallbackExecutor Executor executor, @@ -131,6 +139,12 @@ public final class AppFunctionManager { *

See {@link android.app.appfunctions.AppFunctionManager#isAppFunctionEnabled} for the * documented behaviour of this method. */ + @RequiresPermission( + anyOf = { + Manifest.permission.EXECUTE_APP_FUNCTIONS_TRUSTED, + Manifest.permission.EXECUTE_APP_FUNCTIONS + }, + conditional = true) public void isAppFunctionEnabled( @NonNull String functionIdentifier, @NonNull String targetPackage, @@ -139,6 +153,19 @@ public final class AppFunctionManager { mManager.isAppFunctionEnabled(functionIdentifier, targetPackage, executor, callback); } + /** + * Returns a boolean through a callback, indicating whether the app function is enabled. + * + *

See {@link android.app.appfunctions.AppFunctionManager#isAppFunctionEnabled} for the + * documented behaviour of this method. + */ + public void isAppFunctionEnabled( + @NonNull String functionIdentifier, + @NonNull Executor executor, + @NonNull OutcomeReceiver callback) { + mManager.isAppFunctionEnabled(functionIdentifier, executor, callback); + } + /** * Sets the enabled state of the app function owned by the calling package. * -- cgit v1.2.3-59-g8ed1b