Commit Graph

403 Commits

Author SHA1 Message Date
TreeHugger Robot
3e3e618310 Merge "Improved implementation of VoiceInteractionManagerService.setDisabled()" into sc-dev am: 50bbe88967 am: 8458a57ec6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14940217

Change-Id: I674ad35ba1e0b86d8cff12ee99260c9fefab858c
2021-06-15 22:10:51 +00:00
TreeHugger Robot
50bbe88967 Merge "Improved implementation of VoiceInteractionManagerService.setDisabled()" into sc-dev 2021-06-15 21:45:38 +00:00
Felipe Leme
07848e302b Improved implementation of VoiceInteractionManagerService.setDisabled()
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-15 11:31:36 -07:00
Ahaan Ugale
3fdfdaf765 Merge "Allow HotwordDetectionService access to audioflinger." into sc-dev am: a8a6a45f68 am: 42b7c85907
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14671365

Change-Id: I994da7b38be7af9f58bf07685adb0f60072d4bf8
2021-06-14 05:31:58 +00:00
Ahaan Ugale
a8a6a45f68 Merge "Allow HotwordDetectionService access to audioflinger." into sc-dev 2021-06-14 05:05:08 +00:00
Ahaan Ugale
23c84d2896 Merge "Grant HotwordDetectionService RECORD_AUDIO and CAPTURE_AUDIO_HOTWORD." into sc-dev am: 40069e8943 am: 1eea819631
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14427323

Change-Id: I23dbb652f411f736d8380ecbd95f148f36ec8e89
2021-06-10 18:22:37 +00:00
Ahaan Ugale
40069e8943 Merge "Grant HotwordDetectionService RECORD_AUDIO and CAPTURE_AUDIO_HOTWORD." into sc-dev 2021-06-10 17:53:56 +00:00
TreeHugger Robot
a68c88e681 Merge "Hotword: Propagate the DSP DetectedResult." into sc-dev am: dfbde545f3 am: accafd4628
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14427823

Change-Id: Icbd4f765b3030a5d832452dc9fadcff6413687b0
2021-06-09 23:03:54 +00:00
TreeHugger Robot
dfbde545f3 Merge "Hotword: Propagate the DSP DetectedResult." into sc-dev 2021-06-09 22:32:37 +00:00
TreeHugger Robot
c36d77961f Merge "Called onError() when HotwordDetectionService process died" into sc-dev am: 97be319829 am: cbdeae3a3e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14879196

Change-Id: Icca54c9a1a498dcf3d50c3f4d0b43104ac63f1a1
2021-06-09 11:56:59 +00:00
Ahaan Ugale
603ea83bd7 Hotword: Propagate the DSP DetectedResult.
Fix: 190572818
Test: atest CtsVoiceInteractionTestCases
Change-Id: I8a109f6540cf8c342b827464ccc2beabd99d1b9c
2021-06-08 23:33:47 -07:00
Ahaan Ugale
5fc6910227 Grant HotwordDetectionService RECORD_AUDIO and CAPTURE_AUDIO_HOTWORD.
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-08 14:26:04 -07:00
lpeter
568efb06b8 Called onError() when HotwordDetectionService process died
Bug: 189887779
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I98659f4c4553b6c9da31829016419871756d34c9
2021-06-08 23:27:09 +08:00
Ahaan Ugale
a64d628182 Allow HotwordDetectionService access to audioflinger.
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-06-04 07:20:27 +00:00
Sergey Volnov
fdd8f55445 Merge "Hotword: Add onStopDetection() for software detectors." into sc-dev am: 76660ef721 am: 20a30b3855 am: ac235e9a60
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14718524

Change-Id: I8d4a47536d42264f72854390c5d48f47964d97a8
2021-05-25 22:39:36 +00:00
Ahaan Ugale
31f241cc63 Hotword: Add onStopDetection() for software detectors.
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-25 18:59:29 +00:00
TreeHugger Robot
a189352b35 Merge "Check "BIND_HOTWORD_DETECTION_SERVICE" permission before binding HotwordDetectionService" into sc-dev am: 6572539f65 am: 09002c32f6 am: ee6e60c8fb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14540428

