Commit Graph

317 Commits

Author SHA1 Message Date
Kevin Hufnagle
e69b8a9006 docs: Fix note about new intent action changes coming with Android 11.
Bug: 155091482
Change-Id: I3dfeb333cbe95880142ed97d0d50fd9f85c52f50
Test: Documentation changes - no test necessary
2020-08-20 18:48:17 +00:00
Josh Imbriani
a66e4ad7c2 Adding documentation to note new intent action changes coming with
Android 11.

Bug: 155091482
Test: Documentation changes - no test necessary
Change-Id: I2472cd2f94d0dc1fac249f99cd91ae201b1f419b
(cherry picked from commit 4a2a4b1a45)
2020-07-17 19:34:13 +00:00
ryanlwlin
5e08c38c89 Fix Voice shortcuts not working system-wide in R
SpeechRecognizer binds RecognitionService to realize it's feature.
When RecognitionService checks the record_audio permission, itself
doesn't have the capabilities to use the permission since it's not
a foreground process. We use the addition flag to allow the bounded
process to get same capabilities.

Bug: 154954447
Test: manual test:
   1. Install Talkback with voice shortcut feature
   3. assign voice shorct function to any gesture
   2. launch any app to leave home and trigger shortcut via the gesture
Change-Id: I2f867af739c69a5ba29bb49397819cb61915e42d
2020-05-06 20:44:09 +08:00
Andrew Solovay
d6975db81e docs: Note behavior of PREFER_OFFLINE
Resets developer expectations on the way to deprecation of a parameter
in the Android Speech APIs.

This change was made by hand in the refdoc HTML (cl/303351535);
making the corresponding change to the source code, so the doc
fix won't be reverted with the next DP update.

Bug: 151475334
Test: make ds-docs
Exempt-from-owner-approval: Docs-only change
Change-Id: I053a8e9d9623c394954a118b5e068fc4015b2ba7
2020-04-13 15:30:16 -07:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
Joshua Imbriani
4cfbdb2e93 Merge "Adding allowBlocking override to getBinder call" 2020-01-27 17:54:27 +00:00
Josh Imbriani
e1bef18ba6 Adding allowBlocking override to getBinder call
Test: Manually tested

Change-Id: Ib50060ae6a13ada6169a613a3c604a39151c5279
2020-01-16 15:03:10 -08:00
Artur Satayev
df4395991f Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-07 13:29:50 +00:00
Josh Imbriani
8cd244a4a1 Updating documentation for synthesizeToText
Test: Updating comments only

Change-Id: I67fd6930dec959a7e0810d76892d260664a54100
2019-12-05 14:22:18 -08:00
Philip P. Moltmann
83ae48222b Pipe through featureId from caller to noteOps in RecognitionService
Test: Built
Change-Id: Iab40419af886cccc1565f62bad29086b12ec1945
2019-10-30 16:23:58 -07:00
Svet Ganov
249810df2e Update PermissionChecker usages to avoid unnecessary attribution.
We had accidental usages of the PermissionChecker for cases where no
private data was provided to the app but the checkPermission API on
the latter also did blame data access on the app. The PermissionChecker
was designed to handle IPC calls and not for generic API checks.

To avoid future accidental incorrect PermissionChecker usages this
change renames the existing APIs of the latter to clearly indicate
that they should be used for data delivery and also adds sibling
methods for doing the same permission checks for preflight purposes.
Also the documentation is improved to furhter assist developers.

In addition, this change fixes accidental permission checker usages
that blame when they should not by using the new preflight flavor
of the permission check APIs.

Test:
    atest com.android.settingslib.location.RecentLocationAppsTest
    atest CtsPermissionTestCases
    added: LocationAccessCheckTest#notificationOnlyForAccessesSinceFeatureWasEnabled
    added: LocationAccessCheckTest#noNotificationIfFeatureDisabled
    added: LocationAccessCheckTest#noNotificationIfBlamerNotSystemOrLocationProvider
    added: LocationAccessCheckTest#testOpeningLocationSettingsDoesNotTriggerAccess

