Commit Graph

258 Commits

Author SHA1 Message Date
Ytai Ben-tsvi
49f7e6bfdf Merge "Correctly set the recognition state in response to GET_STATE" 2020-01-15 19:54:32 +00:00
Ytai Ben-Tsvi
8672d25e8a Correctly set the recognition state in response to GET_STATE
A forced recognition does not stop recognition.
SoundTriggerHelper had a bug where it assumed that it does, and so
future interactions would assume the wrong state and would eventually
erroneously use the underlying layers.

Bug: 147568295
Change-Id: I5ae69a8b292fda6aadc6011c4bf5cbc4d263a1ca
2020-01-14 16:54:15 -08:00
Nicholas Ambur
9e3ec9af07 Merge "add version entry to soundtrigger model database" 2020-01-14 00:47:20 +00:00
Nicholas Ambur
d3ec82fbc4 add version entry to soundtrigger model database
Bug:147159435
Test: manual hotword trigger with upgraded database
&& dumpsys voiceinteraction

Change-Id: I45497c1159fe879e1de119a18aac8f7ecc2b0686
2020-01-13 12:23:56 -08:00
Makoto Onuki
2b0a51b664 Merge "Clean up SystemService as a preparation to make @SystemApi" 2020-01-13 15:54:42 +00:00
Makoto Onuki
c8815900d2 Clean up SystemService as a preparation to make @SystemApi
Bug: 146145144
Test: Boot + treehugger
Test: atest CtsAutoFillServiceTestCases (with some unrelated failures)
Test: atest CtsContentCaptureServiceTestCases CtsVoiceInteractionTestCases (all passed)

Change-Id: I89265c3c46262cd3251153f85df6f4aea37520f1
2020-01-10 16:19:37 -08:00
Nicholas Ambur
f94db1c822 add parameter control to AlwaysOnHotwordDetector
Per-model control to AlwaysOnHotwordDetector interface.
Models are selected by keyphrase and locale associated with the
AlwaysOnHotwordDetector instance.

Bug: 141929369
Test: tested manually with test app
Change-Id: Iffeb0954059fa030d8a4fefb934a3e665323be37
2020-01-09 18:18:47 -08:00
Daulet Zhanguzin
e789eeee79 Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Change-Id: I902d340cf8025c560d3ae61223e8eba0c6bc5b30
2019-12-30 14:01:53 +00:00
Felipe Leme
e87735bdab Improved dump on services that implement isSupported(UserInfo).
Test: adb shell dumpsys voiceinteraction
Test: adb shell dumpsys autofill

Bug: 146349941

Change-Id: Ibc3001515081ba0efc72b3651f900a4e4f630faa
2019-12-17 13:26:48 -08:00
Nicholas Ambur
a0be6be387 add SoundTrigger HAL 2.3 per model parameter apis
add support for model parameter control APIs with THRESHOLD_FACTOR
as the first supported parameter

Bug: 141929369
Test: Tested manually with test app and confirmed with GTS test
gts-tradefed run gts-dev -m GtsAssistIntentTestCases
Change-Id: I06874fcf2ae2ef8796e7c52c4475252e8a026e2c
2019-12-11 19:16:48 -08:00
Eric Laurent
d4718e182d Merge "SoundTriggerHelper: fix state after audioserver death" into qt-qpr1-dev am: e5a3106cc5
am: e34b12d69b

Change-Id: Ie5d8451abfc732b45b9d803a6a901313479c0aa3
2019-09-19 12:03:09 -07:00
Eric Laurent
2fedc55920 SoundTriggerHelper: fix state after audioserver death
Make sure mRecognitionRequested is reset when a failure
condition disables all recognitions: A stale value would
prevent from registering call and power state listeners
and properly update the states.

Also:
- In isRecognitionAllowed(), read current call and power
states directly from services if listeners are not registered.
- Also add missing null checks on mModule at various places.

Bug: 139268184
Test: repro steps in the bug
Change-Id: I763130b4d491a1a6a9e0756c7a18943e406ce73e
2019-09-12 01:37:15 +00:00
Philip Cuadra
50dd58571f Merge "Bind voice interactor as top-app when it is being used" into qt-qpr1-dev am: 6183d81af6
am: 1c4b22d3cd

