238 Commits

Author SHA1 Message Date
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
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
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
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
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
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 f105c93c4aa6d1cbebe94c5c8d7d6297258f6fc9.

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 d325d44435dd58561c7008356c23057a7b61b17a.

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
mike dooley
9b20c1cda4 Treat getModelState recognition events the same as regular recognition
events.

This change should have been part of ag/5933708

Test: manual test with NowPlaying app on p19 device

Change-Id: I42ed7c17ebdd2cb75055122b8d45302e28c510b6
2019-01-24 08:17:13 +01:00
Philip P. Moltmann
5d894505f7 Set assistant as a role
- Register a role observer in VoiceInteractionManagerService. Once the
role is changes map the new role setting onto the old settings.
- As the assistant role is now always set, there is no need to have code
in AssistUtil for the case the assistant setting is not set
- Remove old config option for the default assistant. The default
assistant is not configured via the roles config

Bug: 110557011
Test: - Set, unset and swtiched assistant via the settings UI
        - for voice interaction service
	- for assist activity
      - Booted from freshly wiped device and saw assitant to be set to
        default
Change-Id: I8596f49c6f6496e8b70cf3236aaa7d7557443a93
2019-01-23 13:05:32 -08:00
Matt Casey
4cff16fda9 Voice state + transcription in VoiceInteractionSvc
Voice state as well as voice transcription can be provided by the
VoiceInteractionService. These get proxied to the AssistManager which
can update the system UI to reflect the state & transcription.

Test: TBD
Bug: 122740752
Bug: 123080754
Change-Id: I79cac1d89fe0123bf25a05d551cb4ef40ae1368e
2019-01-23 20:03:05 +00:00
Robin Lee
ba3af56aaa Let low-ram devices override voice recognisers on
The top-level framework overlay already says this should (by default) be
skipped if the device is low-ram (leaving the device able to turn it
back on again without committing to a specific voice recognizer at build
time):
  <feature name="android.software.voice_recognizers" notLowRam="true" />

The form factor-specific overlay for tablets does override this back to
a state where the feature is always enabled regardless of low-ram:
  <feature name="android.software.voice_recognizers" />

But this is probably a mistake as the code before this change ignored
the feature flag anyway in case of a low-ram device, using a hardcoded
check.

Lets Android TVs have voice recognisers working on all devices by
default without needing to set katniss' package as a force override.

Bug: 117630721
Test: flashall ; adb logcat | grep VoiceInteractionService
Change-Id: I7816bebbc363ae0751b097fe1b6cdc2a646b20e0
2019-01-15 08:53:48 +00:00
mike dooley
da48092c9b Make framework treat getModelState recognition events the same
as regular recogntion events

The application will differentiate between DSP and app triggered
regcognition events.

Test: manual test with STTA and NowPlaying app on p19

Bug: 119386757

Change-Id: I4a3eb4da6ee6be35084fec8aaa3c495423d74033
2019-01-08 10:58:23 +01:00
Michael Dooley
91a94d76bf Merge "Fixing getModelState event processing" 2018-12-21 07:05:01 +00:00
mike dooley
23c625677d Fixing getModelState event processing
Test: manual testing with SoundTriggerTestApp

Bug: 119386757

Change-Id: I2c2960d169b119cb35345315638eeae28460896c
2018-12-20 16:48:53 +01:00
Dianne Hackborn
3d7ab61b02 Fix issue #121104681: Force stopping AGSA causes system to revert to its default impl
If you have a legacy assist app (launched through ACTION_ASSIST, not
implementing a VoiceInteractionService) then we kept the Google app
as the current speech recognizer.  Thus if you force stopped the
Google app, we saw that as one of the active parts of the interactor
or recognizer and reset all of the state.

Now we handle the "only recognizer" case separately, only resettting
the recognizer state in that case.

Bug: 121104681
Test: manual
Change-Id: Icc007bdf2352548d58be997fae77d9e5aba842f3
2018-12-17 11:45:32 -08:00
mike dooley
b2ab04aefd Converting sound trigger v2.2 getModelState to be asynchronous
Test: built android with checkbuild flag

Change-Id: I4c6f2388c93b6e577113fc7f2cd19242628ee50f
Bug-Id: 70206501
2018-11-09 08:36:15 +01:00
Michael Dooley
291751e510 Revert "Revert "Adding getModelState API to sound trigger""
This reverts commit 81f71f1c27b7e877babe1f3293ac00256a66980c.

Reason for revert: rolling forward with fix

Change-Id: Ifc0c53581ac567cb968d91993f453220f8253aec
2018-10-23 07:44:51 +02:00
Michael Dooley
be93d52505 Revert "Revert "Revert "Adding getModelState API to sound trigger"""
This reverts commit 7999836ee3c0da85b3e8b55d0113d0b9796b3d21.

Reason for revert: broke build

Change-Id: Id02636908aed26ee0ed38042da1ace0125a6d417
2018-09-28 07:30:28 +00:00
Michael Dooley
7999836ee3 Revert "Revert "Adding getModelState API to sound trigger""
This reverts commit 81f71f1c27b7e877babe1f3293ac00256a66980c.

Reason for revert: undoing rollback

Change-Id: Ifddfd0c730f03e93788d662a392d538564ce210b
2018-09-21 12:13:01 +00:00
Yuzhou Jia
35339498ef Merge "Make Changes to VoiceInteraction API for supporting System checking an assistant voice action availability on AAE." 2018-09-20 01:02:44 +00:00
jiayuzhou
21a353b701 Make Changes to VoiceInteraction API for supporting System checking
an assistant voice action availability on AAE.

Test: build and test on AAE.
Bug: 110587280

Change-Id: If37036e0dbe021fee9c95caf7e450330ca24ae32
2018-09-19 10:21:59 -07:00
Michael Dooley
c106550132 Merge "Revert "Adding getModelState API to sound trigger"" 2018-09-14 16:21:17 +00:00
Michael Dooley
81f71f1c27 Revert "Adding getModelState API to sound trigger"
This reverts commit 4f809fe73ee94802ac473b87c0d47a7345244d5a.

Reason for revert: fix build breakage

Change-Id: I75a54189f96fc21f6cb12dd8a05e513b1bda027c
2018-09-14 16:09:18 +00:00
Michael Dooley
a707ba1cb0 Merge "Adding getModelState API to sound trigger" 2018-09-14 12:32:09 +00:00
Andreas Gampe
8ce7ed95a0 Frameworks: Annotate trivial @GuardedBy in services
Add @GuardedBy for simple functions that require locks and have a name in
one of the frameworks naming styles for locks ("^.*(Locked|LPw|LPr|L[a-zA-Z]|UL|AL|NL)$").

Derived by errorprone.

Bug: 73000847
Test: m
Change-Id: If70bb03313388af34d547efca20fb5115de95bf1
2018-09-05 17:02:08 -07:00
mike dooley
4f809fe73e Adding getModelState API to sound trigger
Test: built android
Bug-Id: 70206501
Change-Id: Ieb83a366d4ddd471186d5089efe0675ea6285454
2018-09-05 15:58:27 +02:00
Wale Ogunwale
6d50dcc8af Moved URI grants code out of ActivityManagerService to its own service (13/n)
Allows for other services like window manager to call uri grants without
holding AM service lock.

Bug: 80414790
Test: Existing tests pass.
Change-Id: Ie5b4ddb19a2cedff09332dbeb56bcd9292fd18ac
2018-07-23 16:37:46 -07:00