bug:141028068
Exempt-From-Owner-Approval: merge
Change-Id: I65c71569d0dd8a40bc6fecabb22c5373dd6e806e
2019-10-04 19:25:54 +00:00
Josh Imbriani
21ddc7a696 Adding a new overloaded API for synthesizeToFile taking a FileDescriptor
instead of a File object

Bug: 131276728
Test: "run cts -m CtsSpeechTestCases" Added new CTS Test case ag/7932820
Change-Id: I4fb23150d17aa8a96f57389c28205df9af45fc20
2019-08-09 15:38:24 -07:00
Xi Han
4af9cda557 Merge "Add the NonNull annotation to avoid runtime exception when the engine is not bound successfully." 2019-04-01 18:37:58 +00:00
Cassie
85762eabd0 Add the NonNull annotation to avoid runtime exception when the engine
is not bound successfully.

Bug: 124627359
Test: manual
Change-Id: I1b449ec6ec1c0164cc1b779ff573a2f84e521552
2019-04-01 09:27:29 -07:00
Rakesh Iyer
bae3b7f4b1 Update documentation for TextToSpeech.
Updated references to the deprecated speak method
that accepts a HashMap to the current version that
accepts a Bundle.

Bug: 127120857
Test: make docs
Change-Id: I6563f5039786e1e8ea44acd4819eaf42c34c0cb9
2019-03-18 14:05:20 -07:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Andrei Onea
f4fb6fb754 Add @UnsupportedAppUsage annotations
For packages:
  android.speech
  android.telephony.mbms.vendor
  android.view
  android.webkit

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Iefe25091fa0fcc0adfe4ff85fe5e3ab3ac9c5f10
2019-02-27 15:42:25 +00:00
Rakesh Iyer
241c46cdad Fix off by one error in getMaxSpeechInputLength().
Bug: 115599815
Test: atest android.speech.tts.cts.TextToSpeechServiceTest
Change-Id: I43b9488bfee261cb2cefd63384739f493d32e2c4
2018-11-26 09:38:04 -08:00
Rakesh Iyer
b4182fb082 Stop synth when tts client dies.
There was code to stop synthesis when a tts client died
but it was commented out in a seemingly unrelated CL,
possibly in error. Restore the code, now synthesis stops
as expected when the calling app dies.

Bug: 78187631
Test: Start playing a long body of text with the test app,
      kill it is adb shell am force-stop. With this change,
      the tts playout no longer continues.

Change-Id: I647ddcc46416ca33db4ad0fdbfca1fb5e88924a1
2018-11-26 09:38:04 -08:00
Rakesh Iyer
f14011af67 Remove extra call to dispatchStart().
Fixes a bug where UtteranceProgressListener.onStart is called twice
when calling TextToSpeech.synthesizeToFile().

Bug: 22262115
Test: Ran cts android.speech.tts.cts.TextToSpeechServiceTest
Change-Id: I7fa4cf824508e2880d0d74bab7a35f8678c38250
2018-10-18 09:56:03 -07:00
Mathew Inwood
36b13f3648 Add @UnsupportedAppUsage annotations
For packages:
  android.speech.tts
  android.speech

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I578e17b05247d77e33b846e7e56633b0b4e4c69f
2018-08-06 16:00:16 +01:00
Laura Davis
a67c2d8601 docs: fixed typo in deprecation message
Test: make ds-docs

Bug: 68303139
Change-Id: I7fc9f35bc118f8b661740a46f52d62beea1e67f1
2018-06-22 15:15:32 -07:00
Christopher Tate
72da1e6f78 Document system activity intents that may not be implemented
All of these activity-start intents might be unimplemented on some
Android products.  Document this to make sure that developers are
aware of the need to safeguard against this.

