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

Commit 51b138a7 authored by MingWei Liao's avatar MingWei Liao Committed by Android (Google) Code Review
Browse files

Merge "Update documentation to discourage the usage of calling package info" into main

parents 216b37b7 99d7835b
Loading
Loading
Loading
Loading
+40 −31
Original line number Diff line number Diff line
@@ -106,7 +106,8 @@ public abstract class AppFunctionService extends Service {
                }
                SafeOneTimeExecuteAppFunctionCallback safeCallback =
                        new SafeOneTimeExecuteAppFunctionCallback(callback);
                context.getMainExecutor().execute(
                context.getMainExecutor()
                        .execute(
                                () -> {
                                    try {
                                        onExecuteFunction.perform(
@@ -124,16 +125,19 @@ public abstract class AppFunctionService extends Service {
                                                    }

                                                    @Override
                                            public void onError(AppFunctionException exception) {
                                                    public void onError(
                                                            AppFunctionException exception) {
                                                        safeCallback.onError(exception);
                                                    }
                                                });
                                    } catch (Exception ex) {
                                // Apps should handle exceptions. But if they don't, report the
                                        // Apps should handle exceptions. But if they don't, report
                                        // the
                                        // error on behalf of them.
                                        Log.w(TAG, "Uncaught exception in AppFunctionService", ex);
                                        safeCallback.onError(
                                        new AppFunctionException(toErrorCode(ex), ex.getMessage()));
                                                new AppFunctionException(
                                                        toErrorCode(ex), ex.getMessage()));
                                    }
                                });
            }
@@ -187,9 +191,14 @@ public abstract class AppFunctionService extends Service {
     * the execution of function if requested by the system.
     *
     * @param request The function execution request.
     * @param callingPackage The package name of the app that is requesting the execution.
     * @param callingPackage The package name of the app that is requesting the execution. It is
     *     strongly recommended that you do not alter your function’s behavior based on this value.
     *     Your function should behave consistently for all callers to ensure a predictable
     *     experience.
     * @param callingPackageSigningInfo The signing information of the app that is requesting the
     *     execution.
     *     execution. It is strongly recommended that you do not alter your function’s behavior
     *     based on this value. Your function should behave consistently for all callers to ensure a
     *     predictable experience.
     * @param cancellationSignal A signal to cancel the execution.
     * @param callback A callback to report back the result or error.
     */