26 Commits

Author SHA1 Message Date
Dharmesh Mokani
ae686a5128 Address API review comment:AlwaysOnHotwordDetector
- Methods creating an Intent should be named createFooIntent

Bug: 17389896
Change-Id: Icb9c9f9ca3a41fca09f79ff22b99988a1ded331f
2014-09-04 16:43:17 -07:00
Sandeep Siddhartha
ee16bdc33d Address API review comments
- Make Callback an abstract class
- Split manage intents into 3 different methods
- Remove RECOGNITION_FLAGS_NONE

Bug: 17255602
Change-Id: I1329f889bb2ab35938f42d2ecfe755d2b17ec542
2014-08-27 10:23:35 -07:00
Sandeep Siddhartha
fb30d6936a Fix conversion of locale from BCP47 language tag
Bug: 17187528
Change-Id: Ifcf707c9be736885f3fc79f3c36087ecf9092971
2014-08-23 16:00:16 -07:00
Sandeep Siddhartha
dcf3068fcb Fix the Locale story in the hotword API
Tighten the API by taking in a locale rather than a string tag.
Tighten the checks when reading the enrollment metadata, bail out if any
attribute is missing or invalid.
Add missing recycle call for a TypedArray

Stop recognition when sound model(s) change. This is needed during
un-enrollment/re-enrollment.

Bug: 17187528
Bug: 17205230
Change-Id: Idb00b51ef8c4ea0a8f8993decea582223181fa3d
2014-08-22 17:23:13 -07:00
Barnaby James
0134fd8139 Make Test Voice Interactor support new requirements.
Add settings activity and stub RecognizerService to voice interactor test.

Change-Id: I3c3dda7d2c30eac5e0b889c0c7305dc8f4dfbcb9
2014-08-09 21:24:52 -07:00
Sandeep Siddhartha
cb4e81c7fe Handle microphone contention/Phone calls while recognition is active
Internally we pause the recognition when:
 - a phone call is active/off-hook/ringing
 - or some other application grabs the microphone

we auto-resume when the condition that caused us to pause reverses.

Both these events are notified to the client via callbacks so that they can choose to display on their UI,
that the recognition is paused for some reason.

Bug: 16515468
Bug: 16740806
Bug: 16514535
Change-Id: Ib274d68522c8cf37d42402c875b16159957657f0
2014-08-07 11:53:02 -07:00
Sandeep Siddhartha
db92e35211 Fix build break
Change-Id: I7af700671f1a2e910b6e08498381c8adb40631f8
2014-08-07 11:23:03 -07:00
Sandeep Siddhartha
2c0273e50a Add a flag for multiple triggers with same recognition session
Also annotate the flags with @IntDef to make things clearer and safer

Add more debug logging

Revert to start/stop being synchronous since telephony and microphone will
need to be handled internally.

Bug: 16731586
Bug: 16514535
Bug: 16549061
Change-Id: I83695d52e9547269c95d443e4d921c9238b7401e
2014-08-01 17:46:27 -07:00
Sandeep Siddhartha
668327d028 Tighten the checks around a detector being invalidated
Don't call back for a detector being marked invalid because
that happens when someone else obtains a detector or VIS shuts down,
in either case we don't want a loop where two entities keep creating new detectors
and being invalidated.

Don't call back on an invalid detector for availability change/detected/started and stopped
only propagate errors.

This helps us with cases where a callback for the previous VIS may get called and then crash because it
tries to make calls without being the current VIS.

In the new scheme of things, if the VIS changes, or the current VIS obtains a new AlwaysOnHotwordDetector,
the previous one is shutdown and internally marked as invalid and all calls to it fail with an IllegalStateException.

Bug: 16629417
Change-Id: I74417bf76ba80916ebc21b042c18b3467857733e
2014-07-31 15:48:26 -07:00
Sandeep Siddhartha
1ed12ddb8c Make startRecognition async
- This is needed for telephony and audio integration which should happen via async callbacks
that'll end up starting/stopping recognition.

e.g. if a startRecognition happens when in a phone call - the onDetectionStarted will get called once the phone
call ends.

