122 Commits

Author SHA1 Message Date
Svetoslav Ganov
b625e19a87 Properly set default voice interactor
We need to figure out the default voice interactor to give
it default permissions. This happens before the user has
been unlocked and if the voice interactor is not direct
boot aware we fail to find it, hence no permissions are
granted. Now we query the package manager for both direct
boot aware and unaware components. This is fine as we
don't interact with the assistant until the user is
unlocked.

bug:28963642

Change-Id: Ide5471fa1798e868c6e3a4b5e87570a5556e2d3f
2016-06-02 15:25:15 -07:00
Amith Yamasani
f5c37eb3b7 Use correct synchronization lock
This is to fix an incorrect unregister() that was crashing
the system server. The only way it could be happening is
because of incorrect locking. So, hopefully this fixes it.

Bug: 28813750
Change-Id: Ie3c47ffa3024a0c533e12db0d2d021df8fc0367a
2016-05-23 17:21:08 -07:00
Amith Yamasani
4f128e4d96 Fix multi-window assiststructure trashing
When multiple activities within the same process
try to handle requests for AssistStructure, the
singleton mLastAssistStructure tends to trash
the old structure when a second window's request
comes in.

This change passes in a sessionId so that the
cache is only cleared if the session id changes.

Bug: 28348867
Change-Id: I07efcd933db7e48aefd25a1c95493b71bbcffe4b
2016-05-10 12:17:51 -07:00
Amith Yamasani
02c80c63d4 Workaround for assist crash with multiwindow
Temporarily disable multiwindow assist until
Bug: 28348867
is fixed correctly.

Change-Id: Ia9d0fb5d4412e87aada90e8dcffe829b61221c6c
2016-05-09 12:46:23 -07:00
Chris Thornton
f967da9052 VIMS should only stop the keyphrases it started.
When the VIMS changes the implementation or has its implementation force
stopped, it used to stop all the recognitions that were in the
SoundTriggerService (without letting those clients know that they've
been stopped). Instead, the VIMS should just unload the keyphrases that
it loaded, so the other clients are not perturbed.

Bug:28518547
Change-Id: Ia70e8576f43cb8a8521c947ff7fc56f63cfbad54
2016-05-02 19:22:57 -07:00
Chris Thornton
37f9776ab9 Remove the STH tracking if a model has been aborted.
The STH just needs to log the fact that a model has been stopped when it
is aborted. We also need to allow models to be stopped even if the
service is unavailable.

Bug:28474708
Change-Id: I2d618ae9c7c87311223f7d75b8ded7678252d11c
2016-05-02 19:07:33 -07:00
Chris Thornton
56056038f7 Keep STH state in sync with HAL
During stopAllRecognitions(), the internal state of a sound model was
being cleared (which made it look like the model was being unloaded).
However, the model was still loaded, so subsequent calls to load a 'new'
model would break.

Bug:28432002

Change-Id: I7090bf52704c6e46e3bb6d495d8fe4b8a1d9e2ad
2016-04-30 12:06:49 -07:00
Amith Yamasani
50bbb66d60 Fix a regression in assist when context is disabled
Fixes: 28293783
 CTS: DisableContextTest#testContextAndScreenshotOff failure

When assist context is disabled, make sure that the handleAssist() is
still called with no data.

Change-Id: I569dd9f6de503e62fb04c590214df0f2ce3aa4f3
2016-04-22 15:43:21 -07:00
TreeHugger Robot
2be4c463bc Merge "Throw better exception when startVoiceActivity fails" into nyc-dev 2016-04-21 00:46:32 +00:00
Amith Yamasani
37f9de996e Reinitialize voice interaction service on unlock
Fixes the incomplete initialization on FBE devices when
voice interaction service is not available before unlock.

Change-Id: I397237e4554453d29da643aee59384e289fa3654
Fixes: 28183380
2016-04-19 17:20:51 -07:00
Amith Yamasani
4244978621 Throw better exception when startVoiceActivity fails
Introduced new error codes so that Instrumentation can
include the correct message in the exception.

Bug: 28216630
Change-Id: I93ee77153cdad11fa208c74c28c6790db27c9753
2016-04-19 11:45:51 -07:00
Chris Thornton
41e04a4525 Use .equals() to compare two UUIDs in SoundTriggerHelper, rather than ==
Also refactors ModelData::clearState to clear a bit more of the state.

Bug:28251543
Change-Id: I18d7ccd90a6a9ee8bc8743d9a92c48f17d87c842
2016-04-18 17:58:37 -07:00
Narayan Kamath
a09b4d2a61 Remove unnecessary allocation+unboxing of objects.
Transforming String->int can be done with 0 allocations
using Integer.parseInt.

bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60
2016-04-18 09:55:59 +01:00
Arunesh Mishra
59623ee337 Merge "SoundTriggerHelper: Add ability to manage multiple voice models." into nyc-dev 2016-04-14 20:00:00 +00:00
Arunesh Mishra
fac2515695 SoundTriggerHelper: Add ability to manage multiple voice models.
This CL adds the ability in STH to manage multiple voice models indexed by
keyphrase ID, which is an integer.

Bug: 28104190
Change-Id: I8e10cca05ed8b4b8414cae7fffc26c132d4b7cbd
2016-04-14 12:12:27 -07:00
Amith Yamasani
e8222e551f Multi-window assist callback
Introducing a new callback in VoiceInteractionSession to
provide assist data for additional activities in the
foreground in a multiwindow setup.

PIP, docked windows and free-form windows (top-most)
will be queried for assist data and passed through the
new API to the Voice Interaction service.

Bug: 27718385

Change-Id: Ib4427c304611b75c2078dcb54f1f7e47ae7d9cfa
2016-04-13 17:12:29 -07:00
Arunesh Mishra
78ab7cf301 SoundTriggerHelper re-design.
This CL redesigns and cleans up a lot of the core logic in STH.

Major changes include:
   - Adds Tron logging based counters.
   - Common startRecognition(), stopRecognition() and updateRecognition()
     routines that work on both Keyphrase and Generic sound models.
   - Common streamlined logic for when recognition is aborted, requested and
     paused due to phone call/power save etc, for both keyphrase and generic
     models.
   - Special handling of the singleton nature of keyphrase models in
     startRecognition().
   - Moves all Keyphrase model state to the common ModelData structure.
   - Adds Recognition pause/resume() for generic sound models so that they react
     to power save, call state, recognition aborted due to service unavailable
     etc.
Bug: 27972641

Change-Id: I96a7f567d2a4973facec556892a163ca74176bbf
2016-04-08 13:22:38 -07:00
Ryan Bavetta
6e3eeadee2 Merge "Fix unsynchronized access to model hashmap" into nyc-dev 2016-03-09 00:05:33 +00:00
Ryan Bavetta
79655ebf7e Fix unsynchronized access to model hashmap
BUG:27529749
Change-Id: I5b7cd59d8b45858896e6014b8fe95c1cc3c77869
2016-03-08 20:14:04 +00:00
Joe Onorato
3973b1a75d Turn down the logging a little bit.
Change-Id: I810b9bd58412d2b38d8ce4497baa71047125b92f
2016-03-04 12:21:30 -08:00
Arunesh Mishra
f47f173b06 Fix AlwaysOnHotwordDetector recognition event bug.
Parcelables don't work well with inheritance. So changed the
IRecognitionStatusCallback to have onKeyphraseDetected() and
onGenericSoundTriggerDetected() for those respective events.

Made corresponding changes to AlwaysOnHotwordDetector and SoundTriggerDetector.

Bug: 27250528
Change-Id: Ic08a431e7cc4248c688b05c865348170246de576
2016-02-24 12:57:01 -08:00
Arunesh Mishra
2d1de78a4c Unload logic for generic and keyphrase sound models.
When delete is called, now the STH unloads the corresponding models.

Fix bug with keyphrase where a delete call didn't unload (or stop)
the keyphrase model.

Bug: 27279380
Change-Id: Ia34f713d2aecef4102c0f0ccc57b8d2e5febe4bb
2016-02-22 15:19:44 -08:00
Arunesh Mishra
933da8150c Fix minor bugs:
- Fix issue when multiple starts cause multiple spurious loads to be sent to
   the native layer.
 - Fix scrolling issue in the native app.

Bug: 27222043
Change-Id: Iddf36a8b68637f478dc23b001ecbde352db3a5f0
2016-02-19 15:06:27 -08:00
Arunesh Mishra
3fff7f5634 SoundTriggerHelper changes for GenericSoundModels.
- Refactoring SoundTriggerHelper to handle generic sound models.
     - Ability to store multiple models, callback and state information.
     - Separate out initialization to be done per voice model, per any model
     and per generic model.
 - Minor change to the API exposed -- removing the Handler from the
   createSoundTriggerDetector call.
 - Added callback processing for onRecognitionEvent().
 - Added logic for stopAll().
 - Changes to the SoundTriggerTestApp to start/stop recognition.
     - Multiple models (3).
     - Ability to start/stop/load/unload individual models.

