Commit Graph

7502 Commits

Author SHA1 Message Date
TreeHugger Robot
1f31d9a8dd Merge "Making TextClassifier helper objects parcelable" 2018-01-15 11:26:06 +00:00
Richard Ledley
b033685533 Merge "Set selection bounds when we try to copy, so it will work with nonselectable text." 2018-01-13 00:15:19 +00:00
Jan Althaus
0d9fbb9bd1 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
2018-01-12 17:53:07 +01:00
Richard Ledley
b30669861f Merge "Make Linkify links clickable in nonselectable text." 2018-01-12 10:40:20 +00:00
Richard Ledley
4b823b9406 Set selection bounds when we try to copy, so it will work with nonselectable text.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Bug: b/67629726
Change-Id: I685ae3527685665eb3b50aaea90a570ebec47fd7
2018-01-12 10:13:26 +00:00
TreeHugger Robot
0b2249786f Merge "Move A11y events throttling away from View(RootImpl)" 2018-01-11 22:57:35 +00:00
Richard Ledley
724eff9a3d Make Linkify links clickable in nonselectable text.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest\#testToolbarAppearsAfterLinkClickedNonselectable
Bug: b/67629726

Change-Id: I94452116453fff1a36f5d567b3a686e92e97a34f
2018-01-11 14:16:14 +00:00
TreeHugger Robot
3101268dd8 Merge "Avoid unnecessary division in TextView.Marquee.tick." 2018-01-10 21:31:19 +00:00
Eugene Susla
e4d31b3c10 Move A11y events throttling away from View(RootImpl)
..and also extract common code into a common superclass

This also preserves the order of the throttled events
(TYPE_VIEW_SCROLLED & TYPE_WINDOW_CONTENT_CHANGED) with regards to the rest
of events by flushing any pending throttled events immediately if another
event is requested to be sent.

Test: ensure no new a11y CTS failures
Change-Id: I948a16716521974393aaa1cf822d0a0324e9ce3a
2018-01-09 13:28:59 -08:00
TreeHugger Robot
fe3cc4b996 Merge "Initial commit of updatable media API" 2018-01-09 19:05:15 +00:00
TreeHugger Robot
0f4c4232d7 Merge "Renaming leftover from previous CL..." 2018-01-08 23:09:32 +00:00
TreeHugger Robot
2ef95c9d1d Merge "Ignores Resources.NotFoundException when setting ViewStructure.setTestIdEntry()." 2018-01-08 21:17:30 +00:00
Felipe Leme
0ca18071b2 Renaming leftover from previous CL...
Test: echo 'In TreeHugger we trust!'

Bug: 71552872

Change-Id: I2b317c28cb7ec0e74b2cfa98338f9d64ff7dce3b
2018-01-08 13:00:25 -08:00
Felipe Leme
01f4f03188 Ignores Resources.NotFoundException when setting ViewStructure.setTestIdEntry().
Test: manual verification using com.facebook.katana
Fixes: 71695541

Change-Id: Idefc7d3799f2ef5525a5050d63ca29a19cab730a
2018-01-08 11:28:20 -08:00
Siyamed Sinir
8038267b98 Enable/disable fallback line spacing in TextView
Add API to enable/disable fallback line spacing in TextView.

Test: bit FrameworksCoreTests:android.widget.TextViewFallbackLineSpacingTest

Bug: 65161512

Change-Id: I76ba7bdb7d25c7a94653144536295c50d8b0e495
2018-01-04 19:48:35 -08:00
Christofer Åkersten
cfa037065e Initial commit of updatable media API
Test: Created instance & called method
Change-Id: I85f6ea946ef7886abe496b7a851d5b6d50e235b5
2018-01-04 20:50:24 +09:00
Felipe Leme
5dc45ca349 Added new Autofill APIs to get name of id used on android:text.
Such resource id is useful to help the autofill service heuristics to figure out
the meaning of the labels without relying on their localized text. For example,
the id could be "username", while the text could be "Nome do usuario".

Test: atest CtsAutoFillServiceTestCases:LoginWithStringsActivityTest

Fixes: 71552872

Change-Id: I13f7080fb3c67f91492a113115ffa43d185d192a
2018-01-03 16:09:55 -08:00
TreeHugger Robot
6ea80ae06c Merge "Fix crash in EditText#getText" 2018-01-03 03:37:55 +00:00
Shimi Zhang
29d1e9eed1 [Magnifier] Comparing the correct coordinates to in Magnifier update.
Previously we are comparing the clamped coordinates to avoid
unnecessary update of magnifier content. However if the magnifier is
reaching to the edge of the screen it doesn't update itself because
coordinates passed to Magnifier#show() later are clamped to the same.

This CL compares the coordinates without clamping to fix the issue.

Bug: 70580848
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: manual test with WebView that shows the magnifier works.
Change-Id: I65d681da334d5037a924e733d1a27cfd77231726
2018-01-02 17:31:01 +00:00
Clara Bayarri
c832bd57f7 Fix crash in EditText#getText
EditText#getText assumes the text is editable. However if this is
called during construction, the text might still be a String.

