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

Commit b15402bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move onExecuteFunction call to main thread instead of Binder thread" into main

parents 331b0529 654a2f2a
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -103,15 +103,20 @@ public abstract class AppFunctionService extends Service {
                }
                SafeOneTimeExecuteAppFunctionCallback safeCallback =
                        new SafeOneTimeExecuteAppFunctionCallback(callback);
                context.getMainExecutor().execute(
                        () -> {
                            try {
                                onExecuteFunction.perform(
                                        request,
                                        callingPackage,
                                        callingPackageSigningInfo,
                                        buildCancellationSignal(cancellationCallback),
                            new OutcomeReceiver<>() {
                                        new OutcomeReceiver<
                                                ExecuteAppFunctionResponse,
                                                AppFunctionException>() {
                                            @Override
                                public void onResult(ExecuteAppFunctionResponse result) {
                                            public void onResult(
                                                    ExecuteAppFunctionResponse result) {
                                                safeCallback.onResult(result);
                                            }

@@ -121,11 +126,12 @@ public abstract class AppFunctionService extends Service {
                                            }
                                        });
                            } catch (Exception ex) {
                    // Apps should handle exceptions. But if they don't, report the error on
                    // behalf of them.
                                // Apps should handle exceptions. But if they don't, report the
                                // error on behalf of them.
                                safeCallback.onError(
                                        new AppFunctionException(toErrorCode(ex), ex.getMessage()));
                            }
                        });
            }
        };
    }