For now the transient stoppages due to internal reasons will not be propagated back to the client.

Bug: 16514535
Bug: 16515468
Change-Id: I1b2b8edd28f5c5e67c453f66c23e1a67a626114e
2014-07-30 11:43:41 -07:00
Sandeep Siddhartha
f63bc523ea Make hotword availability a callback
This helps us make the list sound models operation an async one, it also helps us
with the case where a detector is invalidated, so the client doesn't have to keep checking the
state.

Synchronize DatabaseHelper methods on its instance so that other VoiceInteractionManagerService
calls aren't blocked on db writes/reads.
It's still possible for the list operation to be blocked on update and vice-versa

Change-Id: Ib8ec4ac5056b62d443038560ce31d0641b4627b0
2014-07-22 17:11:52 -07:00
Sandeep Siddhartha
6daae96226 AlwaysOnHotwordDetector needs to reflect enrollment changes
Add a callback for when any sound model change happens. This helps the VIS
to re-check the availability and either enroll the user, or start/stop recognition.

Also shut down any active recognition when VIS dies, or a different hotword detector instance is obtained from VIS.

Change-Id: I03f94e78c6ee307afe822a84aebc7e74c64de7b4
2014-07-22 09:16:18 -07:00
Dianne Hackborn
33f5ddd1be Add permissions associated with app ops.
Change-Id: I575ad7a3ceea59486ca601f69760b14f6269511d
2014-07-21 20:15:59 -07:00
Sandeep Siddhartha
110f569b47 Fix synchronization issues in AlwaysOnHotwordDetector
- Remove unnecessary recognition status from AlwaysOnHotwordDetector

- Remove unnecessary recognition started callback from IRecognitionStatusCallback

- Fix a bug around the fact that we weren't picking up enrollment at runtime because
we were storing the availability at instantiation time.

- Handle 0-length arrays in SoundTrigger classes while parceling/unparceling

- Fix issue in SoundTrigger helper where we were not comparing binders for start/stop calls

- Unload the previous model when starting a new recognition

- Add more debug logging

Change-Id: Icc56d7f3dd1ffa49a8cfeea49080e3ab4d342c32
2014-07-20 16:53:09 -07:00
Sandeep Siddhartha
7444c906fa Test hotword flow
- Also fix a few StrictMode violations in DatabaseHelper

Change-Id: I93f27407dae34cc0dca5e9f891d4ca718d6010a5
2014-07-17 18:44:12 -07:00
Dianne Hackborn
fee756ff91 Implement issue #16330060: Inform ActivityManager about WebView...
...state changes.

Add a new API to tell the activity manager about a new dependency
one process has on another package.  Start using it already for
when apps is Context.createPackageContext() to load code from another
app.

Also do some work on getting the monitoring of proc/uid states
in shape so it can be used by unundled code, along with an
AppImportanceMonitor class for doing so.

Some small fixes and additions to VoiceInteractionService.

Improve handling of unaccounted/overcounted battery use so that
they aren't shown to the user unless they are significant.

Change-Id: I22dd79a73f4e70103d3f8964494aebc8a31f971c
2014-07-16 22:50:31 -07:00
Barnaby James
d3fdb8bed8 Add VoiceInteraction request type for successful actions.
Add CompleteVoiceRequest to VoiceInteractor to allow apps to indicate when a voice interaction was successfully completed.

Change-Id: I1481cfe96e9e2495d88a7a4fb62263bdd1e03c54
2014-07-11 10:34:50 -07:00
Sandeep
d701820031 Always on hotword changes
Add model management API skeleton to VoiceInteractionManagerService
Add an "interactor" for all always-on APIs

- The VoiceInteractionService will get an interactor for the given
  keyphrase and locale.
- It can then check the availability and call methods to start and
  stop recognition on this interactor.

- Add a common class to deal with SoundTrigger APIs

- Cleanup the keyphrase representation:
  We now have separate representations for the keyphrase metadata and
  a keyphrase being used for recognition.
  This'll also help us to handle custom keyphrases in the
  future easily.
  This also ensures that for use within the framework,
  we rely on the ID of the KeyphraseInfo rather than comparing the
  text everytime.

