History log of /frameworks/base/core/java/android/view/textclassifier/TextClassification.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
aec5981b88b7b223363561e0ceee0be2750a0458 16-May-2018 Abodunrinwa Toki <toki@google.com> Use FLAG_UPDATE_CURRENT for TC PendingIntents.

This way the newest PendingIntent will override any matching ones.

Bug: 78286917
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Change-Id: Ib130fa5979c3dab628e7be668331cb94d23e0829
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
ba196c5a3d8a8f04ffb22fd29435e545ee435fa0 20-Apr-2018 Abodunrinwa Toki <toki@google.com> Do not parcel legacy TextClassification fields

If we depend on legacyIntent, then TextClassifierService implementations
will have to always popuplate a deprecated field.
To avoid breaking legacy clients, the returned legacyOnClickListener should
represent the first pendingIntent (i.e. primary action) that was parcelled.

Bug: 78340399
Test: atest CtsViewTestCases:TextClassificationManagerTest
Test: atest FrameworksCoreTests:TextClassificationTest
Test: manual check with a TCS that only sets non-deprecated fields vs a
legacy TC client
Change-Id: I41d27a65f1ede6369dd2a66d92b2210edb0d11e2
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
904a931cfc5f2ffd6fd0c0fb03718abca37b5ee5 18-Apr-2018 Abodunrinwa Toki <toki@google.com> Fix non-unique PendingIntent issue with TCImpl.

As per the referenced bug, we're running into issues where apps are
being fired with stale intents. The reason is because we need intents we
fire to be unique by Intent.filterEquals. Some of the intents we
generate put unique data in the intent extra which is not considered by
filterEquals. The solution here is to create PendingIntents with unique
request codes (using classifiedText.hashCode()).
See more info about this in
https://developer.android.com/reference/android/app/PendingIntent.html

Bug: 77930684
Test: manually tested broken scenarios. See referenced bug
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: Ib7275f94ca5ada51e4ba191742d4b614df12e1ea
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
13a89c94031cf93fa60478803f2ace9127a5f7f9 09-Apr-2018 Jan Althaus <jalt@google.com> Minor TextClassifier fixes

- Fix incorrect nullable annotation (usage/APIs already correct)
- Fix outdated doc reference
- Fixed visibility of TextClassification fields

Bug: 74461129
Test: N/A
Change-Id: I107cc978c9385ac2ad706fa8e0a8a3ecb215cf36
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
ae82e7ad280e55dca22014c6abc857372229f89c 04-Apr-2018 Abodunrinwa Toki <toki@google.com> Fix TCS crash due to API changes.

- Brings by old deleted APIs and hides them
- Except parceling and hidden APIs that won't have been called anyway
- Option holds a reference to the Request object so we don't have to
rebuild it

Bug: 77523413
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextSelectionTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextLinksTest
Change-Id: I4277c48a950c3334439649373885ed7fe54f898e
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
080c8542b68cf17a0441862c404cb49ce0e86cfe 27-Mar-2018 Abodunrinwa Toki <toki@google.com> TextClassifier API updates.

1. Wraps TC queries in Request objects
2. Adds create/destroyTextClassificationSession system APIs
3. Adds the session Ids to system API calls
4. Change setSignature() to setId() on result objects
5. Plumbing to make the API updates work as things currently work
6. Hide Linkify.addLinksAsync APIs

Bug: 74461129

Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextSelectionTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextLinksTest

Change-Id: I933ada8b37ef9893331a265e3b4fc08e043f1029
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
a1652cfcce547183a426cc710691c740b2e46aa7 29-Mar-2018 Jan Althaus <jalt@google.com> Switch reference time to ZonedDateTime

Bug: 74838195
Test: atest FrameworksCoreTests:TextClassificationManagerTest
Test: atest FrameworksCoreTests:TextClassificationTest
Test: atest CtsViewTestCases:TextClassificationManagerTest
Test: atest CtsViewTestCases:TextClassifierValueObjectsTest
Change-Id: I0df9dddf415fa558435553336a8a0a15621e9b05
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
20d346eafec9404fb6f5b8eeb9a18ad794b4ca9a 23-Mar-2018 Jan Althaus <jalt@google.com> Change TextClassification to use RemoteActions

