1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.service.voice; 18 19 import android.content.ContentCaptureOptions; 20 import android.hardware.soundtrigger.SoundTrigger; 21 import android.media.AudioFormat; 22 import android.os.IBinder; 23 import android.os.IRemoteCallback; 24 import android.os.ParcelFileDescriptor; 25 import android.os.PersistableBundle; 26 import android.os.SharedMemory; 27 import android.service.voice.IDetectorSessionStorageService; 28 import android.service.voice.IDetectorSessionVisualQueryDetectionCallback; 29 import android.service.voice.IDspHotwordDetectionCallback; 30 import android.view.contentcapture.IContentCaptureManager; 31 import android.speech.IRecognitionServiceManager; 32 33 /** 34 * Provide the interface to communicate with sandboxed detection service. 35 * 36 * @hide 37 */ 38 oneway interface ISandboxedDetectionService { detectFromDspSource( in SoundTrigger.KeyphraseRecognitionEvent event, in AudioFormat audioFormat, long timeoutMillis, in IDspHotwordDetectionCallback callback)39 void detectFromDspSource( 40 in SoundTrigger.KeyphraseRecognitionEvent event, 41 in AudioFormat audioFormat, 42 long timeoutMillis, 43 in IDspHotwordDetectionCallback callback); 44 detectFromMicrophoneSource( in ParcelFileDescriptor audioStream, int audioSource, in AudioFormat audioFormat, in PersistableBundle options, in IDspHotwordDetectionCallback callback)45 void detectFromMicrophoneSource( 46 in ParcelFileDescriptor audioStream, 47 int audioSource, 48 in AudioFormat audioFormat, 49 in PersistableBundle options, 50 in IDspHotwordDetectionCallback callback); 51 detectWithVisualSignals(in IDetectorSessionVisualQueryDetectionCallback callback)52 void detectWithVisualSignals(in IDetectorSessionVisualQueryDetectionCallback callback); 53 updateState( in PersistableBundle options, in SharedMemory sharedMemory, in IRemoteCallback callback)54 void updateState( 55 in PersistableBundle options, 56 in SharedMemory sharedMemory, 57 in IRemoteCallback callback); 58 updateAudioFlinger(in IBinder audioFlinger)59 void updateAudioFlinger(in IBinder audioFlinger); 60 updateContentCaptureManager( in IContentCaptureManager contentCaptureManager, in ContentCaptureOptions options)61 void updateContentCaptureManager( 62 in IContentCaptureManager contentCaptureManager, 63 in ContentCaptureOptions options); 64 updateRecognitionServiceManager( in IRecognitionServiceManager recognitionServiceManager)65 void updateRecognitionServiceManager( 66 in IRecognitionServiceManager recognitionServiceManager); 67 68 /** 69 * Simply requests the service to trigger the callback, so that the system can check its 70 * identity. 71 */ ping(in IRemoteCallback callback)72 void ping(in IRemoteCallback callback); 73 stopDetection()74 void stopDetection(); 75 76 /** 77 * Registers the interface stub to talk to the voice interaction service for initialization/ 78 * detection unrelated functionalities. 79 */ registerRemoteStorageService(in IDetectorSessionStorageService detectorSessionStorageService)80 void registerRemoteStorageService(in IDetectorSessionStorageService detectorSessionStorageService); 81 } 82