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

Commit 16814cc6 authored by Sandeep Bandaru's avatar Sandeep Bandaru
Browse files

Propagate exceptions during binder calls to ODIMS

Change `shouldThrow` to `true` in calls to
`ensureRemoteInferenceServiceInitialized` and
`ensureRemoteIntelligenceServiceInitialized` to ensure that exceptions
encountered during the initialization of the remote services are
propagated to caller on the binder thread.

Bug: 438310988
Test: cts
Flag: EXEMPT bugfix
Change-Id: Iabeb71a4f72a3a39ccfd8771ae468aed12a9ab40
parent f0e9f95d
Loading
Loading
Loading
Loading
+4 −12
Original line number Original line Diff line number Diff line
@@ -60,18 +60,10 @@ public final class InferenceServiceExecutor
            });
            });
            return null;
            return null;
        }
        }
        if (!manager.ensureRemoteInferenceServiceInitialized(/* shouldThrow= */ false)) {

            Slog.w(OnDeviceIntelligenceManagerService.TAG, "Service not available");
        // Ensure the remote service is initialized.
            executeOnRemoteExecutor(() -> {
        manager.ensureRemoteInferenceServiceInitialized(/* shouldThrow= */ true);
                try {

                    mFailureConsumer.accept(FailureType.SERVICE_UNAVAILABLE);
                } catch (RemoteException e) {
                    Slog.e(OnDeviceIntelligenceManagerService.TAG,
                            "Failed to call service unavailable callback", e);
                }
            });
            return null;
        }
        AndroidFuture<?> future = manager.getRemoteInferenceService().postAsync(remoteCall::run);
        AndroidFuture<?> future = manager.getRemoteInferenceService().postAsync(remoteCall::run);
        future.whenComplete(
        future.whenComplete(
                (res, ex) -> {
                (res, ex) -> {
+4 −12
Original line number Original line Diff line number Diff line
@@ -60,18 +60,10 @@ public final class IntelligenceServiceExecutor
            });
            });
            return null;
            return null;
        }
        }
        if (!manager.ensureRemoteIntelligenceServiceInitialized(/* shouldThrow= */ false)) {

            Slog.w(OnDeviceIntelligenceManagerService.TAG, "Service not available");
        // Ensure the remote service is initialized.
            executeOnRemoteExecutor(() -> {
        manager.ensureRemoteIntelligenceServiceInitialized(/* shouldThrow= */ true);
                try {

                    mFailureConsumer.accept(FailureType.SERVICE_UNAVAILABLE);
                } catch (RemoteException e) {
                    Slog.e(OnDeviceIntelligenceManagerService.TAG,
                            "Failed to call service unavailable callback", e);
                }
            });
            return null;
        }
        AndroidFuture<?> future =
        AndroidFuture<?> future =
                manager.getRemoteOnDeviceIntelligenceService().postAsync(remoteCall::run);
                manager.getRemoteOnDeviceIntelligenceService().postAsync(remoteCall::run);
        future.whenComplete(
        future.whenComplete(