Change-Id: I88f95f30d8430ab9285c8d4a80a4cf8a7d6593bc
2019-09-05 13:44:32 -07:00
TreeHugger Robot
6183d81af6 Merge "Bind voice interactor as top-app when it is being used" into qt-qpr1-dev 2019-09-05 19:41:09 +00:00
TreeHugger Robot
d8c549a0e9 Merge "Add ability to get soundtrigger props from dsp" 2019-09-04 23:59:05 +00:00
Nicholas Ambur
1aa4b4b779 Add ability to get soundtrigger props from dsp
exposes sound trigger module properties to privileged
system apps with MANAGE_SOUND_TRIGGER permission

Bug: 139071862
Test: GTS test confirmed API accessible and providing valid data
Change-Id: Iec7ba6fc59912f44341fbe8d7f99193b9ead52f0
2019-08-30 10:10:18 -07:00
TreeHugger Robot
a68d535199 Merge "Defined a more generic way to let services "opt-out" from certain user types." 2019-08-22 20:59:41 +00:00
Hai Zhang
bfa2eb9a8d Merge "Fix legacy role holder resolution for assistant, dialer and SMS." into qt-qpr1-dev am: d4c175c156
am: 9d15770e4f

Change-Id: I59dedef6e000648c284190624fc938dd581a9743
2019-08-22 12:58:10 -07:00
Hai Zhang
dbffb693a5 Fix legacy role holder resolution for assistant, dialer and SMS.
The legacy settings for them can actually remain null and it was
handled specially to use the system default instead. If the legacy
role holders aren't resolved correctly, role implementation will do a
fallback grant which overrides permission state, whereas if they are
resolved correctly the normal fix up won't do an override.

Fixes: 139752137
Test: manual
Change-Id: I5cc301c3b7b459bdfaece0117bcacd984d1cb78f
2019-08-22 05:08:22 +00:00
Felipe Leme
501a514ba7 Defined a more generic way to let services "opt-out" from certain user types.
SystemService now defines a isSupported(UserInfo), which is used by SystemServiceManager to
skip the service for the unsupported types.

Also added a new argument to SystemService.onSwitch() to indicate which user is
being switched from.

Finally, also fixed VoiceInteractionManagerService so it doesn't start for headless user 0.

Test: manual verification
Test: atest CtsVoiceInteractionTestCases CtsAssistTestCases # on automotive and walleye

Bug: 133242016
Bug: 137878080

Change-Id: Ife4bd875f412f85cccf9c9fd03115abd238d7eab
2019-08-21 15:15:30 -07:00
Philip Cuadra
1e84d67493 Bind voice interactor as top-app when it is being used
When voice interactor is being used, it should run as the top app to
handle processing as quickly as possible.  This is similar to what IME
does when IME is shown.

Bug 139756725
Test: invoke assistant, confirm :interactor becomes top-app and then
goes back to foreground after use.

Change-Id: Id13b47dcb4de6658eede13a650e6ef631f649f4f
2019-08-21 17:06:43 +00:00
Felipe Leme
e5434c301b Initial implementation of system service optimizations for different type of users.
On R, we want to optimize boot time by not starting system services for some types of users,
like a headless system user (which is the case for Automotive)

As a "guinea pig", it optimizes VoiceInteractionService for headless system user, so the 3rd-party app
service is not bound for user 0 (and hence its process is not launched).

This change improves boot time on Automotive in about 100ms.

Test: atest CtsVoiceInteractionTestCases CtsAssistTestCases # on walleye and Automotive
Test: manual verification on logcat

Bug: 133242016
Fixes: 137878080

Change-Id: Ib0a902855e32691a1d00bfa77ee82c8e2430977c
2019-08-13 10:10:53 -07:00
Eric Laurent
6139a86809 Merge "SoundTriggerHelper: fix power save mode listener" into qt-r1-dev am: 8b3386567f
am: 72cd844e57

Change-Id: I53d7dbc8d28ba2362caab5bb11ebe9532be20044
2019-07-22 18:38:57 -07:00
Eric Laurent
80565fbf36 SoundTriggerHelper: fix power save mode listener
When stopping a recognition, do not unregister power save mode
listener if no recognition is active any more but only if no recognition
is requested. Otherwise recognitions suspended due to power save mode will
never resume.

