summaryrefslogtreecommitdiff
path: root/services/voiceinteraction
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-12-22Merge s-mpr-2021-12-05Eric Arseneau
Change-Id: Ic2889f5eb531008340529eadc36ec8efc62b1984
2021-10-05Merge SP1A.210812.016Haamed Gheibi
Change-Id: Id27ea30be4f20be6f5d7d6336c8f53d2644c8e25
2021-09-27Set interaction boost for voice sessions.Joanne Chung
Bug: 198415915 Test: atest CtsVoiceInteractionTestCases Change-Id: I8fde3c1ced5a99e98c037a32d97f41835e572a9b
2021-09-07Remove the isBound() check for HotwordDetectionService.lpeter
There will be a race condition (Ex:Create AlwaysOnHotwordDetector twice quickly) where it will miss unbinding HotwordDetectionService and clearing HotwordDetectionServiceProvider when using the isBound() check for HotwordDetectionService. Because we use "ServiceConnector.Impl" to create the connection, it is unnecessary to use isBound() function to check if the HotwordDetectionService should be unbound. Bug: 195457729 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Test: manual - DSP and non-DSP Change-Id: Ib74e0dc9364af3713007b115f7d170bf6e833810
2021-08-20RESTRICT AUTOMERGE Disable the Trusted Hotword requirementAhaan Ugale
The requirement to use a sandboxed HotwordDetectionService to avoid incurring the mic indicator will be added back in a future release. With this change, SoundTrigger events and hotword-source audio do not incur the mid indicator for any process. This change adds back the permissions logic from I3275647d0f9a6e3ce8b97a556f56723b49170c8e, adjusted to account for the changes from I4fc3b3e8defed59a900fd156273e9e695a322b0c (preflight permission checks were made to accept soft denials, so simply reusing enforcePermissionForPreflight does not work anymore - it would pop up a dialog if the mic sensor is muted). We preserve the behavior of showing the indicator when the detected event is delivered from the Trusted Hotword process (no false-positives here, so we can accurately show it). Fix: 197034852 Test: manual - dsp and non-dsp; true and false positives; mute mic sensor - events aren't delivered and no dialog is shown, hotword still works after unmuting; mute mic and restart, unmute after starting reco; Trusted and non-Trusted hotwording Test: atest CameraMicIndicatorsPermissionTest Test: atest HotwordDetectionServiceBasicTest Test: atest android.cts.statsdatom.appops.AppOpsTests#testAppOps Change-Id: I68f2f37b5ce835e7fd8649b382eaee9fc299ec79 (cherry picked from commit 0e7131f3090fc0b7b8c040d09de4d5d4d62c0d19)
2021-08-18RESTRICT AUTOMERGE Disable the Trusted Hotword requirementAhaan Ugale
The requirement to use a sandboxed HotwordDetectionService to avoid incurring the mic indicator will be added back in a future release. With this change, SoundTrigger events and hotword-source audio do not incur the mid indicator for any process. This change adds back the permissions logic from I3275647d0f9a6e3ce8b97a556f56723b49170c8e, adjusted to account for the changes from I4fc3b3e8defed59a900fd156273e9e695a322b0c (preflight permission checks were made to accept soft denials, so simply reusing enforcePermissionForPreflight does not work anymore - it would pop up a dialog if the mic sensor is muted). We preserve the behavior of showing the indicator when the detected event is delivered from the Trusted Hotword process (no false-positives here, so we can accurately show it). Fix: 197034852 Test: manual - dsp and non-dsp; true and false positives; mute mic sensor - events aren't delivered and no dialog is shown, hotword still works after unmuting; mute mic and restart, unmute after starting reco; Trusted and non-Trusted hotwording Test: atest CameraMicIndicatorsPermissionTest Test: atest HotwordDetectionServiceBasicTest Test: atest android.cts.statsdatom.appops.AppOpsTests#testAppOps Change-Id: I68f2f37b5ce835e7fd8649b382eaee9fc299ec79
2021-08-11Merge SP1A.210811.001Brian Orr
Change-Id: I5aa7cf27a3a3cc16830c9947a826e30a0da481c4
2021-08-06Merge "Make Trusted Hotword session permissions follow previous behavior" ↵Ahaan Ugale
into sc-dev
2021-08-06Merge SP1A.210803.001Scott Lobdell
Change-Id: I09253f8614e9ee85a59460f3ef25f17dd98cac80
2021-08-06Make Trusted Hotword session permissions follow previous behaviorAhaan Ugale
A prior change to the permissions flow for Trusted Hotword (I80dabaf6ae0e781028dde16ead3321fbff319542) made the system enforce the required permissions on the APIs the conventional way - by throwing a SecurityException. But the existing behavior was to silence these exceptions and instead return error results. This change brings back the old behavior which exists in the SoundTrigger layer. Also removes permissions checks for a couple of APIs to again be consistent with the old behavior (and the current behavior in the SoundTrigger layer). Fix: 193116894 Test: manual - remove permission and reboot / remove permission after boot, stop/start reco Test: atest HotwordDetectionServiceBasicTest Change-Id: I56391260fd4375a04233eb3261bacec8696bda99
2021-08-04Send the HotwordDetectionService UID to AudioPolicyAhaan Ugale
This change follows the pattern of how the IME UID is set. The UID is stored in AudioService and re-sent there if the audio server dies. Fix: 194368677 Test: manual - hotword works when another app is using the mic and in Auto projection mode; also after restarting the process or killing audio server Test: atest HotwordDetectionServiceBasicTest Change-Id: I325cb33d17387e62302967b261b6fe61086d8893
2021-08-03Bug fix: fix System crash due to NullPointerException.Joanne Chung
If the voice interaction doesn't set RecognitionService, it may cause NPE when it tries to get recognizer name. We don't need recognizer name since Android 12, we delete it directly. To avoid the app does not set RecognitionService then updating the app to earlier platform that may cause boot loop. We add a warning log and set empty service for voiceinteraction to let app aware the problem. Also logging and unset the voiceinteraction service if the app try to update the app without recognition service. Bug: 170742278 Test: Use sample VoiceInteractionService without a RecognitionService The system doesn't crash when choosing the sample app as the default assistant app from Settings. And make sure the VoiceInteractionService is unset. Test: Install sample VoiceInteractionService with a RecognitionService and then update it without a RecognitionService. Make sure the voice interaction service is unset. Change-Id: I79ab3d6449984ead0be28a94adaad57ab24d1fb9
2021-07-29Hotword: Treat preflight soft denial as granted.Ahaan Ugale
In preflight we should accept soft denials as they can become grants at the time of delivery. Realigns permissions code in VoiceInteraction with that in SoundTrigger, which was fixed in I4fc3b3e8defed59a900fd156273e9e695a322b0c. Fix: 194137739 Test: manual - no errors for starting recognition when mic access is blocked. data delivery is still blocked Test: atest HotwordDetectionServiceBasicTest Change-Id: I49d504a30b4d04f157990580838757a3f17861cc
2021-07-27Merge SP1A.210723.002Scott Lobdell
Change-Id: I220cdfc5cb9db40162fd33f400a54591018d54cf
2021-07-24Provide the way to enable/disable debug mode for logging egressed datalpeter
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
2021-07-23Merge SP1A.210715.002Scott Lobdell
Change-Id: I65e2b7db097927b87c9c4023015c754033c62086
2021-07-23Set the Debug flag to falselpeter
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
2021-07-23Add null pointer check for callback in HotwordDetectionConnection.lpeter
Bug: 194090728 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Change-Id: I5b9f8320ddbcfc947f9a0b810b6f71c8a4fc9ff4
2021-07-16Reset HotwordDetectionConnection when VoiceInteractionService crasheslpeter
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
2021-07-14Merge SP1A.210709.002Haamed Gheibi
Change-Id: I4610885d5d770d858895057cdd9fea387a5e33dd
2021-07-12Check/note ops when delivering HotwordDetectedResultAhaan Ugale
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
2021-07-09Merge SP1A.210624.001Scott Lobdell
Change-Id: I96a39cdca22771b76e89caebd53ed52416005092
2021-07-03Merge "Re-init HotwordDetectionSrvc when audioserver dies" into sc-devAhaan Ugale
2021-07-02Re-init HotwordDetectionSrvc when audioserver diesAhaan Ugale
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
2021-07-03Merge "Init HotwordDetectionSrvc identity earlier" into sc-devTreeHugger Robot
2021-07-02Init HotwordDetectionSrvc identity earlierAhaan Ugale
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
2021-07-02Merge "Logging the number of bits egressing from the hotword trusted ↵TreeHugger Robot
process" into sc-dev
2021-07-02Logging the number of bits egressing from the hotword trusted processlpeter
Bug: 192331590 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Change-Id: I08329643d94655f762787a7a49567e19bbbfbe9c
2021-06-30Merge "HotwordDetectionSrvc: Handle SoundTrigger permissions in VIMS" into ↵Ahaan Ugale
sc-dev
2021-06-29HotwordDetectionSrvc: Handle SoundTrigger permissions in VIMSAhaan Ugale
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
2021-06-23Merge SP1A.210618.002Scott Lobdell
Change-Id: I72d03812a8377fc014aebad8db4e68eeded2d531
2021-06-23Fix permission checking in SoundTriggerServiceYtai Ben-Tsvi
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
2021-06-22Merge "Implement preriodic trusted process restarting for hotword ↵Sergey Volnov
detectors." into sc-dev
2021-06-22Implement preriodic trusted process restarting for hotword detectors.Sergey Volnov
Bug: 188892570 Test: 1) adb shell cmd voiceinteraction restart-detection 2) Tried locally with restarting every 30 seconds, verified everything works 3) adb shell ps | grep <test_package_name> - shows: u0_a221 3328 1026 14501612 69208 0 0 R com.google.th u0_i9002 9049 1026 14448104 53860 0 0 S com.google.th:com.google.th.SampleHotwordDetectionService:hotword_detector_3 Change-Id: I9f08943212c20b83da35c18df56460eaedbbf8f0
2021-06-21Merge SP1A.210616.001Daniel Norman
Change-Id: I9acdc955f698dbebb8fad19cfd5cb71fcdd27b45
2021-06-17Merge SP1A.210604.001Brian Orr
Change-Id: I5200ee05285ae422d5e9c1c00f45709a5d6188be
2021-06-15Merge "Improved implementation of ↵TreeHugger Robot
VoiceInteractionManagerService.setDisabled()" into sc-dev
2021-06-15Improved implementation of VoiceInteractionManagerService.setDisabled()Felipe Leme
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
2021-06-14Merge "Allow HotwordDetectionService access to audioflinger." into sc-devAhaan Ugale
2021-06-10Merge "Grant HotwordDetectionService RECORD_AUDIO and ↵Ahaan Ugale
CAPTURE_AUDIO_HOTWORD." into sc-dev
2021-06-09Merge "Hotword: Propagate the DSP DetectedResult." into sc-devTreeHugger Robot
2021-06-08Hotword: Propagate the DSP DetectedResult.Ahaan Ugale
Fix: 190572818 Test: atest CtsVoiceInteractionTestCases Change-Id: I8a109f6540cf8c342b827464ccc2beabd99d1b9c
2021-06-08Grant HotwordDetectionService RECORD_AUDIO and CAPTURE_AUDIO_HOTWORD.Ahaan Ugale
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
2021-06-08Called onError() when HotwordDetectionService process diedlpeter
Bug: 189887779 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Change-Id: I98659f4c4553b6c9da31829016419871756d34c9
2021-06-04Allow HotwordDetectionService access to audioflinger.Ahaan Ugale
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
2021-05-25Hotword: Add onStopDetection() for software detectors.Ahaan Ugale
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
2021-05-25Merge "Check "BIND_HOTWORD_DETECTION_SERVICE" permission before binding ↵TreeHugger Robot
HotwordDetectionService" into sc-dev
2021-05-21Check "BIND_HOTWORD_DETECTION_SERVICE" permission before binding ↵lpeter
HotwordDetectionService Bug: 187914415 Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionTestCases --instant Change-Id: I4ccd8fd5b153f28fa4b1463f7412bb8067cc4ffd
2021-05-21Merge SP1A.210513.004Chris Gross
Change-Id: Ic23aece12c3bbd2b4dcf3205fdbcdd1601deabec