diff options
| -rw-r--r-- | core/java/android/app/appfunctions/AppFunctionManager.java | 8 | ||||
| -rw-r--r-- | core/java/android/app/appfunctions/IAppFunctionManager.aidl | 1 | ||||
| -rw-r--r-- | services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java | 23 | ||||
| -rw-r--r-- | services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java (renamed from core/java/android/app/appfunctions/ServiceCallHelper.java) | 4 | ||||
| -rw-r--r-- | services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java (renamed from core/java/android/app/appfunctions/ServiceCallHelperImpl.java) | 20 |
5 files changed, 28 insertions, 28 deletions
diff --git a/core/java/android/app/appfunctions/AppFunctionManager.java b/core/java/android/app/appfunctions/AppFunctionManager.java index 4b6f406ded9d..b6240a79dda8 100644 --- a/core/java/android/app/appfunctions/AppFunctionManager.java +++ b/core/java/android/app/appfunctions/AppFunctionManager.java @@ -54,9 +54,9 @@ public final class AppFunctionManager { * * @hide */ - public AppFunctionManager(IAppFunctionManager mService, Context context) { - this.mService = mService; - this.mContext = context; + public AppFunctionManager(IAppFunctionManager service, Context context) { + mService = service; + mContext = context; } /** @@ -114,7 +114,7 @@ public final class AppFunctionManager { } }); } catch (RemoteException e) { - e.rethrowFromSystemServer(); + throw e.rethrowFromSystemServer(); } } } diff --git a/core/java/android/app/appfunctions/IAppFunctionManager.aidl b/core/java/android/app/appfunctions/IAppFunctionManager.aidl index ef37095fbfa4..28827bb3052c 100644 --- a/core/java/android/app/appfunctions/IAppFunctionManager.aidl +++ b/core/java/android/app/appfunctions/IAppFunctionManager.aidl @@ -31,6 +31,7 @@ interface IAppFunctionManager { * @param request the request to execute an app function. * @param callback the callback to report the result. */ + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.EXECUTE_APP_FUNCTIONS_TRUSTED,android.Manifest.permission.EXECUTE_APP_FUNCTIONS}, conditional = true)") void executeAppFunction( in ExecuteAppFunctionAidlRequest request, in IExecuteAppFunctionCallback callback diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java index 191ec69b25c8..6b8e8c74a4e4 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java @@ -23,10 +23,6 @@ import android.app.appfunctions.IAppFunctionManager; import android.app.appfunctions.IAppFunctionService; import android.app.appfunctions.IExecuteAppFunctionCallback; import android.app.appfunctions.SafeOneTimeExecuteAppFunctionCallback; -import android.app.appfunctions.ServiceCallHelper; -import android.app.appfunctions.ServiceCallHelper.RunServiceCallCallback; -import android.app.appfunctions.ServiceCallHelper.ServiceUsageCompleteListener; -import android.app.appfunctions.ServiceCallHelperImpl; import android.content.Context; import android.content.Intent; import android.os.UserHandle; @@ -34,6 +30,8 @@ import android.text.TextUtils; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; +import com.android.server.appfunctions.RemoteServiceCaller.RunServiceCallCallback; +import com.android.server.appfunctions.RemoteServiceCaller.ServiceUsageCompleteListener; import java.util.Objects; import java.util.concurrent.LinkedBlockingQueue; @@ -45,12 +43,12 @@ import java.util.concurrent.TimeUnit; */ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { private static final String TAG = AppFunctionManagerServiceImpl.class.getSimpleName(); - private final ServiceCallHelper<IAppFunctionService> mExternalServiceCallHelper; + private final RemoteServiceCaller<IAppFunctionService> mRemoteServiceCaller; private final CallerValidator mCallerValidator; private final ServiceHelper mInternalServiceHelper; public AppFunctionManagerServiceImpl(@NonNull Context context) { - this(new ServiceCallHelperImpl<>( + this(new RemoteServiceCallerImpl<>( context, IAppFunctionService.Stub::asInterface, new ThreadPoolExecutor( /*corePoolSize=*/ Runtime.getRuntime().availableProcessors(), @@ -63,11 +61,11 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { } @VisibleForTesting - AppFunctionManagerServiceImpl(ServiceCallHelper<IAppFunctionService> serviceCallHelper, - CallerValidator apiValidator, + AppFunctionManagerServiceImpl(RemoteServiceCaller<IAppFunctionService> remoteServiceCaller, + CallerValidator callerValidator, ServiceHelper appFunctionInternalServiceHelper) { - mExternalServiceCallHelper = Objects.requireNonNull(serviceCallHelper); - mCallerValidator = Objects.requireNonNull(apiValidator); + mRemoteServiceCaller = Objects.requireNonNull(remoteServiceCaller); + mCallerValidator = Objects.requireNonNull(callerValidator); mInternalServiceHelper = Objects.requireNonNull(appFunctionInternalServiceHelper); } @@ -134,7 +132,6 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { return; } - // TODO(b/357551503): Offload call to async executor. bindAppFunctionServiceUnchecked(requestInternal, serviceIntent, targetUser, safeExecuteAppFunctionCallback, /*bindFlags=*/ Context.BIND_AUTO_CREATE, @@ -148,12 +145,12 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { @NonNull SafeOneTimeExecuteAppFunctionCallback safeExecuteAppFunctionCallback, int bindFlags, long timeoutInMillis) { - boolean bindServiceResult = mExternalServiceCallHelper.runServiceCall( + boolean bindServiceResult = mRemoteServiceCaller.runServiceCall( serviceIntent, bindFlags, timeoutInMillis, targetUser, - /*timeOutCallback=*/ new RunServiceCallCallback<IAppFunctionService>() { + new RunServiceCallCallback<IAppFunctionService>() { @Override public void onServiceConnected(@NonNull IAppFunctionService service, @NonNull ServiceUsageCompleteListener diff --git a/core/java/android/app/appfunctions/ServiceCallHelper.java b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java index cc882bd4ba4a..98903ae57a39 100644 --- a/core/java/android/app/appfunctions/ServiceCallHelper.java +++ b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCaller.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.app.appfunctions; +package com.android.server.appfunctions; import android.annotation.NonNull; import android.content.Intent; @@ -27,7 +27,7 @@ import android.os.UserHandle; * @param <T> Class of wrapped service. * @hide */ -public interface ServiceCallHelper<T> { +public interface RemoteServiceCaller<T> { /** * Initiates service binding and executes a provided method when the service connects. Unbinds diff --git a/core/java/android/app/appfunctions/ServiceCallHelperImpl.java b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java index 2e585467f437..c19a02792aec 100644 --- a/core/java/android/app/appfunctions/ServiceCallHelperImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/RemoteServiceCallerImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.app.appfunctions; +package com.android.server.appfunctions; import android.annotation.NonNull; import android.content.ComponentName; @@ -30,27 +30,29 @@ import java.util.concurrent.Executor; import java.util.function.Function; /** - * An implementation of {@link android.app.appfunctions.ServiceCallHelper} that that is based on + * An implementation of {@link RemoteServiceCaller} that that is based on * {@link Context#bindService}. * * @param <T> Class of wrapped service. * @hide */ -public class ServiceCallHelperImpl<T> implements ServiceCallHelper<T> { +public class RemoteServiceCallerImpl<T> implements RemoteServiceCaller<T> { private static final String TAG = "AppFunctionsServiceCall"; - @NonNull private final Context mContext; - @NonNull private final Function<IBinder, T> mInterfaceConverter; + @NonNull + private final Context mContext; + @NonNull + private final Function<IBinder, T> mInterfaceConverter; private final Handler mHandler = new Handler(Looper.getMainLooper()); private final Executor mExecutor; /** * @param interfaceConverter A function responsible for converting an IBinder object into the - * desired service interface. - * @param executor An Executor instance to dispatch callback. - * @param context The system context. + * desired service interface. + * @param executor An Executor instance to dispatch callback. + * @param context The system context. */ - public ServiceCallHelperImpl( + public RemoteServiceCallerImpl( @NonNull Context context, @NonNull Function<IBinder, T> interfaceConverter, @NonNull Executor executor) { |