Bug: 68300743
Bug: 62201251
Bug: 69587018
Fixes: 77282739
Test: atest CtsContentTestCases:.AvailableIntentsTest
Change-Id: Ia2346d03ccb7f2bdad2b84ba9efff72413fdc3c2
2018-05-10 17:55:26 -07:00
Eugene Susla
726b51a26e Copy PermissionChecker from support lib and use in RcognitionService
Fixes: 73511076, 73311729
Test: presubmit
Change-Id: Ie98f67ffee4744050ac85d8b229370a16a76a194
2018-02-23 12:53:55 -08:00
Niels Egberts
32011ea4f1 Fix race condition with calling stop() before run()
The code assumed that when stop() is called before run(), it's not
neccessary to signal mNotFull, but in rare cases the synthesizer may
already have filled the buffer before run() is called.

Test: manual

Bug: 70887227
Change-Id: I83117f3541d37830b344bc9eda34e1f380b58e76
2018-02-13 18:13:36 +00:00
Jeff Sharkey
ce8db99114 Add more IntDef prefixes for auto-documenting.
Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
2017-12-13 20:05:36 -07:00
Kazuhiro Inaba
35e6bb474d TTS: Fix a race condition between enqueueSpeechItem and stopForApp.
When speak() is immediately followed by a stop(), the speak may not be
stopped at all due to a race condition.

Bug: 63649835
Test: android.speech.tts.cts.TextToSpeechServiceTest#testSpeakStop
Change-Id: Iae5660b455f5d845aa119c902057e2ca7131ce1b
2017-08-03 04:20:21 +00:00
Kazuhiro Inaba
a81d17b795 TTS: Ensure to callback onStop() from SynthesisPlaybackQueueItem.
The previous implementation calls back the dispatcher only at the end
of run() loop. It means, if stop() is called after enqueueing and
before running, none of onSuccess, onStop, or onError is called for
the items in the queue.

Bug: 63649835
Test: android.speech.tts.cts.TextToSpeechServiceTest#testSpeakStop
Change-Id: Ib20cb0e9157859866f694439858a27369ba8026e
2017-07-25 17:12:25 +09:00
Jeff Sharkey
000ce80505 Updates based on API council guidance.
Test: builds, boots
Change-Id: I223faf55c1e1b4d81d11b4c8b2d93ccd131c969b
Fixes: 37775662
Fixes: 37748635
Fixes: 37673408
Fixes: 37672564
Fixes: 37672218
Fixes: 37638323
Fixes: 37637423
2017-04-29 13:14:17 -06:00
Niels Egberts
04637f3d4d Document examples where a developer might use the APIs.
Test: mmma frameworks/base/
Bug: 35767714

Change-Id: I845db36869b84a18e79d7fe28f10031cfe836617
2017-04-13 13:52:07 +01:00
Amith Yamasani
53e100c468 Provide deprecated API to avoid build breakage
Restored onUtteranceRangeStart() temporarily as a deprecated API.

Bug: 36646809
Test: N/A
Change-Id: I7da927aca4f4ad1f5cc76564e8fdc4261849898b
2017-03-27 14:36:37 -07:00
Niels Egberts
5d0ea0fe21 Add time markers to synthesizeToFile API.
Also rename onUtteranceRangeStart to onRangeStart based on feedback from
the API council.

Bug: 35767714
Bug: 35767290
Test: cts-tradefed run cts-dev --module CtsSpeechTestCases
Change-Id: I2c17a06e401313d4f35e5ec4958c2251c195ef05
2017-03-22 13:28:59 +00:00
Sergio Sancho
07d98a9d68 Ensure we set the notification marker position by calling updateMarker()
just after the AudioTrack is initialized.
This solve the issue with cached synthesis in which updateMarker was
called before AudioTracker initialization and we never got the
callbacks.

Test: Built android and flashed to a device.
Change-Id: I9053d1d046cc9a76aeedd307d5d48920e26e584d
2017-02-14 12:35:13 +00:00
Sergio Sancho
7c810edbce Merge "Ensure default pitch is used when none is specified." 2017-02-08 19:28:55 +00:00
Sergio Sancho
b0cde2caba Ensure default pitch is used when none is specified.
Test: Manual
Change-Id: I09ab4ccea439d01c65a06c3c44b4ff210ddf7f54
2017-01-26 20:39:05 +00:00
Niels Egberts
65c5078456 Implement time markers for TTS.
The service can inform the framework at which frame a part of the input
is spoken, and that information is then relayed to the client.