Bug: 136978230
Test: Activate power save mode, plug USB and verify OK G works.
Change-Id: I426e11447fcde5c578ae2f64aa1fe18ef00fba0f
2019-07-19 12:06:24 -07:00
Todd Kennedy
583378df9c Move providers to permission manager
Bug: 135279435
Test: atest PermissionUpdateListenerTest
Test: atest android.content.pm.cts.PackageManagerTest
Test: atest android.permission2.cts.RestrictedPermissionsTest
Test: atest TeleServiceTests
Test: atest DataConnectionTest
Change-Id: Ife563589929b2662c60e1a0ab0ec8f6a2d7e4c12
2019-07-16 13:09:33 -07:00
Benjamin Schwartz
9e7a0158fc SoundTriggerService: Track model stats
Bug: 133868565
Test: adb bugreport
Test: In bugreport, check DUMPSYS - voiceinteraction
Change-Id: I09750de4b3de1088ac6fba5ad08f01a4b1249112
2019-06-11 13:20:41 -07:00
TreeHugger Robot
b13d88af52 Merge "Revert "Offload role manager work to background thread"" into qt-dev 2019-06-03 21:48:24 +00:00
Hai Zhang
c00c31e97e Revert "Offload role manager work to background thread"
This reverts commit f105c93c4a.

Reason for revert: b/132974796#23 the offloaded thread will be holding a lock for a noticeable period of time and cause contention.

Bug: 132974796
Change-Id: Ic81a2e3ee7226266c8f97b606fc1a2834240f689
2019-06-03 18:50:55 +00:00
Michael Dooley
58ac2ae2cb Merge "Limit GetModelState API to generic sound models (ie music detector)" into qt-dev 2019-05-24 05:37:10 +00:00
Felipe Leme
d9b98da38a Revert "Added a cmd to let system bind to a voice interaction service on instant apps."
This reverts commit d325d44435.

Test: atest CtsVoiceInteractionTestCases:LocalVoiceInteractionTest

Bug: 123604980
Change-Id: I1d7b492f277aac29cffa4dc1b13779a3e943db3f
2019-05-21 18:01:35 -07:00
Felipe Leme
d325d44435 Added a cmd to let system bind to a voice interaction service on instant apps.
Test: adb shell cmd voiceinteraction set bind-instant-service-allowed true
Test: atest CtsVoiceInteractionTestCases:LocalVoiceInteractionTest  --instant

Bug: 123604980

Change-Id: Iac7ccb4d6c36f9b0cc11f97aa4b711c73eeea083
2019-05-20 13:16:01 -07:00
mike dooley
baa22c7a8f Limit GetModelState API to generic sound models (ie music detector)
This limitation is being added to increase privacy protection.

Bug: 70619678
Bug: 117213117
Test: built android
Change-Id: Ic6ceed60a9687204fc7bf440becaa344a42d8e74
2019-05-17 07:26:11 +00:00
Winson Chung
f105c93c4a Offload role manager work to background thread
Bug: 130305914
Test: Manual
Change-Id: Ifbe25980aa5c91698556b6f0070b5fee06014f31
2019-05-14 16:23:50 -07:00
Felipe Leme
5d3d7a1415 Fixed index passed to handleAssist()
Test: atest CtsAssistTestCases

Fixes: 131386884

Change-Id: I447c2c89b71b6638316a3136ffa5d2204fc5b0cd
2019-05-08 17:11:01 -07:00
Jason CH Hsu
9741940810 Merge "SoundTrigger Event logging" into qt-dev 2019-04-30 02:34:25 +00:00
Svet Ganov
3b6be08c3d Address API council feedback
Make the get actions API async. Also fix a potenrial
memory leak when exchaning callbacks.

Test: atest CtsVoiceInteractionTestCases

bug:129705716

Change-Id: I91f1beb3dc7a395c6c6307ca4601fe7b7097f6e3
2019-04-28 23:01:30 -07:00
Jason Hsu
1363f581dc SoundTrigger Event logging
check bugreport DUMPSYS - voiceinteraction

BUG: 128965282
Test: manual
Change-Id: If2032e2cc5c0e071f9205e516987462625248b1c
Signed-off-by: Jason Hsu <jasonchhsu@google.com>
2019-04-29 12:14:41 +08:00
Sunny Goyal
d40c345536 [DO NOT MERGE] Adding API for defining and invoking DirectActions
DirectActions are abstract actions defined by an Activtiy. The
actual definition of these actions will be available through
the support lib.

This API provides a secure channel for system or assistant to
interact with a running app using these Actions.

Test: atest CtsVoiceInteractionTestCases
Test: added android.voiceinteraction.cts.DirectActionsTest

Bug: 129705716

Change-Id: I0ce568e0d8f41e0fe46306052016a74c7b394efa
2019-04-25 00:06:02 -07:00
TreeHugger Robot
56453ede41 Merge "Allow wallpapers and IMEs to get location if needed" into qt-dev 2019-04-09 19:31:45 +00:00
Amith Yamasani
c45a990330 Allow wallpapers and IMEs to get location if needed
Wallpapers and Input Methods are bound by the system
and are only brought up to BFGS, which is insufficient
for getting foreground location. Add the required
flag to the bindService call to allow the bound process
to reach FGSL when visible.