Bug: 22860713
Bug: 27222043
Change-Id: Ie5d811babb956bead653fb560a43f1e549ed11bd
2016-02-17 14:24:03 -08:00
Arunesh Mishra
55a9b0089c Fix moduleProperties in SoundTriggerInternal.
Change-Id: Ie7ea74ca39894f78875768dbc3e504b32f262fe6
2016-02-01 14:14:06 -08:00
Arunesh Mishra
c722ec4105 Fix SoundTriggerModel uses to GenericSoundModel.
Change-Id: I30308b39536864d7b9640367861730e3b1b12129
2016-01-27 13:37:27 -08:00
Arunesh Mishra
a772e5fc06 SoundTrigger API improvements.
This CL implements the SoundTrigger API improvements as given in b/22860713. Only the java-level
parts are implemented in this CL.

Key changes include:

* Addition of a SoundTriggerManager/SoundTriggerDetector system API to manage
  the sound-trigger based sound models.
* Addition of a SoundTriggerService service that manages all sound models
  including voice (keyphrase) and sound-trigger based models.
* Includes logic to write sound-trigger based models to the database.
* VoiceInteractionManager service now uses SoundTriggerService instead of
  SoundTriggerHelper.

Bug: 22860713
Change-Id: I7b5c0ed80702527c4460372efeb5e542d3693a69
2016-01-27 12:49:20 -08:00
Amith Yamasani
0af6fa7015 Voice Interaction from within an Activity
This allows an app to show a voice search button
and invoke a voice interaction session for use
within the activity. Once the activity exits, the
session is stopped.

Test application has a new activity that
demonstrates it with the test voice interaction
service.

This initial version is functional enough for
an integration test, with some more tests
and improvements to come later.

Bug: 22791070
Change-Id: Ib1e5bc8cae1fde40570c999b9cf4bb29efe4916d
2016-01-23 21:25:50 -08:00
Dianne Hackborn
6ac42aeed9 Add a mechanism for broadcasts to control background dispatching.
Right now this is just for the BOOT_COMPLETED broadcast to allow
all apps to receive it.

Also clean up the dumpsys of the broadcast queue to not have
every little detail of ResolveInfo+ActivityInfo+ApplicationInfo,
which is just not useful and makes reading the broadcast queue
debug output a lot harder because of so much noise there is.

And rename the package shell query-intent-* commands to a
shorter query-* form.

Change-Id: I0d01565babb87e68b840c9756a2ea730d699efc7
2015-12-09 11:31:51 -08:00
Dianne Hackborn
c83189b5d6 Fix issue #25673462: Shamu update from MMB29J -> 29K does not complete
The direct path to the package manager returns null on failure, oops!

Change-Id: Id33ea299b605a59b0703dab200bafb754dd66e78
2015-11-17 18:17:57 -08:00
Jeff Sharkey
f9fc6d6cc0 More file-based encryption work.
Add granular StorageManager APIs for key creation/destruction and
unlocking/locking.  Start passing through an opaque token as part
of the unlock command, but leave it empty for now.  We now have a
separate "prepare" method that sanity checks that user directories
are correctly setup.

Define a handful of system properties used for marking devices that
should be operating in FBE mode, and if they're emulating FBE.  Wire
a command to "sm", but persisting will come later.

Start using new "encryptionAware" flag on apps previously marked with
coreApp flag, which were apps running in the legacy CryptKeeper
model.  Small tweaks to handle non-encryptionAware voice interaction
services.  Switch PackageManager to consult StorageManager about the
unlocked state of a user.

Bug: 22358539
Change-Id: Ic2865f9b81c10ea39369c441422f7427a3c3c3d6
2015-11-11 10:47:23 -08:00
Chris Thornton
d8ef44bc51 Merge "Don't call StopRecognition when recognition was aborted." into mnc-dr-dev 2015-10-15 01:24:45 +00:00
Dianne Hackborn
958b9d2ecc Fix issue #24743380: VoiceInteractionManagerService doesn't use current...
...user for service info

Now it does.

The actual change is basically one line, passing in the current user
when building the service info.  The rest is more debugging output to
be able to see what is going on.

Change-Id: I451884e0780aac6ee92fd2cd520071894afdf586
2015-10-09 16:09:25 -07:00
Chris Thornton
b7b5812147 Don't call StopRecognition when recognition was aborted.
If recognition has been aborted, then the call to the sound trigger
device stop recognition has already occurred. The sound trigger helper
would then try to stop it again, which generates an error code for a
stop without a corresponding start event.

BUG=24677430

Change-Id: Ibf5d1da1a8eb06b677e428f047905d15fd5cf21f
2015-10-07 11:33:45 -07:00
Chris Wren
a35c96eb90 add metrics to assistant
long press
  screenshot enabled
  context enabled