Add a callback for the AlwaysOnHotwordDetector

This callback should be passed in by the VoiceInteractionService and is used to notify it
of recognition events.

Change-Id: I26252298773024f53a10cdd2af4404a4e6d74aae
2014-07-10 18:32:37 -07:00
Sandeep Siddhartha
22968950b8 Activity for enrollment
- Make the enrollment attrs public
- Add a dummy activity for enrollment

- Manually tested that the meta-data is correctly read by the
  VoiceInteractionService when the enrollment application is under
  /system/priv-app

Change-Id: I36676ed8ffc919109031c26bac047d0c51a77e13
2014-06-11 15:34:39 -07:00
Alan Viverette
830960cce0 Material theme
BUG: 15467097
Change-Id: I15191362e104a902895418fc615892c21db64c35
2014-06-06 15:48:55 -07:00
Dianne Hackborn
a2c076d540 Clean up voice API.
Add various java docs.

Switch to CharSequence where appropriate.

Add new request for canceling voice interaction.

Also update test app to follow API changes and be more better.

Change-Id: If27eeba53cf6444660adb7d37ea2ce0557c6c91f
2014-05-30 16:42:57 -07:00
Dianne Hackborn
20d9474904 More work on voice interaction visuals.
There is now a special theme for voice interaction activities
to use, so they can be a panel that is better intergrated with
the rest of the voice interaction experience.  This is still
not completely working, I have some hacks in the demo app to
get it right; I'll fix that in a future change.

Also improve VoiceInteractor to be retained across activity
instances, for things like rotation.

And bump up the number of concurrent broadcasts that are allowed
on non-svelte devices, since they can handle more and this makes
the boot experience better when dispatching BOOT_COMPLETED.

Change-Id: Ie86b5fd09b928da20d645ec2200577dee3e6889d
2014-05-30 10:06:16 -07:00
Dianne Hackborn
e30e02f5d9 Add system layer for voice interaction services.
New window layer that voice interaction service windows
go in to.  Includes a new voice-specific content rectangle
that voice activities are placed in to.

Add specific animations for this layer, sliding down from
the top (though this can be customized by the voice interaction
service).

Also add the concept of activities running for voice interaction
services for purposes of adjusting the animation used for them,
again sliding from the top, but not (yet?) customizable by the
voice interaction service.

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
2014-05-28 17:16:51 -07:00
Dianne Hackborn
c03c9167c2 Further work on voice interaction services.
This makes VoiceInteractionSession a more first-class
concept.  Now the flow is that a VoiceInteractionService
calls startSession() when it wants to begin a session.
This will result in a new VoiceInteractionSession via the
VoiceInteractionSessionService containing it, and the
session at that point an decide what to do.  It can now
show UI, and it is what has access to the startVoiceActivity
API.

Change-Id: Ie2b85b3020ef1206d3f44b335b128d064e8f9935
2014-05-05 11:18:08 -07:00
Dianne Hackborn
18f0d357f9 Rework some of the voice interaction APIs.
On the app side, requests are now composed by subclassing
from various types of Request objects.

On the service side, starting a voice interaction session
involves starting another service that will then manage the
session.  This leads the service design much more to what
we want, where the long-running main service is very tiny
and all the heavy-weight transient session work is elsewhere
in another process.

Change-Id: I46c074c6fe27b6c1cf2583c6d216aed1de2f1143
2014-04-28 10:54:15 -07:00
Dianne Hackborn
91097de49b Initial implementation of new voice interaction API.
This gives a basic working implementation of a persist
running service that can start a voice interaction when
it wants, with the target activity(s) able to go through
the protocol to interact with it.  It may even work when
the screen is off by putting the activity manager in the
correct state to act like the screen is on.

Includes a sample app that is a voice interation service
and also has an activity it can launch.

Now that I have this initial implementation, I think I
want to rework some aspects of the API.

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
2014-04-24 17:48:58 -07:00