Commit Graph

7485 Commits

Author SHA1 Message Date
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
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
Abodunrinwa Toki
c28be38ee2 Fix the list of PROCESS_TEXT items in the toolbar.
Bug introduced in I56c71450c850e1d8cd80d54d4e17a6390823485f
Bug: 66939160
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest

Change-Id: I8e9aee8791e2c6ba341015fa3a1c997004e7066a
2017-11-07 18:46:50 +00:00
Abodunrinwa Toki
2b6020fc80 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
2017-11-03 14:02:38 +00:00
Evan Rosky
837ae0d425 Fix some mouse + list-item selection/scrolling issues
Any "touch" interaction now hides selection (since mouse
doesn't enable touch-mode, this wasn't happening anymore;
also, allowing listview to scroll an actual selection
off-screen would be very involved and risky).

The selector hilight remains (since mouse doesn't enter
touch-mode). This is a new scenario, so this change also
makes sure to hide the selector hilight when it's target
view is scrolled off-screen.

Bug: 67881712
Bug: 67720587
Test: Existing CTS tests still pass. Can now click list items
      via mouse even when scrolled. Visually checked that that
      selector hilight is not visible if off-screen.
Change-Id: Ia7b0fd7b247e8d9d9e609364a5500717df648fd9
2017-10-30 16:07:50 -07:00
Andrew Solovay
ff9216a7c9 Merge "docs: Typo fixes" into oc-mr1-dev am: ab9449561e
am: 54e351b3cb

Change-Id: I522c023e03a9e49cb5d02b3d84d486dec16a8fba
2017-10-28 02:19:18 +00:00
Andrew Solovay
237c189723 docs: Typo fixes
See first comment for doc stage location.

Change-Id: I29661ffab0ff10021671df0b725c9f9b12430960

Bug: 67886596
Bug: 67932414
Test: make ds-docs
2017-10-27 15:29:57 -07:00
Evan Rosky
9e1c6328d2 Merge "Fixed several core and CTS tests" 2017-10-27 21:33:52 +00:00
TreeHugger Robot
bfc6a2bc36 Merge "Notification: Fix PendingIntent whitelisting" 2017-10-27 15:34:49 +00:00
Adrian Roos
fb92184ebc Notification: Fix PendingIntent whitelisting
Fixes several issues with the way PendingIntents are being whitelisted
from background check with Notifications. Most visibly, this causes the
whitelisting not to work on Notifications that use the DecoratedContentViewStyle,
but there are some conditions where the whitelisting breaks for regular
notifications too.

- After a Notification is rebuilt with Notification.Builder, the set
  of PendingIntents in the notification was not rebuilt.
  This broke the whitelisting whenever a PendingIntent is added after
  the Notification was already sent once. Workaround for broken platform
  releases: always use  a fresh Notification object, or clone before
  sending.

- Fixes PendingIntent.writePendingIntentOrNullToParcel to invoke the
  OnMarshalListener.
  This broke whitelisting for any PendingIntents attached to custom
  RemoteViews. Workaround for broken platform releases: Also attach
  the PendingIntent to the Notification's extras.

- Changes RemoteViews to keep the parcel cookies that were present
  during unparceling, such that they can be reapplied when it gets
  cloned.
  This broke whitelisting for any PendingIntents attached to a
  DecoratedContentViewStyle *even if added to extras*. Workaround
  for broken platform releases: none.

- Fixes Notification.whitelistToken mistakenly being static.
  There's an unlikely race condition where the field could be
  overriden with null by an incoming notification right as another
  notification is sent out. Workaround for broken platform releases:
  none.

Test: runtest -x core/tests/coretests/src/android/app/NotificationTest.java && runtest -x core/tests/coretests/src/android/widget/RemoteViewsTest.java
Bug: 68218899
Change-Id: I02e44040604a1d24422340611ae9e0332a611800
2017-10-27 15:46:40 +02:00
TreeHugger Robot
5a6a5417ec Merge "TextView: Support multiple textAssist menu items." 2017-10-25 00:03:21 +00:00
Abodunrinwa Toki
3049d8c1c0 TextView: Support multiple textAssist menu items.
Bug: 68049162
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I831e6933b584a2999f159dc2d80113ea9ba717f8
2017-10-24 21:28:56 +01:00
Andrei Stingaceanu
d27c36b870 [Magnifier - 6] Simplify API and configuration
* removed "scale" from the show(...) API
* made the zoom scale a dimension => the widget is
  fully self-configured
* fixed the magnifier not always scaling the content
  to the full pop-up window size

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: Ibf5c571970c8f6bd3cdbc6d46fbe57d08291783c
2017-10-24 11:17:35 +01:00
TreeHugger Robot
1eb19a3b87 Merge "[Magnifier - 5] Auto invalidate and misc" 2017-10-23 14:09:01 +00:00
Andrei Stingaceanu
ca189fe0fa [Magnifier - 5] Auto invalidate and misc
* due to having to make the API public, drop the
  invalidate_by_client strategy in favor of self invalidation
  by polling
* in Magnifier#show(...) stop sending screen coordinates in favor
  of view coordinates
* UI/UX:
** width from 200dp to 164dp
** fixed the shadow depth (elevation)
** fixed the rounded corners (2dp)

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: I6451767b0a618c0c4ea396ba3ee3144523dadc57
2017-10-23 12:25:15 +01:00
Sunny Goyal
9372ca079f Merge "Binding to the RemoteViewsService directly from the host" 2017-10-21 02:19:53 +00:00
Sunny Goyal
e1273ebbb7 Binding to the RemoteViewsService directly from the host
The host passes an IServiceConnection to the AppWidgetManager which
is used to bind to the RemoteViewsService. This allows the host to
recieve the connection callbacks directly instead of proxying it via
the AppWidgetManager. The host is also responsible for unbinding to
the service.

Bug: 26481160
Test: adb shell \
  am instrument -w -e class android.widget.RemoteViewsAdapterTest \
  com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Iac400095a319c3a43714c82fda7516be1ccc68af
2017-10-20 16:43:23 -07:00
Evan Rosky
adf5bec523 Fixed several core and CTS tests
Fixes in framework include:
- ListPopupWindow requests focus for itself so it can receive
  MENU key.
- PopupWindow uses setTransitionVisibility to avoid losing
  focus upon enter transition.
- First-traversal will explicitly handle FOCUS_AFTER_DESCENDANTS
  on the current focus if applicable -- details in code comment.

Fixes in tests usually just required focusing what they expected
to have initial focus; however, there were a couple tests that
had been broken for other reasons for a long time.

app.cts.ActionBarTest
app.cts.ToolbarActionBarTest
android.view.DisabledLongpressTest
android.widget.scroll.arrowscroll.ShortButtonsTest
android.view.VisibilityTest
android.widget.listview.ListScrollListenerTest
android.widget.listview.arrowscroll.ListOfThinItemsTest
andorid.widget.listview.arrowscroll.ListWithNoFadingEdgeTest
android.view.LongpressTest
android.widget.focus.ScrollingThroughListOfFocusablesTest
android.widget.gridview.GridScrollListenerTest

Bug: 67467972
Test: Failing tests should pass now.
Change-Id: I9e2fbfeb183eb777f35c67eca53e1f70809b7670
2017-10-20 11:10:05 -07:00
TreeHugger Robot
a18447dd4b Merge "FloatingToolbar updates" 2017-10-20 17:16:59 +00:00