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

Commit 1914e734 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Update javadoc for executor accepted for VQDS" into main

parents bca97813 361ac94d
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -301,8 +301,15 @@ public class VisualQueryDetector {
    }

    /**
     * A class that lets a VoiceInteractionService implementation interact with
     * visual query detection APIs.
     * A class that lets a VoiceInteractionService implementation interact with visual query
     * detection APIs.
     *
     * Note that methods in this callbacks are not thread-safe so the invocation of each
     * methods will have different order from how they are called in the
     * {@link VisualQueryDetectionService}. It is expected to pass a single thread executor or a
     * serial executor as the callback executor when creating the {@link VisualQueryDetector}
     * with {@link VoiceInteractionService#createVisualQueryDetector(
     * PersistableBundle, SharedMemory, Executor, Callback)}.
     */
    public interface Callback {

@@ -456,7 +463,7 @@ public class VisualQueryDetector {
            Slog.v(TAG, "BinderCallback#onResultDetected");
            Binder.withCleanCallingIdentity(() -> {
                synchronized (mLock) {
                    mCallback.onQueryDetected(partialResult);
                    mExecutor.execute(()->mCallback.onQueryDetected(partialResult));
                }
            });
        }
+4 −1
Original line number Diff line number Diff line
@@ -932,7 +932,10 @@ public class VoiceInteractionService extends Service {
     * @param sharedMemory The unrestricted data blob to be provided to the
     * {@link VisualQueryDetectionService}. Use this to provide models or other such data to the
     * sandboxed process.
     * @param callback The callback to notify of detection events.
     * @param callback The callback to notify of detection events. Single threaded or sequential
     *                 executors are recommended for the callback are not guaranteed to be executed
     *                 in the order of how they were called from the
     *                 {@link VisualQueryDetectionService}.
     * @return An instanece of {@link VisualQueryDetector}.
     * @throws IllegalStateException when there is an existing {@link VisualQueryDetector}, or when
     * there is a non-trusted hotword detector running.