Bug: 36972818
Test: bit CtsWidgetTestCases:.EditTextTest
Change-Id: I811fad057f33666692930cb60d696740f7b40a19
2018-01-02 15:46:08 +00:00
George Mount
1c9b3136f7 Add TestApi to disable the TextClock clock tick.
Bug: 70771205

In order to test TextClock being only updated by the 12/24
hour setting, we must disable the clock tick from causing
the text to change. Otherwise whenever the minute changes,
the clock text would update. This leads to a flaky test.

Test: I4917a2296744697f1b50a17e3c5eb5873d567a47
Change-Id: Ifb669af3e6b882eb7c158b7de16e7eb2f0c48f61
2017-12-20 13:54:39 -08:00
TreeHugger Robot
347b7189f2 Merge "Update setLineSpacing docs to mention units" 2017-12-20 17:39:21 +00:00
Clara Bayarri
e536e574fe Update setLineSpacing docs to mention units
Bug: 64896499
Test: none, docs update
Change-Id: I1b94005643764f6484dca2b02845adde7135a37e
2017-12-20 10:36:36 +00:00
Tim Murray
fa83834a44 Avoid unnecessary division in TextView.Marquee.tick.
Test: Marquee.tick works
Change-Id: Idb2c1cadb6b49009f8bec45ad44a34f5636c0e79
2017-12-19 12:56:12 -08:00
Siyamed Sinir
198e309394 Add OWNERS for text related classes
Test: None
Change-Id: Ieacd6b7e91665c7f17ab7e9308d0533f6dc5663e
2017-12-18 18:04:30 -08:00
Richard Ledley
26b8722de6 Show Floating Toolbar when tapping a selectable TextLink in TextView.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest\#testToolbarAppearsAfterLinkClicked
Bug: b/67629726
Change-Id: Ied7a1903a308db37d0eb288c8e611da8229f381a
2017-12-18 10:12:59 +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
Seigo Nonaka
b507df4569 Merge "Introduce PremeasuredText" 2017-12-12 16:40:27 +00:00
Siyamed Sinir
ddd156bed5 Merge "Fix an incorrect display position of error popup in RTL layout" am: b7941c50a0 am: 0863cf4e40
am: 8fc08cc0f6

Change-Id: I96476450550e726c3ac6c07e39afcd175cfee043
2017-12-12 04:39:15 +00:00
Siyamed Sinir
8fc08cc0f6 Merge "Fix an incorrect display position of error popup in RTL layout" am: b7941c50a0
am: 0863cf4e40

Change-Id: Ief495fcc7e6f711696ed6337ab65face9d03c981
2017-12-12 04:25:54 +00:00
Siyamed Sinir
b7941c50a0 Merge "Fix an incorrect display position of error popup in RTL layout" 2017-12-12 03:57:43 +00:00
Seigo Nonaka
fbe63bddd6 Introduce PremeasuredText
By measuring the character widths beforehand, we can save at least 40%
of the StaticLayout construction time which typically happens on UI
thread.
Also verified this doesn't cause performance regression for not
premeasured text.

Raw performance score (Not premeasured -> premeasured, median, N=100)

No Style,   Greedy, Hyphenation OFF:  7,812,975 ->    503,245 (-93.6%)
No Style, Balanced, Hyphenation OFF:  7,843,254 ->    396,892 (-95.0%)

No Style,   Greedy, Hyphenation ON : 19,134,214 -> 11,658,928 (-39.1%)
No Style, Balanced, Hyphenation ON : 19,348,062 -> 11,634,942 (-39.9%)

Styled,     Greedy, Hyphenation OFF: 14,353,673 ->    572,840 (-96.0%)

Raw performance score (w/o patch -> w/ patch, median, N=100):

No Style,   Greedy, Hyphenation OFF:  7,732,894 ->  7,812,975 (+1.04%)
No Style, Balanced, Hyphenation OFF:  7,884,510 ->  7,843,254 (-0.52%)

No Style,   Greedy, Hyphenation ON : 18,986,958 -> 19,134,214 (+0.78%)
No Style, Balanced, Hyphenation ON : 19,232,791 -> 19,348,062 (+0.60%)

Styled,     Greedy, Hyphenation OFF: 14,319,690 -> 14,353,673 (+0.24%)

Bug: 67504091
Test: bit CtsTextTestCases:*
Test: bit CtsGraphicsTestCases:*
Test: bit CtsWidgetTestCases:*
Test: FrameworksCoreTests:android.text.MeasuredTextTest
Change-Id: I0b46f04b42cc012606a9c722eca0d51147a0dcc7
2017-12-11 18:55:12 -08:00
TreeHugger Robot
da586c5f9a Merge "Make TextClock only listen for specific changes." 2017-12-07 23:44:24 +00:00
George Mount
3e3a08e318 Make TextClock only listen for specific changes.
Bug 68016230