Change-Id: Ie669734fbf469eac199a3f0dd8e986a12276242a
2021-05-25 14:53:17 +00:00
TreeHugger Robot
6572539f65 Merge "Check "BIND_HOTWORD_DETECTION_SERVICE" permission before binding HotwordDetectionService" into sc-dev 2021-05-25 13:24:35 +00:00
lpeter
e66524d14f Check "BIND_HOTWORD_DETECTION_SERVICE" permission before binding HotwordDetectionService
Bug: 187914415
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I4ccd8fd5b153f28fa4b1463f7412bb8067cc4ffd
2021-05-21 10:49:56 +08:00
TreeHugger Robot
8af24bc17c Merge "Show sensor usage dialog for assistant" into sc-dev am: 49f6ccf69e am: bc1e5930ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14442497

Change-Id: Ib6df20c1711930e06e215e316303a49dfb86e743
2021-05-20 00:21:34 +00:00
Evan Severson
11b564feb1 Show sensor usage dialog for assistant
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
2021-05-18 14:02:04 -07:00
TreeHugger Robot
57b91178d0 Merge "API review : use a range of numbers for OEM errors" into sc-dev am: c0f1de7c5c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14501937

Change-Id: I983597134f7e278879f76a1cb9aa8c54757328ce
2021-05-13 18:20:58 +00:00
TreeHugger Robot
c0f1de7c5c Merge "API review : use a range of numbers for OEM errors" into sc-dev 2021-05-13 18:17:52 +00:00
Ahaan Ugale
f8bee18919 Merge "Nullability fixes for HotwordDetectionService APIs." into sc-dev am: f60fbc10b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14490409

Change-Id: I0d0dd72e485045f5d1c5c1580f62c679b895a722
2021-05-12 22:21:20 +00:00
Ahaan Ugale
d579a8ee6e Nullability fixes for HotwordDetectionService APIs.
* 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
2021-05-12 13:06:31 -07:00
lpeter
f79009a5d7 API review : use a range of numbers for OEM errors
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
2021-05-12 17:39:00 +08:00
TreeHugger Robot
acdad0cb36 Merge "Close audio source after getting callback from HotwordDetectionService" into sc-dev am: 8a66bf557f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14352464

Change-Id: If531151661cef96c5ac7e61d8e38cf2d74995d21
2021-05-05 10:18:44 +00:00
lpeter
044ca5adfa Close audio source after getting callback from HotwordDetectionService
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
2021-05-04 16:22:09 +08:00
Ahaan Ugale
485e6a9f6c Merge "Leverage new Audio history sharing for HotwordDetectionService." into sc-dev am: b8144d38cc
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14279958

Change-Id: I134a8b214ed5c55bac7d11b7ae5ef2a779a865f9
2021-04-26 15:30:45 +00:00
Ahaan Ugale
35f28d1bb2 Leverage new Audio history sharing for HotwordDetectionService.
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
2021-04-26 07:50:01 +00:00
TreeHugger Robot
dd100ed2b2 Merge "Add TestApi to trigger the onDetect function of HotwordDetectionService" into sc-dev am: 3346694817
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14161092

Change-Id: I41200d38286fde2633a9642004d451633f5f3a21
2021-04-20 09:32:06 +00:00
TreeHugger Robot
3346694817 Merge "Add TestApi to trigger the onDetect function of HotwordDetectionService" into sc-dev 2021-04-20 09:23:33 +00:00
TreeHugger Robot
472662de6c Merge "Allow HotwordDetectionService to obtain ContentCaptureManager." into sc-dev am: df8de5061e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14216285

Change-Id: I18bbfd60d60570a96d9672dfa830c6cea07efcc8
2021-04-19 18:44:58 +00:00
Sergey Volnov
f421bf17fc Allow HotwordDetectionService to obtain ContentCaptureManager.
This would allow pushing data into sandboxed ContentCaptureService.

