Loading core/java/android/service/voice/VisualQueryDetector.java +10 −3 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -456,7 +463,7 @@ public class VisualQueryDetector { Slog.v(TAG, "BinderCallback#onResultDetected"); Binder.withCleanCallingIdentity(() -> { synchronized (mLock) { mCallback.onQueryDetected(partialResult); mExecutor.execute(()->mCallback.onQueryDetected(partialResult)); } }); } Loading core/java/android/service/voice/VoiceInteractionService.java +4 −1 Original line number Diff line number Diff line Loading @@ -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. Loading Loading
core/java/android/service/voice/VisualQueryDetector.java +10 −3 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -456,7 +463,7 @@ public class VisualQueryDetector { Slog.v(TAG, "BinderCallback#onResultDetected"); Binder.withCleanCallingIdentity(() -> { synchronized (mLock) { mCallback.onQueryDetected(partialResult); mExecutor.execute(()->mCallback.onQueryDetected(partialResult)); } }); } Loading
core/java/android/service/voice/VoiceInteractionService.java +4 −1 Original line number Diff line number Diff line Loading @@ -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. Loading