- Added permission requirements for communicating with system enrollment app - Added priv-app permission build target 'com.example.android.voiceinteractor.xml' - Updated README usage directions - Added log messages when reading audio from AudioRecord - Changed AudioRecord read calls to request all of the desired data in a single .read() call - Refactor AudioRecord buffer settings to top of service files in Duration type - Compute bytesPerSecond based on EventPayload AudioFormat passed by SoundTrigger HAL - Fixed keyphrase used by VoiceInteractionService to "X Google" - Added trace events for tracking the time to read audio in VIS after a trusted onDetected() callback. Bug: 168305377 Test: manual Change-Id: I6c1db7f70ddd62d21c0bb7eba663fe9503d96ae3
setup:
- Set the KEYPHRASE constant in SampleVoiceInteractionService.java to something the device's default assistant supports.
- m -j SampleVoiceInteractor
- adb root; adb remount
- adb push development/samples/VoiceInteractionService/com.example.android.voiceinteractor.xml /system/etc/permissions/com.example.android.voiceinteractor.xml
- adb shell mkdir /system/priv-app/SampleVoiceInteractor
- adb push out/target/product/$TARGET_PRODUCT/system/priv-app/SampleVoiceInteractor/SampleVoiceInteractor.apk /system/priv-app/SampleVoiceInteractor/
- adb reboot
- Go to the sample app info/settings.
- Tap on Permissions and grant Mic access.
- Reboot.
- Set the "Digital assistant app" to "Sample Voice Interactor" in the Android settings
- Check for this in the logs to make sure it worked: com.example.android.voiceinteractor I/VIS: onAvailabilityChanged: 2
- If it didn't, check if the pregrant worked: adb shell dumpsys package com.example.android.voiceinteractor | grep CAPTURE_AUDIO_HOTWORD
Iterating:
- adb install like usual
- If syncing changes to the system image, either first copy the permissions file into out/target/product/system/etc/permissions/ or push it again after syncing. Sometimes you might need to uninstall the app (go to the sample app info/settings -> 3 dots menu -> uninstall updates).
to test:
- Say "1,2,Ok Poodle,3,4.."
- Check the logs for the app and wait till it finishes recording.
- Either check the logs for the sampled bytes to match, e.g. "sample=[95, 2, 97, ...]" should appear twice; or open the sample app activity and click the button to play back the recorded audio. Tap directRecord to simulate the non-DSP case (must be done after a dsp trigger since it reuses the previous data).
Debugging:
- Set DEBUG to true in AlwaysOnHotwordDetector
- uncomment LOG_NDEBUG lines at the top in AudioFlinger.cpp, Threads.cpp, Tracks.cpp, AudioPolicyInterfaceImpl.cpp, AudioPolicyService.cpp
- Use this logcat filter: com.example.android.voiceinteractor|AlwaysOnHotword|SoundTrigger|RecordingActivityMonitor|soundtrigger|AudioPolicyManager|AudioFlinger|AudioPolicyIntefaceImpl|AudioPolicyService|VIS|SHotwordDetectionSrvc|Hotword-AudioUtils