Currently we provide the Shell command to enable/disable one debug mode
that we will log the HotwordDetectedResult and HotwordRejectedResult if
the debug mode is wnable. But we will reset the debug mode after one
hour from last enable.
Bug: 194339253
Test: Use the Shell command and check the log
Change-Id: I212ad58c7550b297babed50249a08db6f0e24b3a
Set the Debug flag to false, but we also reserve some logs
for clarifying the issue.
Bug: 177502877
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: Idf5dd82d8db27bb682b473eb4584e8b230073d08
I use the command "adb shell kill <pid>" and "adb shell am crash
<package>" to test, it works well.
Bug: 193421614
Test: manual test
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I53206f07801b0fac588cb23fa2b91cac561547ed
This is partially a followup of
I80dabaf6ae0e781028dde16ead3321fbff319542 which removed these operations
from the SoundTrigger layer when the HotwordDetectionService is used.
Also fixes a race condition where the DSP event can go directly to the
Interactor if the DetectionService isn't connected.
Bug: 186164881
Test: atest HotwordDetectionServiceBasicTest
Test: manual - DSP and non-DSP
Change-Id: Iee3b00c6c08597ad1993fae677e9f8ae2f60744c
We do this instead of simply sending over the new binder to avoid race
conditions with audio reading in the service.
Fix: 190011174
Test: manual - kill audio server, also do this twice in quick
succession; dsp and non-dsp
Test: atest CtsVoiceInteractionTestCases
Change-Id: Iabee9549512cc09d2305de5b0e965b9315134fb0
Grants mic access to the process as soon as it comes up, instead of
waiting for the initialization status callback.
Bug: 190011174
Test: manual - dsp and non-dsp; restarting while invoking the hotword
Test: atest CtsVoiceInteractionTestCases
Change-Id: I54e0b42868f663ae1c9edd9bcf4aaee2a13b827a
This allows properly checking/noting against the voice interactor or
HotwordDetectionService as needed. Otherwise,
SoundTriggerMiddlewarePermission notes ops for data delivery to the
interactor, even if the data only reaches the HotwordDetectionService.
This is accomplished with a decorator for permission checks, that wraps
the real implementation. A proxy that serves as the remote Binder object
is also needed, to allow this decoration pattern.
The list of sessions stored in VIMS is removed for simplicity. It
currently serves no purpose (used only in dump() but doesn't implement
it so it's a no-op there).
DataDelivery checks will be addressed in a followup change.
Bug: 186164881
Test: manual - permissions are checked appropriately
Test: atest CtsVoiceInteractionTestCases
Change-Id: I80dabaf6ae0e781028dde16ead3321fbff319542
Result of permission check was erroneously ignored instead of
throwing.
Fixes: 191597651
Test: Manual verification of basic soundtrigger flows (assistant, now
playing) against regression.
Requested reporter to repro bug.
Change-Id: I73449a156308880dae9ca5d432df3bc5ee747e58
This method is called by CarService when the system goes into suspend
state and the initial implementation completely disabled the service
(and unbound system server from it), which had 2 drawbacks:
- It adds extra work when the system resumes as it has to rebind.
- It can cause memory leaks if the service implementation doesn't
handle it well.
This CL changes how the API is implemented: rather than disabling the
service, it just ignores new sessions.
To test it:
1. Disable
$ adb shell cmd voiceinteraction disable true
2. Start a session
$ adb shell cmd voiceinteraction show
3. Check logcat
I VoiceInteractionManager: showSessionForActiveService(): ignored while temporarily disabled
Bug: 190051449
Test: manual verification (see above)
Change-Id: Idbc4881b92d9254fb07ea5af1370ea600fc10b80
HotwordDetectionService is an isolated service which ordinarily cannot
hold permissions. An isolated service has its own uid separate from the
owning package.
To allow it to access mic audio, we dynamically override the permissions
check based on the currently bound HotwordDetectionService.
Bug: 190011174
Test: manual - sample app can read audio (with a few other wip changes)
Test: atest CtsVoiceInteractionTestCases
Change-Id: I5abc809546184ef13cb9eb009f916afae6bdf1af
HotwordDetectionService is an isolated service which ordinarily cannot
access audioflinger due to selinux restrictions on isolated processes.
To bypass those restrictions, the audioflinger binder is passed from
the system server to the HotwordDetectionService. This follows the
existing pattern of providing access to the ContentCapture service.
In T we *may* instead solve this at the selinux layer. For now, this
simpler approach is used.
Bug: 190011174
Test: manual - sample app can read audio (with a few other wip changes)
Test: atest CtsVoiceInteractionTestCases
Change-Id: I5493a5c3addf68f2ae80d64b6971a8576484eb8e
For DSP-based detection, stopRecognition() disables detection at the
sound trigger layer. For software detection, the HotwordDetectionService
must be notified so it can stop detection.
Bug: 189236104
CTS-Coverage-Bug: 183425641
Test: atest CtsVoiceInteractionTestCases
Change-Id: I220d2255e5e500c22723f6e2fbc34860a529f216
The problem is that the assistant doesn't draw its own
UI in some cases so even though it's in the background the user
considers it as a foreground app. We can check if the app trying to
access the microphone currently has a voice interaction session which
should be a good indicator that the user intends to user the app.
Test: Use the assistant, observe dialog
Bug: 178243539
Change-Id: Ie17f6e47a002e75467cce23fd74f5fcbc92aa577
* Make the Hotword*Result payloads NonNull. HotwordDetectedResult on the
VoiceInteraction side is still @Nullable since the EventPayload is
used for other result types too.
* Remove @NonNull for a primitive return type.
Bug: 184962614
Test: atest CtsVoiceInteractionTestCases
Change-Id: Ib57368dab442f80805233864dc8fd86249f677cf
By API review feedback, it would be better to use a range
of numbers for OEM errors instead of just defining
CUSTOM_ERROR_1 / CUSTOM_ERROR_2 in HotwordDetectionService.
Bug: 184962614
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: Id1e3a29e37ef566a1d8e30c703b7f2c4ae138f82
Due to the file descriptor of audio source was closed before
the attempt to parcel the file descriptor when passing the
file descriptor to the HotwordDetectionService.
It will cause the exception below:
java.lang.RuntimeException: Bad file descriptor
It would be better to close audio source when getting
callback from HotwordDetectionService
Bug: 185569471
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I10774fd29d559b5d2bedc21b0ebb2ef849a1b7c6
The Audio Framework now supports sharing audio history, so
VoiceInteractionManagerService no longer needs to handle audio streams
itself.
See I5beba6c1e489148a14ba86165b8ef2fdc78c802a.
Bug: 168305377
Test: atest CtsVoiceInteractionTestCases
Test: manual
Change-Id: Ia7c5830aa5af6c015ae26619e0a90967ddff74e5
This would allow pushing data into sandboxed ContentCaptureService.
Bug: 168305377
CTS-Coverage-Bug: 183425641
Test: atest CtsVoiceInteractionTestCases
Change-Id: I798b4f525a5707d4c97ae525ed69bd3864cb261d
Update setHotwordMode to setHotwordModeEnabled and set/clear the hotword
mode based on the boolean flag passed to setHotwordModeEnabled. This is
to meet the API requirements. Also update the references to this API.
BUG: 180419637
Test: Able to setHotwordModeEnabled from AGSA application. Confirmed
HAL receives the flag and audioSource correctly in open_input_stream.
Change-Id: Ia01e8b5f3edaeafc9617846efc247635005456a8
remove the ACCESS_VOICE_INTERACTION_SERVICE permission from
VoiceInteractionManagerService.getActiveServiceComponentName
Test: build and verify no stability impact
Bug: 173122149
Change-Id: I9e42b7b6e205ec352b3cfbac51022dd7594d1d0f
Use a session-based identity mechanism similar to SoundTriggerMiddleware.
Clear identity context within service to allow internal calls to
originate from this service.
Fixes: 184021066
Test: Manual verification of OKG / Now Playing on Sargo
Change-Id: Iccda9ef864f82eafbf3473e706bcffe695705953
A non selectableAsDefault recognition service can still become the
default if no other services are available.
Bug: 180964085
Test: non selectableAsDefault reco is unset at boot and replaced
Test: selectableAsDefault recos aren't affected
Test: system default reco still works
Change-Id: I429e6e457bc81ef0642ca90ccd9eb47eb10fbab8