102 Commits

Author SHA1 Message Date
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
Dianne Hackborn
216f5c3347 Bring back screenshot API.
Change-Id: Ia6bdfa300398d39119239f6a88c9992673edb3e0
2015-06-16 18:12:31 -07:00
Dianne Hackborn
b8004ff3d4 Fix issue #21816660 (app standby), work on issue #20882522 (voice interact)
Issue #21816660: More app standby abuse prevention

We now apply the same rules for deciding when an app has counted
as active when the screen is on as when the screen is off; the only
change this really means is that we don't immediately count foreground
services as making an app active both screen on as well as the
existing behavior for screen off.

Also small fix to how we switch into voice interaction mode that
guarantees we immediately switch to the screen on state.

Issue #20882522 VI: voice interactor service not restarted

This fixes some problems in the framework, allowing it to be
correctly restarted (and rolled by to the default voice interactor
if appropriate).  There are still some problems in system UI that
leave things broken in some cases.

Also small fix to how we switch into voice interaction mode that
guarantees we immediately switch to the screen on state.

Change-Id: Ie4fd098a2f5174a2c94f36d30427fb2a9db3d835
2015-06-15 17:05:04 -07:00
Yohei Yukawa
5f531f1f36 Make VIMS.SettingsObserver multiuser-aware.
VoiceInteractionManagerService.SettingsObserver has been used
to monitor per-user settings hence we have to take care of
multiuser scenario.

In the case of VoiceInteractionManagerService, monitoring
changes from all the users is OK because event handlers will
read settins from the current user anyway.

Bug: 21766395
Change-Id: I357fe2a7e2a5645355e696c6fbaae762f54ca029
2015-06-10 21:15:00 -07:00
Jorim Jaggi
b835dd7641 Close assist when launching intents from notification shade
Bug: 21035363
Change-Id: I51a6dbe5f0d93aaf81a38d1f1afacaaeaf7732e2
2015-06-09 00:31:12 +00:00
Dianne Hackborn
69c6adc96e More API changes.
Start moving Assist* stuff to android.app.assist.

Clean up some more of the VoiceInteractionSession APIs.

Clearly document that finish() is not the same as hide(),
always call hide() instead, and fix the finish() path to
also always do a hide to make sure everything is cleaned
up correctly.

Change-Id: I962d4069fcb34fe89547a95d395ae1b9fa3b4148
2015-06-02 16:56:41 -07:00
Dianne Hackborn
2ee5c368f8 Update VoiceInteractionService from API review.
This may even manage to retain compatibility with existing
binaries!  (For now.)

Change-Id: I3b1386287a6b9b20b57ac2e2444fd6f458837277
2015-06-01 11:42:04 -07:00
Dianne Hackborn
09d57fe9b3 Add new API to set URI on AssistContent.
Also rework how we transfer AssistContent and AssistStructure
to the assistant, so they are delivered as completely separate
objects rather than the kludgy bundling them in the assist
data thing.

Change-Id: Ib40cc3b152bafeb358fd3adec564a7dda3a0dd1d
2015-05-28 11:44:58 -07:00
James Cook
496767c142 Cancel voice assist session on user switch
Ensure any active voice interaction session is canceled when the
voice interaction service is shutdown. This ensures that the UI window
is closed when a user switches accounts.

Bug: 20501283
Change-Id: I9f3dae5afc4048482f6bedaed36dbae3c0823ebd
2015-05-22 16:16:37 -07:00
Cedric Ho
d9b0c913f7 am 782def77: am 80cf2210: Add config_forceVoiceInteractionServicePackage to allow a device to config its VoiceInteractionService package and ignore the regular setting.
* commit '782def772adacaf029d7d9850605923066665424':
  Add config_forceVoiceInteractionServicePackage to allow a device to config its VoiceInteractionService package and ignore the regular setting.
2015-05-20 22:22:23 +00:00
Cedric Ho
80cf221022 Add config_forceVoiceInteractionServicePackage to allow a device to config its VoiceInteractionService package and ignore the regular setting.
Change-Id: Ic40d90f1a7a9942f5e82080668552239bbed9b03
2015-05-20 13:50:22 -07:00
Jorim Jaggi
c6767354c5 Merge "Add setting to disable assist data (1/2)" into mnc-dev 2015-05-19 04:40:15 +00:00
Jorim Jaggi
9d91083034 Add setting to disable assist data (1/2)
Bug: 20944446
Change-Id: I8050df3177b6d540829c3f0989a4e4b1381c87ec
2015-05-18 21:39:05 -07:00
Dianne Hackborn
38a499edf5 Remove screenshot APIs.
Change-Id: I1efdb7945bd52f5f43c7103480be3d7dac60018b
2015-05-18 17:48:40 -07:00
Selim Cinek
03872c075e Fixed a bug with svelte and voice assist
Handling the case that no info is around.
Bug: 20925281

Change-Id: Id5a4c4373877909a898c8852891a854eacbc1f6c
2015-05-08 01:21:38 +00:00
Selim Cinek
e70d653523 The voice assist may now be launched above the lockscreen
A possibility was introduced to launch voice assist over
the lockscreen using the left keyguard affordance.

Change-Id: Ic4618d24256b65441a50d77d0ef59b0ec99b6ead
2015-05-05 14:52:52 -07:00
Jorim Jaggi
5f560d0562 Rename supportsAssistGesture to supportsAssist
Bug: 20642759
Change-Id: Idddc786980244cc94570d04fd414540bbad60448
2015-05-01 13:33:38 -07:00
Dianne Hackborn
d69e4c1460 Update use of procstate for services.
Now that we have a separate foreground service proc state
(above a sleeping top app), update various system services
to put their bindings into this state when appropriate.

There are two new bind flags for this -- one that just always
makes it a foreground service, another that only does it when
the device is awake (useful for things like the wallpaper).

And with all of that, tweak network policy manager to only
include apps that are at least foreground service state when
in power save and device idle modes.  This will allow us to
further reduce the set of apps that have network access
(in particular not giving access to the current top app when
the screen is off), hopefully leading to even better battery
life.

Change-Id: I91d85a5c5ed64e856149e9a5d94a634a7925ec7f
2015-04-29 17:04:50 -07:00
Cedric Ho
4e41767977 resolved conflicts for merge of 0af3af03 to mnc-dev
Change-Id: I38f423be6dcef216cf813aa0f747be38f0ad792f
2015-04-27 13:16:18 -07:00
Cedric Ho
c663d99f00 Enable VoiceInteractionService on watch.
Change-Id: I1d23ba55a98f6d68942cc344b4a564ab62285656
2015-04-24 14:38:25 -07:00
Jorim Jaggi
b09f8e29dd Fix VoiceInteraction permission issues
Change-Id: Id3796066353a6d7799ae983d18e6adc38c8cef52
2015-04-15 15:41:07 -07:00