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
We also changed API from setHotwordDetectionServiceConfig
to updateState.
Bug: 182951186
CTS-Coverage-Bug: 183425641
Test: Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I29ed0736f9502d3ac5a29ea26a8386bce7113e54
The code to handle voice interaction sessions had two problems:
1. it was not handling correctly the case where
VoiceInteractionSessionConnection.showLocked was called before a session
started, without requiring any assist data (flags = 0).
Now, when the session is set in VoiceInteractionSessionConnection,
the pending `onHandleAssist` are called.
2. AssistState delivered with `onHandleAssist` had the wrong IBinder
inside ActivityId. it contained ActivityRecord.appToken, but to work
properly ActivityRecord.assistToken was required. Tests have been updated
to catch this (atest CtsVoiceInteractionTestCases).
Bug: 178020517
Test: atest CtsAssistTestCases
Test: atest CtsVoiceInteractionTestCases
Change-Id: Id10937f0655d6837ccb85250c369bdeccd261ed8
It will be more secure to use PersistableBundle
instead of Bundle for passing the configrations
data from VoiceInteractor to HotwordDetectionService.
Bug: 176938300
Test: Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I19a412cca5e2cd5f9f79a112a9d7da8fd3a00a38
This is simply passed through the system to the AlwaysOnHotwordDetector.
Bug: 182788844
Bug: 168305377
CTS-Coverage-Bug: 183425641
Test: builds
Change-Id: I2b7147b330051d870bfe970e9b5e16aaab52e9bc
With this change, even if clients are not requesting any assist
data (e.g. VoiceInteractionSession.showSession is called with 0
as flags), Activity's `onHandleAssist(AssistState)` is always
called with non-null ActivityId. If no other data were requested,
AssistContent, AssistData and AssistStructure inside
VoiceInteractionSession.AssistState are null.
The previous behaviour was that if no assistData were requested,
Activity's `onHandleAssist` would not have been called.
This new behaviour saves time to clients interested only in ActivityIds,
because no activities methods need to be called (to get AssistData and
AssistContent).
We are not adding a new flag "SHOW_WITH_ACTIVITY_ID" because this
ActivityId is always non-null in ActivityState, and it's cheap to get it.
Bug: 178020517
Test: atest CtsAssistTestCases
Test: atest CtsVoiceInteractionTestCases
Change-Id: Icb46a928c8508a4bd355622df78f9371c21fd0e6
We added a new permission "MANAGE_HOTWORD_DETECTION" to allow
the application that held this permission to be able to use
setHotwordDetectionServiceConfig functions.
In order to avoid the feature leakage, we submit the change
about Shell in internal branch.
Bug: 178346114
Test: atest CtsVoiceInteractionTestCases
Test: atest PermissionPolicyTest
Change-Id: I8829c3c389fb5fe4b06ffcf21870db50fa2ede4b
In this patch, we change the behavior to trigger the hotword
detection service when the interactor application calls the
new "createAlwaysOnHotwordDetector" function. The system will
also pass the read-only data(Ex : model data) back to hotword
detection service by using the share memory when the service
is initialized.
So the interactor application can use the new function with
share memory to pass the model data back to hotword detection
service.
Bug: 176938619
Test: atest CtsVoiceInteractionTestCases
Change-Id: I753988691725c9d962be25c92d60ec66a3812394
This way server has control over when to stop recording (in case clients
time out or don't start consuming bytes) AND it solves the attribution
problem (Voice Interaction Service would only get the capture session upon a positive
trigger, so would be "blamed" then).
Test: atest CtsVoiceInteractionTestCases
Bug: 168305377
Change-Id: If5bead87e88cfc9e31393029df5389afb6922183
When initializing or resetting the recognizer setting, the configured
package is preferred over other available recognizers.
Bug: 175480455
Test: manual - unset recognizer, reboot, and check the setting
Test: atest CtsAssistTestCases CtsVoiceInteractionTestCases \
CtsVoiceSettingsTestCases
Change-Id: I2fc225eba56bc787b267262d9917e718035c6047
Decoupling recognizer from assistant allows it to be provided by a
different package.
The recognizer is now set only on initializing the user or when
packages are modified.
There should be no change to how the assistant or interactor is set.
Bug: 167597525
Test: manual - set/unset assistant, reboot.
Test: atest CtsVoiceInteractionTestCases
Change-Id: I42bd1ab768070d444a1f6e3e78571cae8288a8ba
On package modification, set the recognizer independently of the
interactor.
This will allow keeping the default recognizer provider a different
package from the interactor.
There should be no change to how the interactor is set.
Bug: 167597525
Test: manual
Test: atest CtsVoiceInteractionTestCases
Change-Id: Ib24f077365cbb0850c61196c2825737db1c1c090
When initializing settings for a user, set the recognizer independently
of the interactor.
This will allow the default recognizer to be provided by a different
package from the interactor.
There should be no change to how the interactor is set.
Bug: 167597525
Test: manual
Test: atest CtsVoiceInteractionTestCases
Change-Id: I2da8f72c768b27df21534e265a3d1fb6919c7140