This can be used to highlight the currently spoken word/sentence or to
resume synthesis requests at the start of the last word/sentence.

Test: manual
Change-Id: Ie20a6764a8788cc3539cb058425e55eb6fde07db
2017-01-24 15:27:16 +00:00
Niels Egberts
9b01193770 Merge "Remove refernces to V1 API, as V2 doesn't exist anymore." 2017-01-03 11:52:42 +00:00
Niels Egberts
01dedf59db Remove refernces to V1 API, as V2 doesn't exist anymore.
Also ran formatter on modified lines.

Test: Refactor only, CTS tests still passing.
Change-Id: I1309cfa8e9e731d3450c13d96038e6b5d53a12e1
2016-12-23 15:39:05 +00:00
Niels Egberts
2c80a03823 Remove redundant public modifiers in interfaces.
Also applied formatter on modified lines.

Test: refactoring CL. Existing unit tests still pass.
Change-Id: I9a7c33e7590260ede0811dd1b50b565b0f8d2f87
2016-12-23 12:23:54 +00:00
Niels Egberts
10db95b316 Fix issue when QUEUE_DESTROY arrive at the same time.
When multiple QUEUE_DESTROY messages arrive in a short timespan, some
messages were not flushed. This is because every QUEUE_DESTROY message
resets mFlushAll just before it starts playing itself. The solution
is to keep a counter of the amount of flushes that are still behind it on
the queue and keep flushing until the last one is reached.

Bug: 27555444
Change-Id: Ic24aa2250bf684e74b541907e4c57e0d5f0069ca
2016-04-08 11:18:23 +01:00
Glenn Kasten
33b840444f Use audio_session_t consistently
Also prefer AudioManager.AUDIO_SESSION_ID_GENERATE over
AudioSystem.AUDIO_SESSION_ALLOCATE, because
AudioSystem.AUDIO_SESSION_ALLOCATE is @hide.

Bug: 27562099
Change-Id: I5924554feb919db7f2390f5b062faedd515421af
2016-03-10 10:35:49 -08:00
Niels Egberts
c99ba1c3ed API to listen in on the synthesized audio.
Change-Id: Ic943d39a0540f0061ef6f629e4934dc71f69ab6b
2016-01-25 15:20:59 +00:00
Niels Egberts
c9bd275db5 Merge "Fix checks for audio format." 2015-12-09 11:42:36 +00:00
Niels Egberts
9b2b2f5090 Fix checks for audio format.
Change-Id: I43e9a94f8ddd46f72d24e06d72702f354bbeae46
2015-12-08 14:57:48 +00:00
Neil Fuller
568f4de11a Merge "Fix @code escapes" 2015-12-03 09:44:01 +00:00
Neil Fuller
71fbb81b14 Fix @code escapes
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.

Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
2015-12-02 14:24:11 +00:00
Niels Egberts
453c13f771 Small refactoring for FileSynthesisCallback.
Removed unused callerIdentity member and removed null checks
for the dispatcher.

Change-Id: I2983f5d48a7a593bc998ba4e033f1e815fa61819
2015-11-30 14:02:08 +00:00
Niels Egberts
5fd28893f2 Fix docs build failure.
Change-Id: If8d215f34a48e0c61aec0d35f10f1bfd633a4254
2015-11-23 15:39:21 +00:00
Niels Egberts
a24b50bee1 Restrict audioformat to 8bit, 16bit or float PCM with an annotation and
a warning.

TextToSpeech.synthesizeToFile has only ever worked with 8bit and 16bit
PCM. In case of float PCM an invalid file would be generated and in case
of other encodings the TTS engine would crash.

Also add more annotations to SynthesisCallback.

Change-Id: I1c44a44509e9b53bb2e1b0f2044b1a5919875e1c
2015-11-23 10:15:39 +00:00
Niels Egberts
54545f7e65 NPE occured when trying to parcel voice features.
The default features member should be an empty list instead of null.

Bug: 22404239
Change-Id: Ia39982f17fd3b3cd0f3556435170aed2fac14fb8
2015-08-05 15:48:26 +01:00