79 Commits

Author SHA1 Message Date
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
Dianne Hackborn
4870e9d5eb More work on device idle mode and other power stuff.
Add idle mode support to the alarm manager.  Introduce
a new concept of flags associated with alarms to tell
the alarm manager how to treat the alarm -- they allow
everything from the alarm that will bring us out of idle
mode, to alarms that are allowed when idle or should
also bring us out of idle.  The standalone boolean is
now also a flag.

(Note there is currently no protection from user space
setting the flags however it wants; I will be working
on that in a follow-up change.)

When in idle mode, the alarm manager pushes all alarms
that shouldn't execute during that time over to a
separate list that is not executed until out of idle.
To help with this, I reworked a bit how Alarm objects
are managed, so that when rebatching or moving between
lists we don't have to allocated new objects but can
just use the same existing instance.

Also tweaked the sync manager to deal with idle mode,
which currently just means doing the same thing as when
low on storage -- turning off sync.

Add new ACTION_CHARGING and ACTION_DISCHARGING broadcasts
that apps can listen for to know when the device is actively
charging and discharging.  These are better than the old
POWER_CONNECTED and POWER_DISCONNECTED ones because we only
report charging when we actually see that there is enough
power being provided to charge the battery (and will report
discharging if there is not enough power).

The job controller uses these new actions for scheduling
jobs that want to run while plugged in.  Removed the
"stable charging" stuff while doing so, since the new
charging state serves as an even better signal for that.

Introduced two new process states: FOREGROUND_SERVICE and
TOP_SLEEPING.  This will allow us to treat foreground services
specially (such as still allowing network access to them for
background music playback) while not mixing them together with
whatever happens to be the top activity while the device is
asleep.

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
2015-04-09 14:05:17 -07:00
Dianne Hackborn
d59a5d59df Various fixes and improvements...
Issue #19912529: VI: VoiceInteractor callback ClassCastException

Fix to use correct argument.

Issue #19912636: VI: Documentation for VoiceInteractionSession.onBackPressed

Added documentation.

Issue #19912703: VI: VoiceInteractionSession NPE on Abort Request

Maybe fix this -- don't crash if there is no active session.

Issue #19953731: VI: Add value index to...
...android.app.VoiceInteractor.PickOptionRequest.Option

There is now an optional index integer that can be associated with
every Option object.

Issue #19912635: VI: Behavior of startActivity when in voice...
...interaction is unexpected

We now forcibly finish the current voice interaction task whenever
another activity takes focus from it.

Issue #20066569: Add API to request heap dumps

New ActivityManager API to set the pss limit to generate heap
dumps.

Also added app ops for assist receiving structure and screenshot
data, so that we can track when it does these things.

Change-Id: I688d4ff8f0bd0b8b9e3390a32375b4bb7875c1a1
2015-04-04 17:36:05 -07:00
Jorim Jaggi
0b68ff4512 Add flag to voice interactor for supporting assist gesture
Add an additional flag to the voice-interaction-service declaration
so it can indicate whether it is able to handle the assist gesture.
Use that information in SystemUI so it only starts the voice
interaction session if the service is able to support it.

Change-Id: I62b035ce4f4cf06ee6e7eb0ddc4bf5edbc0e6737
2015-04-03 11:12:13 -07:00
Jorim Jaggi
225d3b5449 Add more internal API's for assist
- When starting a voice interaction session from SysUI, a callback
can be passed to know when voice interaction has successfully started
- Add a new window type for the voice interaction starting window,
which resides behind the voice interaction layer.
- SystemUI now also inspects the voice interaction service to get the
logo asset for the starting window.
- Make VoiceInteractionSession window fullscreen, to accomodate for
the visuals.

Change-Id: If8c3c445e8b39841f48e8d153e6d1ba81e447286
2015-04-03 11:12:03 -07:00
Jorim Jaggi
25e12abc5b Add ability to start voice interaction session directly
Add internal API's for SystemUI to start a voice interaction session
directly, without using an intent.

