Loading core/java/com/android/internal/app/AssistUtils.java +17 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,23 @@ public class AssistUtils { } } /** * Allows subscription to {@link android.service.voice.VisualQueryDetectionService} service * status. * * @param listener to receive visual service start/stop events. */ public void subscribeVisualQueryRecognitionStatus(IVisualQueryRecognitionStatusListener listener) { try { if (mVoiceInteractionManagerService != null) { mVoiceInteractionManagerService.subscribeVisualQueryRecognitionStatus(listener); } } catch (RemoteException e) { Log.w(TAG, "Failed to register visual query detection start listener", e); } } /** * Enables visual detection service. * Loading core/java/com/android/internal/app/IVisualQueryRecognitionStatusListener.aidl 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.app; oneway interface IVisualQueryRecognitionStatusListener { /** * Called when {@link VisualQueryDetectionService#onStartDetection} is scheduled from the system * server via {@link VoiceInteractionManagerService#StartPerceiving}. */ void onStartPerceiving(); /** * Called when {@link VisualQueryDetectionService#onStopDetection} is scheduled from the system * server via {@link VoiceInteractionManagerService#StopPerceiving}. */ void onStopPerceiving(); } No newline at end of file core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractionSoundTriggerSession; import com.android.internal.app.IVoiceInteractor; import com.android.internal.app.IVisualQueryDetectionAttentionListener; import com.android.internal.app.IVisualQueryRecognitionStatusListener; interface IVoiceInteractionManagerService { void showSession(in Bundle sessionArgs, int flags, String attributionTag); Loading Loading @@ -324,6 +325,9 @@ interface IVoiceInteractionManagerService { */ void shutdownHotwordDetectionService(); @EnforcePermission("ACCESS_VOICE_INTERACTION_SERVICE") void subscribeVisualQueryRecognitionStatus(in IVisualQueryRecognitionStatusListener listener); @EnforcePermission("ACCESS_VOICE_INTERACTION_SERVICE") void enableVisualQueryDetection(in IVisualQueryDetectionAttentionListener Listener); Loading services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −6 Original line number Diff line number Diff line Loading @@ -368,29 +368,29 @@ final class HotwordDetectionConnection { /** * This method is only used by VisualQueryDetector. */ void startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { boolean startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { if (DEBUG) { Slog.d(TAG, "startPerceivingLocked"); } final VisualQueryDetectorSession session = getVisualQueryDetectorSessionLocked(); if (session == null) { return; return false; } session.startPerceivingLocked(callback); return session.startPerceivingLocked(callback); } /** * This method is only used by VisaulQueryDetector. */ void stopPerceivingLocked() { boolean stopPerceivingLocked() { if (DEBUG) { Slog.d(TAG, "stopPerceivingLocked"); } final VisualQueryDetectorSession session = getVisualQueryDetectorSessionLocked(); if (session == null) { return; return false; } session.stopPerceivingLocked(); return session.stopPerceivingLocked(); } public void startListeningFromExternalSourceLocked( Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VisualQueryDetectorSession.java +5 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ final class VisualQueryDetectorSession extends DetectorSession { } @SuppressWarnings("GuardedBy") void startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { boolean startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { if (DEBUG) { Slog.d(TAG, "startPerceivingLocked"); } Loading Loading @@ -198,15 +198,16 @@ final class VisualQueryDetectorSession extends DetectorSession { mQueryStreaming = false; } }; mRemoteDetectionService.run(service -> service.detectWithVisualSignals(internalCallback)); return mRemoteDetectionService.run( service -> service.detectWithVisualSignals(internalCallback)); } @SuppressWarnings("GuardedBy") void stopPerceivingLocked() { boolean stopPerceivingLocked() { if (DEBUG) { Slog.d(TAG, "stopPerceivingLocked"); } mRemoteDetectionService.run(ISandboxedDetectionService::stopDetection); return mRemoteDetectionService.run(ISandboxedDetectionService::stopDetection); } @Override Loading Loading
core/java/com/android/internal/app/AssistUtils.java +17 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,23 @@ public class AssistUtils { } } /** * Allows subscription to {@link android.service.voice.VisualQueryDetectionService} service * status. * * @param listener to receive visual service start/stop events. */ public void subscribeVisualQueryRecognitionStatus(IVisualQueryRecognitionStatusListener listener) { try { if (mVoiceInteractionManagerService != null) { mVoiceInteractionManagerService.subscribeVisualQueryRecognitionStatus(listener); } } catch (RemoteException e) { Log.w(TAG, "Failed to register visual query detection start listener", e); } } /** * Enables visual detection service. * Loading
core/java/com/android/internal/app/IVisualQueryRecognitionStatusListener.aidl 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.app; oneway interface IVisualQueryRecognitionStatusListener { /** * Called when {@link VisualQueryDetectionService#onStartDetection} is scheduled from the system * server via {@link VoiceInteractionManagerService#StartPerceiving}. */ void onStartPerceiving(); /** * Called when {@link VisualQueryDetectionService#onStopDetection} is scheduled from the system * server via {@link VoiceInteractionManagerService#StopPerceiving}. */ void onStopPerceiving(); } No newline at end of file
core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractionSoundTriggerSession; import com.android.internal.app.IVoiceInteractor; import com.android.internal.app.IVisualQueryDetectionAttentionListener; import com.android.internal.app.IVisualQueryRecognitionStatusListener; interface IVoiceInteractionManagerService { void showSession(in Bundle sessionArgs, int flags, String attributionTag); Loading Loading @@ -324,6 +325,9 @@ interface IVoiceInteractionManagerService { */ void shutdownHotwordDetectionService(); @EnforcePermission("ACCESS_VOICE_INTERACTION_SERVICE") void subscribeVisualQueryRecognitionStatus(in IVisualQueryRecognitionStatusListener listener); @EnforcePermission("ACCESS_VOICE_INTERACTION_SERVICE") void enableVisualQueryDetection(in IVisualQueryDetectionAttentionListener Listener); Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −6 Original line number Diff line number Diff line Loading @@ -368,29 +368,29 @@ final class HotwordDetectionConnection { /** * This method is only used by VisualQueryDetector. */ void startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { boolean startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { if (DEBUG) { Slog.d(TAG, "startPerceivingLocked"); } final VisualQueryDetectorSession session = getVisualQueryDetectorSessionLocked(); if (session == null) { return; return false; } session.startPerceivingLocked(callback); return session.startPerceivingLocked(callback); } /** * This method is only used by VisaulQueryDetector. */ void stopPerceivingLocked() { boolean stopPerceivingLocked() { if (DEBUG) { Slog.d(TAG, "stopPerceivingLocked"); } final VisualQueryDetectorSession session = getVisualQueryDetectorSessionLocked(); if (session == null) { return; return false; } session.stopPerceivingLocked(); return session.stopPerceivingLocked(); } public void startListeningFromExternalSourceLocked( Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VisualQueryDetectorSession.java +5 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ final class VisualQueryDetectorSession extends DetectorSession { } @SuppressWarnings("GuardedBy") void startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { boolean startPerceivingLocked(IVisualQueryDetectionVoiceInteractionCallback callback) { if (DEBUG) { Slog.d(TAG, "startPerceivingLocked"); } Loading Loading @@ -198,15 +198,16 @@ final class VisualQueryDetectorSession extends DetectorSession { mQueryStreaming = false; } }; mRemoteDetectionService.run(service -> service.detectWithVisualSignals(internalCallback)); return mRemoteDetectionService.run( service -> service.detectWithVisualSignals(internalCallback)); } @SuppressWarnings("GuardedBy") void stopPerceivingLocked() { boolean stopPerceivingLocked() { if (DEBUG) { Slog.d(TAG, "stopPerceivingLocked"); } mRemoteDetectionService.run(ISandboxedDetectionService::stopDetection); return mRemoteDetectionService.run(ISandboxedDetectionService::stopDetection); } @Override Loading