Same for VoiceInteractionServices

Bug: 117494189
Test: Manually enable a wallpaper that needs location and
     verify it gets location.
      atest CtsAppTestCases:ActivityManagerProcessStateTest

Change-Id: I6767e1f480e5b3d6e33864dabd9cb167df4846f5
2019-04-08 17:18:21 -07:00
Winson Chung
28f5a88402 Ensure VoiceInteractionManagerService updates the assistant setting
- Trigger the role changed callback manually when initializing the
  voice interaction manager in case the role handler changed prior to
  registering the listener.  In addition, ensure that we query for all
  packages regardless of current locked state.

Bug: 130126913
Test: Wipe device, restart and ensure that the assistant setting is set
      (adb shell setting get secure assistant)

Change-Id: I170189d9fd5177108c62c486e93b35a3a32af48c
2019-04-08 23:33:34 +00:00
rago
f96269ab4d Enabling HW detection while phone ringing
Updated logic to allow HotWord detection while phone is ringing (still
not off-hook).

Test: Manual Testing
Bug: 124762676
Change-Id: Idce6d39a5589aee6d5baa4e5bcd8d98b3e13b239
2019-03-26 10:34:04 -07:00
Michal Karpinski
e069b0022f Add new BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS binding flag
and the mechanism to use it

Since both starts and bindings might be contributing to the service
being whitelisted, track the state in ServiceRecord and update
the parent process accordingly when changes happen.

While we're at it, add that flag for bindings to accessibility
services, voice interaction services and QSTiles.

Also, make the timeout constant configurable for start-based
whitelisting.

Bug: 124298522
Bug: 123495976 (accessibility services)
Bug: 123337181 (paying via NFC, like Google Pay)
Bug: 122887611 (binding to InCallService)
Bug: 127774234 (binding to QSTile)
Bug: 124288681 (binding to voice interaction services)
Test: atest WmTests:ActivityStarterTests
Test: atest AccessibilityServiceConnectionTest
Test: manual with:
1) notifications from calendar and dynamite to test service starts
whitelisting
2) enabling talkback and livetranscribe to test service bindings
whitelisting
3) adding the LastPass QSTile and clicking on it
Change-Id: I8b6f23f999683920411ca40ab5b25c688a4f7055
2019-03-13 11:29:12 +00:00
Hai Zhang
7f1b8f6cf6 Reset assistant role after package force stop.
Bug: 124450140
Test: manual
Change-Id: I6a29fe27f9b5f95c32d6171d0cca1fa700c07e4d
2019-03-08 16:44:27 -08:00
Saurabh Kumar
df83858652 Read the activity uid from the assist data bundle.
Test: manual
Bug: 122748143
Change-Id: I6984f36c52a41dfeaab431a038250cd632164759
2019-03-06 02:05:26 +00:00
James O'Leary
9c9dd98ee0 Encapsulate state & transcription in hints bundle
Continuation of ag/6226654; edits made per Svetoslav's last comments.

Bug: 122740752
Bug: 123080754
Test: blueline-userdebug build completes successfully.

Change-Id: I3e43137eb6e0d8cae77e14d331150d5a05ede07c
2019-02-14 15:24:08 +00:00
Hai Zhang
5cc4ae9538 Fix assistant role for multi-user.
We need to modify settings based on the user passed in.

Bug: 123527682
Test: manual
Change-Id: I998fa61aa4364a028117cd4bb787d934c60661a1
2019-02-08 11:42:34 -08:00
James O'Leary
596708b973 Only selected VoiceInteractionService can call methods
- Extract current code for checking caller into a private method
- Replace occurrences of that code with a call to the private method
- Add method call to setTranscription/clearTranscription/setVoiceState

Test: Verified Milford can't call setTranscription/clearTranscription
when it is no longer the active service.
Bug: b/123412646

Change-Id: I2c428c6c65b62f6a83264286df4f44fb5d1c249e
2019-02-01 02:21:58 -05:00
Philip P. Moltmann
a0f377fbe8 Merge "Set assistant as a role" 2019-01-24 20:51:41 +00:00
Michael Dooley
c89d8db61d Merge "Treat getModelState recognition events the same as regular recognition events." 2019-01-24 16:57:45 +00:00