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

Commit 99d7835b authored by MingWei's avatar MingWei
Browse files

Update documentation to discourage the usage of calling package info

Bug: 418981293
Test: Existing tests
Flag: android.permission.flags.app_function_access_api_enabled
Change-Id: I8e77d845c1e1735ef9325aaac6338806ccdd74a0
parent d49873a5
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.
     */