Behavioural changes:
- Every action now as an icon, and instead hints via RemoteAction whether
the icon should be shown or not.
- Icons are now taken from the app default, not the activity.
(That way, we can construct a lightweight resource backed Icon)
- Legacy intents are no longer parceled for security reasons.
(TextClassificatio wasn't parcelable in O)
- TextClassifications built with the new API will always return null for
getIntent, but provide a getOnClickListener.
- Accessibility descriptions are now provided for action mode items.

Testing changes:
- Removed URI checks from TCM test because PendingIntent hides this info.

Bug: 73950205
Test: atest FrameworksCoreTests:TextClassificationManagerTest
Test: atest FrameworksCoreTests:TextClassificationTest
Test: atest CtsViewTestCases:TextClassificationManagerTest
Test: atest CtsViewTestCases:TextClassifierValueObjectsTest
Test: atest CtsWidgetTestCases:TextViewTest
Test: atest CtsWidgetTestCases:EditTextTest
Change-Id: I6706d2c342a8bbb9de0146a48c8b8aac9d9c7d83
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
6563833cf3c79e8cd211e32357422ae899674437 16-Mar-2018 Abodunrinwa Toki <toki@google.com> Fix smart_linkify_enabled flag.

The flag should only ensure that smart linkify calls behave in the
legacy way instead of totally disabling linkify.
Also, to keep the flag consistent with smart_selection_enabled and
smart_text_share_enabled flags, the flag should only disable the
SmartLinkify (i.e. Linkify.addLinksAsync) feature not TextClassifier
APIs (i.e. TextClassifier.generateLinks).

Also fixes issue with non-focusable TextViews by firing the primary
action instead of showing the floating toolbar. (b/73156794)

Bug: 75967597
Bug: 73156794
Test: bit FrameworksCoreTests:android.text.util.LinkifyTest
Test: bit CtsTextTestCases:android.text.util.cts.LinkifyTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: manual - checked behaviour turning flag on/off
Test: manual - checked behaviour with TextView.setFocusableInTouchMode(true/false)
Change-Id: I541f60161b9cd63ce7e57235607500f2fb0841e7
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
2f19b92c756c539e16bbd730f117acfcdf98b4ce 12-Feb-2018 Abodunrinwa Toki <toki@google.com> TextClassifier: Support service intents.

Previously, the TextClassifier only supported Activity intents.

Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: Ic488e2f6241eb91a6cd6e16d9f84a49a679164dc
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
ef7cb2c0fc88513f065b8b37847dd6872ce53483 07-Feb-2018 Abodunrinwa Toki <toki@google.com> Fix size of parcelled TextClassification icons.

Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Change-Id: I02d659c127ebccb16d0150b7b70587a9d786331e
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
d32906c202db3b84151c310ecd89a07bb41208f7 18-Jan-2018 Abodunrinwa Toki <toki@google.com> Introduce a TextClassifierManagerService.

Apps wanting to use a TextClassifier service (instead of an
in-app-process TextClassifier) bind to this service. The service
binds to and reroutes calls to a configured system TextClassifierService.

TextClassifierManagerService manages the lifecycle of the configured
TextClassifierService and binds/unbinds to preserve system health.

A configurable TextClassifierService extends TextClassifierService,
declares an android.textclassifier.TextClassifierService intent, and
requires a permission that is only granted to the system so only the
system may bind to it.

The TextClassifierManagerService implements a similar interface to
TextClassifierService (i.e. ITextClassifierService) but doesn't have to.
This is done for simplicity sake and things may change in the future.

The configuration of the default service is in config.xml.
OEMs may change this with a config overlay.
If no TextClassifierService is specified, the default in app process
TextClassifierImpl is used.

Bug: 67609167
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: tbd
Change-Id: I8e7bd6d12aa1a772897529c3b12f47f48757cfe6
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
705b9e9a1b435c7b8ab3b47d300ced487ed2262e 22-Jan-2018 Jan Althaus <jalt@google.com> Adding intent generation for dates and flights

Bug: 67667478
Test: Added, and manually verified intent handling
Change-Id: Ib9e5a0df651690c852b7f44f226ffa768ce524e1
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
0d9fbb9bd15fb1c6eae171d316a2de65aaffeb48 28-Nov-2017 Jan Althaus <jalt@google.com> Making TextClassifier helper objects parcelable

- EntityConfidence is no longer generic because it doesn't mix well with
being Parcelable.
- Deprecated OnClick listeners in TextClassification as they can't be
parceled. (Outright removed the secondary listeners that were not part
of any release)
- Classes that were present in previous releases have their parceling
factored out into ParcelableWrapper helper classes for backwards
compatibility.

Bug: 67609167
Test: Added
Change-Id: I820ca4abc6b80f90007ab4424bc5df2a14f797b0
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
008f387e8344f9f98149856cd737086c14752f4d 27-Nov-2017 Abodunrinwa Toki <toki@google.com> Add a signature to TextSelection and TextClassification

A signature is a tag that a TextClassifier may use to identify an
object it returned for a given query. This is useful for logging
purposes.

This cl also removes:
- TextClassification.getLogType() and related logging.
This is already covered by selection event logging.
- TextClassification.getVersionInfo(),
TextSelection.getVersionInfo()/getSourceClassifier().
These are now featured in the signature.

TODO: Write a container class that generates and parses signatures.

Bug: 69791269
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I294f7e4d16c98c6512d56d08d488b204c1f91d47
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
ba3856266cff7e6865eb23ec0828b2a0aee2c79f 29-Nov-2017 Abodunrinwa Toki <toki@google.com> Primary/Secondary actions in TextClassification.

Bug: 68846316
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I84c652cb953f1af9b1c4077fa2a13ae23689c48b
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
bbe43dfd97c01364e46df452be4c99536d64e4fb 30-Nov-2017 Jan Althaus <jalt@google.com> Storage refactor for EntityConfidence

Caching the sorted entity list so users don't need to be careful to cache
the result of getEntities (previously dont by TextSelection and
TextClassification, but not TextLink). Also switched to ArrayMap as it's
better suited for small maps like the ones generated by the classifier.

Test: Ran FrameworksCoreTests
Change-Id: I08cc9f72146ccab88b6a3624f3775a366c814f7a
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
4d232d6243af42e2784664f6fab040e853f05223 23-Nov-2017 Abodunrinwa Toki <toki@google.com> TextClassifier cleanup #1

- Introduces TextClassifier methods that do not take options
- Adds warning to TextClassifier implementations not to implement
or call certain default methods. Ideally, only one of the
overloaded interface methods (the one that takes Options) needs
to be implemented
- Changes TextLinks.Options to a mutable type
- Updates tests

TODO: Introduce a TextClassification.Builder.setDefaultAction(...) and
change addAction(...) to addExtraAction(...).
TODO: Cts test to validate input params.

Bug: 68846316
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I9a12935388e16a9b57567a71c97afaee63405183
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
2b6020fc80dc239114ecc7ecd501d382d4883641 28-Oct-2017 Abodunrinwa Toki <toki@google.com> Optional parameters for TextClassifier APIs.

TextClassifier methods now take a @Nullable Options parameter which
is a container for optional parameters to its methods.
This way, if we need to pass an optional parameter to one of
TextClassifier's methods, we won't have to overload the method.
Instead, we'll introduce a new Options field.

This CL also adds a hidden optional field for suggestSelection.
This is used to make sure that "dark launched" models do not return
new selection indices to clients. Clients e.g. TextView that are
dark-launch aware may use the field to explicitly request for
dark-launch results.

Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Also see I843eadff8a2b674388055364c1f25c8d4ccea771
Change-Id: I58e44451ac8a8e3a5bc3959198447f5549870902
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
33ff200cbf5595f931ec38422cc0d4351990b762 24-Oct-2017 Abodunrinwa Toki <toki@google.com> Update TextClassifier Javadoc.

Bug: 65112496
Test: none
Change-Id: Id3732a2c8ed372be0f717346e6aa92b9e614ad04
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
92d76838f8122917c51a2ea7f04fa04d7c9275a9 27-Sep-2017 Jan Althaus <jalt@google.com> Adding multiple action support to TextClassification

This introduces no user visible changes. All users of the TextClassifier
still just query the default action.

Bug: 320611
Test: Manually tested with a locally modified action mode that supports multiple actions.
Change-Id: I8e8714e04d70f4787ecf605bb7e27ef7d1af4d79
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
d62a86e64c6e50ae03e12b29a2567c94e4f32c40 11-Sep-2017 Abodunrinwa Toki <toki@google.com> Fix smart selection logging bugs.

- Fix count with selection start index inside a word
- Properly handle whitespace characters
- Set the model version tag

Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Manually tested that logs are correct. Will follow up with automated tests.
Change-Id: Ib73b52ebce999f2cb6e5734e556cd09e47c89a29
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
692b196cc12f6852b0bb9009c882a69b67dda4d8 15-Aug-2017 Abodunrinwa Toki <toki@google.com> Introduce SmartSelectionEventTracker.

This will be used for logging text selection interaction.

Bug: 64914512
Test: No test. Everything builds fine.
Change-Id: Idb28864e0fc969be05d81855b2e7cd8389bd835e
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
d44286f94240f79b26703cf1dcff94893135c93c 12-Jul-2017 Abodunrinwa Toki <toki@google.com> TextClassification.text is nullable

Removes the @NonNull requirement on TextClassification.text.
e.g. TextClassifier.NO_OP doesn't classify text and thus returns
TextClassification.EMPTY which doesn't set TextClassification.text.
This is ideal as we need not make copies of this object when NO_OP
was performed.

Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
bit FrameworksCoreTests:android.widget.TextViewActivityTest
bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I0b3ac5bf0027cbd67ba40d1110f1100280c8c3a2
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java
e0b57893c68a685d287664df28467694a39e4432 28-Apr-2017 Abodunrinwa Toki <toki@google.com> TextClassifier: API rename

getTextClassificationResult() -> classifyText()
TextClassificationResult -> TextClassification

Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Bug: 37769880
Change-Id: I2d926e89058babf06bcff390bee3a45e965984e8
/frameworks/base/core/java/android/view/textclassifier/TextClassification.java