Bug: 22949579
Change-Id: Iac178207fa7149cda03c9a817a0d1450e46e1c59
2015-08-06 15:11:42 -04:00
Dianne Hackborn
3551a59b27 Merge "Work on issue #21516866: Implement voice interaction in ResolverActivity" into mnc-dev 2015-07-28 19:52:53 +00:00
Dianne Hackborn
57dd737443 Work on issue #21516866: Implement voice interaction in ResolverActivity
The main change here is to not allow the dialog to go in to its "focus
on the last app the user selected" when running in voice interaction mode,
instead just always giving a simple list.

This also fixes some problems with cleaning up active commands when
an activity finishes and not forcing the current session to go away
when the screen is turned off.

Also added some debug help, having activity print the state of the
voice interactor.

Change-Id: Ifebee9c74d78398a730a280bb4970f47789dadf5
2015-07-28 12:52:11 -07:00
Jorim Jaggi
1dfa7c6c79 Don't use screenshot if structure is disabled (1/2)
Bug: 22674955
Change-Id: I694bb8dbb578da9d729414c7f2947ba4c15651e3
2015-07-27 17:49:00 -07:00
Jorim Jaggi
19695d9711 Add callback to voice interaction session for lockscreen shown
Bug: 22402726
Change-Id: Iaf83e2f2b0389d74b6ecf480aa91a34443803f7b
2015-07-21 12:35:16 -07:00
Dianne Hackborn
17f693520d Fix issue #22531747: Assist info should declare if user has disabled...
...context and/or screenshot

Added new API to find out what contextual data has been globally disabled.

Also updated various documentation to make it clear what kind of contextual
data you will get (and when it will be null).

Also added a new Activity.showAssist() API because...  well, I was already
in there, it was easy to do, it is safe, and maybe people will build cool
things with it.

Change-Id: Ia553d6bcdd098dc0fce4b9237fbfaca9652fc74b
2015-07-20 12:49:10 -07:00
Dianne Hackborn
1de1186d28 Implement issue #22403908: Enable assistant to refuse context sharing
New APIs allow the voice interaction service to set/retrieve a filter
for which of the show flags are allowed.

Change-Id: I588cbe55afee0548ad3afa22d3a7d3bc43cb54a6
2015-07-15 14:20:51 -07:00
Jorim Jaggi
165ce066b7 Fix assist for hardware long-press
Activating the assistant will now route through SysUI, so
we have the logic whether to start an activity or to start a voice
interaction session in one single place.

Bug: 22201770
Change-Id: I0f4699533aea2a1e595ee25a844434c82f548c01
2015-07-08 22:26:24 +00:00
Dianne Hackborn
4e88bcd399 Fix issue #20672970: Notifications are not dismissed on hot word detection
Add new VoiceInteractionSession.closeSystemDialogs() API that closes
everything except the session itself.

Change-Id: If45f1e120d8ca095b6c8055b6485acb5e710820e
2015-07-01 13:41:03 -07:00
Jorim Jaggi
a133f0b522 Add setting to disable screenshot separately (1/2)
Bug: 22063668
Change-Id: Ief704004a8ab0a65d34753f9098003ba695726df
2015-06-29 17:16:33 -07:00
Benjamin Franz
b6fb3fe8f4 Merge "Block assist when screenshots are disabled by policy" into mnc-dev 2015-06-29 10:29:23 +00:00
Jorim Jaggi
cc3a46ada8 Also reset assist setting when force stopping assist
Bug: 20882522
Change-Id: I57725586ab5ff203b378a1e6d2e5e77a47fd2448
2015-06-26 21:32:08 +00:00
Benjamin Franz
c200f44c46 Block assist when screenshots are disabled by policy
When a device or profile owner disables screen capture, we also want to
block context data being collected for the assist structure.

Bug: 21797707
Change-Id: Ib8716c6dd71d538a027c04e1e907c87e2afa0ac8
2015-06-26 11:16:49 +01:00
Svet Ganov
1e575a0f32 Merge "Only grant runtime permissions to special components." into mnc-dev 2015-06-19 22:26:32 +00:00
Svet Ganov
adc1cf4604 Only grant runtime permissions to special components.
Now runtime permissions are granted only to components that are
part of the system or perform special system operations. For
exmple, the shell UID gets its runtime permissions granted by
default and the default phone app gets the phone permissions
granted by default.

bug:21764803

Change-Id: If8b8cadbd1980ffe7a6fc15bbb5f54a425f6e8f9
2015-06-19 15:17:56 -07:00
Adrian Roos
4f43dc042b Assist disclosure
Add an animation that discloses delivery
of contextual data to the assist component.

Also fixes a bug where contextual data was
delivered to legacy assist activities even
though the user explicitly disabled context.

Bug: 21568059
Change-Id: I27dfaa36e2f677b0d73acfa4730f0f4ea3486919
2015-06-19 11:33:05 -07:00