Make TextClock only listen for changes to the 12/24
hour clock setting, so that it doesn't trigger a
change when other settings are updated.

Test: I5dee1694890ec90b0eabb939cd636971ed9ba5d4
Change-Id: Ia345995dc2f019209e3c68e6e8681cd2c9d5f439
2017-12-07 07:39:38 -08:00
TreeHugger Robot
57a69f683c Merge "Revert "Don't generate irrelevant a11y events - framework"" 2017-12-06 16:48:16 +00:00
Eugene Susla
d4128ec0df Revert "Don't generate irrelevant a11y events - framework"
This reverts commit 8ddfb4794f.

Test: presubmit
Bug: 69975306
Change-Id: I05cb545eb0adc77298dddf2dea2997ef36b58a5f
2017-12-05 13:08:51 -08:00
Abodunrinwa Toki
008f387e83 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
2017-12-04 19:22:00 +00:00
Abodunrinwa Toki
ba3856266c 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
2017-12-02 01:06:39 +00:00
Svet Ganov
8ddfb4794f Don't generate irrelevant a11y events - framework
Now before we fire an a11y event we check if this event has an
observer. As a bonus we don't push the state to clients if the
dynamic service config did not change.

Test: cts-tradefed run cts-dev -m CtsAccessibilityServiceTestCases

bug:69427760

Change-Id: Ie208e13b8557bb7a120198a43efcb79c2752f5db
2017-11-28 17:58:38 -08:00
Andrei Stingaceanu
d6644dcfea [Magnifier - 10] Make it public
* moves the Magnifier from com.android.internal.widget to
  android.widget
* removes useless public getters; useless for now because we have
  no magnifier configuration but the hardcoded one

Bug: 67839742
Bug: 63531115
Test: bit CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ie6f474c4c781038650007a15937d61c650ee5fdd
2017-11-24 11:25:25 +00:00
Scott Main
5b7903cde0 add list of supported views to RemoteViews docs
Found by searching for all framework views with the @RemoteViews
annotation

Change-Id: I60e24676014a8ee2f5df0bac87349dad7d92081d
2017-11-21 02:21:45 +00:00
Andrei Stingaceanu
f1f320c81e Merge "[Magnifier - 8] SurfaceView support and invalidate revival" 2017-11-20 13:34:46 +00:00
Andrei Stingaceanu
41589fa83d [Magnifier - 8] SurfaceView support and invalidate revival
It turns out that the auto-invalidate at a defined time,
practically polling, is not a safe way to update content
and also has more chances of producing poor quality so
temporary bring back update() and keep it hidden as the
plan is to have direct update listeners from the graphics
stack in the near future. This solution works well for
TextView, WebView and Chrome.

Added support for SurfaceView (used by Chrome).

Editor adds an onDrawListener to the TextView's tree observer
which posts to Magnifier update. This makes sure the
absolutely everytime anything changes in the view hierarchy
update() will be posted (after the actual drawing).

Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: If1b858d793c7cc338d23a850051022768a3f1e40
2017-11-20 10:50:00 +00:00
Hidehiko Tsuchiya
a0c8c1cfc8 Fix an incorrect display position of error popup in RTL layout
Symptom:
The display position of error popup is incorrect in RTL layout such as
Arabic language.

Root cause:
In LTR layout, a popup window is anchored to the bottom-left corner of
the anchor view. But in RTL layout, it's anchored to the bottom-right.
showError calculates a position for RTL by itself and it gets a wrong
result.

Solution:
Set the base alignment of the error popup to the bottom-left even though
it's in RTL.

Bug: 69402857
Change-Id: Iae099984e6c47feca078658ddc44ab905995fe0d
2017-11-16 21:55:45 +09:00
TreeHugger Robot
c65b49e0bd Merge "Widget types for unselectable and custom views" 2017-11-15 08:47:54 +00:00
TreeHugger Robot
fa361abde8 Merge "Fix some mouse + list-item selection/scrolling issues" 2017-11-14 19:21:01 +00:00
Jan Althaus
b3c6ece78a Widget types for unselectable and custom views
Added new constants to be used by custom text view implementions, as well
as a special case for non-selectable text that will only become meaningful
once we start logging linkified text.

Bug: 67674199
Test: Tested that there are no regressions in the existing behaviour.
Change-Id: I0167c39bdbde2783f13a8776d6e280aadf55476b
2017-11-14 15:41:59 +01:00
TreeHugger Robot
0d872c0f2e Merge "Show selection handles even when toolbar is empty." 2017-11-14 14:41:52 +00:00
Abodunrinwa Toki
deb2f49f2c Show selection handles even when toolbar is empty.
Bug: 64245206
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: I2e985b12865bc3786f25b88bf6738048cc0e05a4
2017-11-08 18:56:05 +00:00
Evan Rosky
eac26194e8 Merge "Make PopupWindows into root namespaces" 2017-11-08 18:11:33 +00:00