Make the assist gesture use that ability, if available.

Change-Id: I88ce3c7514714eb45666884847193585a07417a9
2015-04-03 11:11:51 -07:00
Dianne Hackborn
27eac1d58f Add ability to get a screenshot for assist.
New flag you pass in to startSession() to say you want it,
new callback on VoiceInteractionSession to receive it.

Change-Id: I61fdcfdee41a60d46036a2ef16681a9b4181115a
2015-03-17 16:45:51 -07:00
Dianne Hackborn
3d07c94c39 Add new voice request for picking from a list.
Also add API for voice interaction service to control
whether the system should hold a wake lock while it is
working with an activity (and actually *do* hold a wake
lock while doing so, duh!).

And while in there, clean up the launching wake lock to
correctly give blame to the app that is launching.

Change-Id: I7cc4d566b80f59fe0a9ac51ae9bbb7188a01f433
2015-03-16 11:29:12 -07:00
Dianne Hackborn
a83ce1dd2a More work on collecting assist data.
Optimize parceling of AssistData (which is now renamed to
AssistStructure) by pooling duplicated class name strings.

Change text associated with a view node to a CharSequence,
so styling information comes along.

Include global text attributes -- size, colors, etc.

Introduce a new AssistContent structure, which allows us
to propagate information about the intent and data the
activity is looking at.  This further allows us to propagate
permission grants, so the assistant can dig in to that data.
The default implementation propagates the base intent of an
activity, so if for example you bring up the assistant while
doing a share the assistant itself has the same information
and access that was given to the share activity (so it could
for example share it in another way if it wanted to).

Did some optimization of loading PersistableBundle from xml,
to avoid duplicating hash maps and such.

Changed how we dispatch ACTION_ASSIST to no longer include
the more detailed AssistStructure (and new AssistContent)
data when launching; now the example code that intercepts
that needs to be sure to ask for assist data when it starts
its session.  This is more like it will finally be, and allows
us to get to the UI more quickly.

Change-Id: I88420a55761bf48d34ce3013e81bd96a0e087637
2015-03-12 17:07:51 -07:00
Dianne Hackborn
ffeecb1bfb Rework voice interaction session lifecycle.
We now have a formal concept of the session being shown and
hidden, with it being able to continue running while hidden
as long as there is enough RAM.

This changes the flow that a VoiceInteractionSession will
see: onCreate() is when it is first created, onCreateContentView()
is when its UI first needs to be built, onShow() is called each
time it needs to be shown and has the arguments given when the
show request was made (which has been renamed from startSession to
showSession), and then onHide() will be called when the UI is
no longer shown.

The methods show() and hide() now allow a VoiceInteractionSession
subclass to control when it is shown and hidden, working with the
shown state being maintained by the system.

Change-Id: Ic4a430ec7e8bf76a5441fd0425e2932806170fcc
2015-02-25 17:36:17 -08:00
Dianne Hackborn
ae6688b096 Update voice interaction layer for new UI design.
Can switch from a pure overlay at the top of the screen,
to interactive mode with the voice UI drawing at the bottom
and pushing its target activity up like an IME.

Add mechanism to get assist data to the voice interaction UI.

Add some basic visualization of the assist data, outlining
where on the screen we have text.

Add a test ACTION_ASSIST handler, which can propagate the
assist data it gets to the voice interaction session so
you can see what kind of data we are getting from different
apps.

Change-Id: I18312fe1601d7926d1fb96a817638d60f6263771
2015-02-13 11:27:57 -08:00
Dianne Hackborn
4e106cedfe Bring back voice interaction APIs.
Change-Id: I6039d7c0b188ac342441c56f7d19994b9a80ba17
2015-01-21 15:07:20 -08:00
Dianne Hackborn
c0e4aaad1e Issue #17551667: Voice interaction service should be disabled...
...by default on Svelte devices

Also make sure the voice_recognizers feature is not enabled on
low-ram devices, with a new facility for platform feature
declarations to say they should be ignored on low ram devices.