Bug: 168305377
CTS-Coverage-Bug: 183425641
Test: atest CtsVoiceInteractionTestCases
Change-Id: I798b4f525a5707d4c97ae525ed69bd3864cb261d
2021-04-19 14:23:40 +01:00
lpeter
afef0beebf Add TestApi to trigger the onDetect function of HotwordDetectionService
Bug: 184685043
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I531c1229de908c64e29f1976bd2fd1e70e545853
2021-04-19 14:22:38 +08:00
TreeHugger Robot
c51615c719 Merge "Set correct audio source when creating mic audio record" into sc-dev am: a14d76517a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14174196

Change-Id: Ic7261dc5c312b501e50fae007701897f4fdb3d66
2021-04-15 07:37:00 +00:00
lpeter
f08559cf43 Set correct audio source when creating mic audio record
Bug: 185223459
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: Iad79066eb66ecb02497be926a467b3726e467a5c
2021-04-14 21:25:16 +08:00
Bhalchandra Gajare
c575e58bd5 Merge "AudioAttributes: update setHotwordMode to setHotwordModeEnabled" into sc-dev am: 65cadbe09f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14021880

Change-Id: I3cd68138858f7d500da9f29163e5ce311432b88b
2021-04-09 19:36:05 +00:00
Bhalchandra Gajare
ab5fedc682 AudioAttributes: update setHotwordMode to setHotwordModeEnabled
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
2021-04-09 02:29:42 -07:00
Peter Li
4f8c860ab8 Merge "Implement timeout mechanism when HotwordDetectionService initializes" into sc-dev am: 2fa9e7823e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14034628

Change-Id: I459ca02b36f6178f92dd591f4153a5ba39161de9
2021-04-09 05:10:50 +00:00
Peter Li
2fa9e7823e Merge "Implement timeout mechanism when HotwordDetectionService initializes" into sc-dev 2021-04-09 04:25:46 +00:00
Nicholas Ambur
257fffff06 Merge "rm permission from getActiveServiceComponentName" into sc-dev am: 6fb83178e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14105626

Change-Id: I85f0214ec9ceff0b6ed04826595c58f9e5877947
2021-04-07 20:05:50 +00:00
lpeter
9c9f5aa6a1 Implement timeout mechanism when HotwordDetectionService initializes
Bug: 183684347
Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I77d29491b055ee2a45aa088df4c1cd54e604c259
2021-04-07 12:23:42 +08:00
Nicholas Ambur
ff66bbffac rm permission from getActiveServiceComponentName
remove the ACCESS_VOICE_INTERACTION_SERVICE permission from
VoiceInteractionManagerService.getActiveServiceComponentName

Test: build and verify no stability impact
Bug: 173122149
Change-Id: I9e42b7b6e205ec352b3cfbac51022dd7594d1d0f
2021-04-06 13:14:42 -07:00
Ytai Ben-tsvi
f611d0a462 Merge "Reduce severity of SoundTriggerService error messages" into sc-dev am: 322aa5763b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14056378

Change-Id: Ib999f1ff8943394b7df160b7c759346ebe35b3de
2021-04-01 16:06:33 +00:00
Christian Frank
4548a03c0e Merge "Improve permission enforcement in SoundTriggerService" into sc-dev am: f07d729ccb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14055979

Change-Id: Id9befdc043bee50c281e65983f894dd8086064f1
2021-04-01 06:53:05 +00:00
Ytai Ben-Tsvi
60a49f1b3b Reduce severity of SoundTriggerService error messages
Errors resulting from misuse by the client are considered warnings.

Test: Compiles
Bug: 181269159
Change-Id: Ib81397706a137a41f12810b8b63548170ce855bc
2021-03-31 14:27:06 -07:00
Ytai Ben-Tsvi
def517ec04 Improve permission enforcement in SoundTriggerService
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
2021-03-31 14:24:54 -07:00
Peter Li
d3b9b7d0f5 Merge "Add callback to report HotwordDetectionService status" into sc-dev am: 378b540fa1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13974087

Change-Id: Idc441a5d54c25e58803bc4d8e609c57514a5416f
2021-03-29 12:04:21 +00:00
lpeter
6f2a263810 Add callback to report HotwordDetectionService status
Bug: 182788844
Test: Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionTestCases --instant
Change-Id: I12f0a265fc4fce0bbfe0983f39b4dcd947e3cf64
2021-03-29 17:41:24 +08:00