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

Commit 654a2f2a authored by Utkarsh Nigam's avatar Utkarsh Nigam
Browse files

Move onExecuteFunction call to main thread instead of Binder thread

Test: Existing tests
Bug: N/A
Flag: EXEMPT Trivial bugfix

Change-Id: Iaf7352e5e71e53f8523e0602d2ab20afc23bc1c1
parent 8ee1bab8
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()));
                            }
                        });
            }
        };
    }