Change-Id: I833c04b12e0e566dd682ed20adb0985c677a696f
2014-11-14 11:05:08 -08:00
Sandeep Siddhartha
45c00b5877 Don't unload the sound model on stopRecognition
This helps us in majority of the scenarios where the sound model doesn't
change across start/stop calls.

Bug: 17954633
Change-Id: Ibff817bb69bc69d2bb3a2603460fed596688b892
2014-11-12 09:57:27 -08:00
Sandeep Siddhartha
8cf8f71644 Fix issues with multiple languages and multi-users
For multi-user the issue was looking into the user ID of the current
process instead of the active user. The current process was the system
process and the call to UserManager was returning a user handle that
wasn't of any use while trying to map sound models to a user.

For language, the issue was that we were incorrectly just looking up the
model based on the keyphrase id, however we should have also taken the
enrolled model's locale into account.

Explicitly document that for model management the string representation of locales
is a BCP47 language tag.

Remove debug logging.

Bug: 16798166
Bug: 17462570
Bug: 17463511
Change-Id: Ieffb3e218de63f6e7f40af9705dced481a35b0ad
2014-09-15 19:59:09 -07:00
Eric Laurent
2475e38c10 SoundTriggerHelper: handle media server death
Retry to attach sound trigger module when startRecognition() is called.

Bug: 17373746.
Change-Id: I5b2f806b6cab47741d345be1cde73a84f5a62590
2014-09-09 17:26:00 -07:00
Dianne Hackborn
d7c0395d26 Hide the interaction part of VoiceInteractionService.
Also the ability to start voice activities is turned off,
though for testing purposes it can be turned back on with a system
property.

Change-Id: I867704d32c53beeb851ceea9b45c28bf5c01ef61
2014-09-02 10:29:28 -07:00
Jeff Hao
1b012d302b Add sample profiling option to am.
Also bundles all profiling options into a class.

Bug: 17040932
Change-Id: I85d675ee1494bdc7308caffdf94145d27c996e9d
2014-08-26 15:54:25 -07:00
Sandeep Siddhartha
efe0f9c7f2 Turn off hotword when in power save mode
Bug: 15705459
Change-Id: Ifa8b80223affffdc00da467c2066bc6370c85af1
2014-08-22 18:35:49 -07:00
Dianne Hackborn
16ec0808b5 Make sure we initialize to enable the default voice interaction service.
We weren't taking care of the case of an upgrade to L.  The main
change here is that the voice interaction service setting now has
an empty string when the user has explicitly said they don't want
one, so when it is null we will initialize it to its default.

Change-Id: Icdd30b4f09498f8928cea759a64628bd43bc5d0e
2014-08-15 18:34:10 -07:00
Sandeep Siddhartha
a31413a325 Fix delete clause for sound model DB
Since UUIDs contain '-'s they need to be wrapped within quotes

Bug: 16985919
Change-Id: I624a512ca7fc2494a7737b5465c94a9e161dec88
2014-08-13 10:52:17 -07:00
Sandeep Siddhartha
6df952ec22 Add debugging info to VIS via dump()
Change-Id: I9e8f4536de309256db835b30d94765bfc27d4e80
2014-08-11 09:38:38 -07:00
Dianne Hackborn
a351ab9698 Fix issues 16739817 and 16709247 in voice interaction service.
Issue #16739817 VIS doesn't start for non-primary user(s)
Issue #16709247 GSA is not the default voice interaction agent

These are both fixed by getting rid of the existing code for applying
the default voice recognizer, moving it in to the voice interaction
manager service, and extending it to also set up the default voice
interaction service.

Change-Id: If8d5936c28aebfa7eff77c8d99241c3a2ffdb0a4
2014-08-09 13:31:59 -07:00
Sandeep Siddhartha
6b8556d2e3 Dump the state of SoundTriggerHelper for bugreports
Change-Id: I01a17d969fbd22c6bcbb161e3542ca14a3f8c7c8
2014-08-07 12:10:48 -07:00