Commit Graph

384 Commits

Author SHA1 Message Date
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
Ahaan Ugale
4b3f4355cc Merge "Unset default reco if selectableAsDefault=false." into sc-dev am: 5395b1a47f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13963741

Change-Id: I5299a3b2a59c12f041d4bfd99610a712ab943713
2021-03-26 19:59:34 +00:00
Ahaan Ugale
5395b1a47f Merge "Unset default reco if selectableAsDefault=false." into sc-dev 2021-03-26 19:27:58 +00:00
Sergey Volnov
06cff513a1 Merge "Introduce the concept of software and external hotword." into sc-dev am: 86d7e7d2e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13727287

Change-Id: I45cd1c6be4d6cc14eb52681fdf4f8367d52af031
2021-03-26 13:08:11 +00:00
Sergey Volnov
baceb11e71 Introduce the concept of software and external hotword.
Follow-up: implement circular buffer and integrate with the flows.

Bug: 182788844
Bug: 168305377
CTS-Coverage-Bug: 183425641
Test: atest CtsVoiceInteractionTestCases
Change-Id: I654a06afb27bb961bfb547a6636e08eb72a031fc
2021-03-26 00:10:44 -07:00
TreeHugger Robot
e168d1fc6f Merge "Unhide api for setHotwordDetectionServiceConfig" into sc-dev am: d5dc9e47a4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13958483

Change-Id: Ia43f1abad77acf88cff962cf66844985381f9fe0
2021-03-25 04:26:27 +00:00
TreeHugger Robot
d5dc9e47a4 Merge "Unhide api for setHotwordDetectionServiceConfig" into sc-dev 2021-03-25 03:49:32 +00:00
Ahaan Ugale
50261c6ae9 Unset default reco if selectableAsDefault=false.
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
2021-03-25 03:05:28 +00:00
Nicolò Mazzucato
1b9a60f226 Merge "Fix onHandleAssist behaviour when showSession is called with flags = 0" into sc-dev am: 745af612b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13931237

Change-Id: I32b0c23b4f62504ac15b3422bd0f8c86f380a430
2021-03-24 10:28:07 +00:00
Nicolò Mazzucato
745af612b6 Merge "Fix onHandleAssist behaviour when showSession is called with flags = 0" into sc-dev 2021-03-24 10:11:30 +00:00
lpeter
247d69aa7e Unhide api for setHotwordDetectionServiceConfig
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
2021-03-24 16:34:44 +08:00
Ahaan Ugale
47a6757c33 Merge "Allow HotwordDetectionService to return HotwordRejectedResult." into sc-dev am: 8f02ccf5dc
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13955919

Change-Id: Ibe6c653cc4e103942b870cb2b3bea7dd61eee99c
2021-03-24 01:19:36 +00:00
TreeHugger Robot
ecd46961ba Merge "Use the PersistableBundle instead of the Bundle" into sc-dev am: 20e5c931b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13917726

Change-Id: I20c50141818d4b32d001ba4fe16c209927eec542
2021-03-24 01:19:01 +00:00
Ahaan Ugale
8f02ccf5dc Merge "Allow HotwordDetectionService to return HotwordRejectedResult." into sc-dev 2021-03-23 21:58:59 +00:00
Nicolo' Mazzucato
d4e6ec0ea8 Fix onHandleAssist behaviour when showSession is called with flags = 0
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
2021-03-23 17:22:49 +00:00
lpeter
58f920e023 Use the PersistableBundle instead of the Bundle
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
2021-03-23 12:32:25 +08:00
Ahaan Ugale
8151b18c52 Allow HotwordDetectionService to return HotwordRejectedResult.
This is simply passed through the system to the AlwaysOnHotwordDetector.

Bug: 182788844
Bug: 168305377
CTS-Coverage-Bug: 183425641
Test: builds
Change-Id: I2b7147b330051d870bfe970e9b5e16aaab52e9bc
2021-03-22 13:48:23 -07:00
TreeHugger Robot
4c2e705bfd Merge "Validate HotwordDetectionService to be in the isolated process." into sc-dev am: f1ce6c68c9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13885355

Change-Id: I71cdfe1d66731121cfdff41516138b2fc3ef21a3
2021-03-22 13:19:46 +00:00
TreeHugger Robot
f1ce6c68c9 Merge "Validate HotwordDetectionService to be in the isolated process." into sc-dev 2021-03-22 07:03:44 +00:00
Nicolò Mazzucato
89ae2cd60b Merge "Always call onHandleAssist with AssistState containing at least activity id" into sc-dev am: 11bc52ed42
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13872931

Change-Id: Icba2342b5f3236f1c7ec5a04cc31b66583f87d34
2021-03-19 14:01:38 +00:00