Commit Graph

6920 Commits

Author SHA1 Message Date
TreeHugger Robot
9f5d2b0886 Merge "Don't scroll popup parent in response to parent scrolling" 2017-01-30 18:31:21 +00:00
Chet Haase
b64e777f6c Add methods to query animation state
Testing utilities want the ability to know whether things in the UI
are in flux and they need to wait before testing on-screen values.
These changes (a subset of what's needed, but will have to do for
a start) allow querying of ActivityTransitions and ProgressBar, two
common/difficult pieces in the puzzle.

Test: CTS tests at ag/1835467
Bug: 30978257 Provide view transition Api to prevent flaky tests

Change-Id: If63b3d0dde2178d826ac1dbfad0fc50e5ed9a780
2017-01-30 12:57:43 +00:00
TreeHugger Robot
fe98ad919b Merge "Implement .xml font resource support" 2017-01-30 09:37:13 +00:00
TreeHugger Robot
b46df69a77 Merge "Move autofill focus triggers from TextView to View." 2017-01-28 01:54:48 +00:00
TreeHugger Robot
c7b21e2263 Merge "Fix ListView click handling under new focus rules" 2017-01-27 23:11:45 +00:00
Jason Long
2b004b3aba Move autofill focus triggers from TextView to View.
Bug: 31001899
Change-Id: I6fd01b86936b3140edf87ac63292c77015bb019d
Test: Manual
2017-01-27 13:47:37 -08:00
Adam Powell
995c043acf Fix ListView click handling under new focus rules
ListView historically uses View#hasFocusable to change signifcant
behavior around the clickability of items: an item view with any
focusable children could not be clicked via an item click
listener. Many apps therefore have sub-views in list items that are
deliberately clickable, but not focusable. This comes up in cases like
overflow menu buttons on list items.

Now that we have auto-focusability triggered when a view is set as
clickable, the expectations of apps using this pattern have changed.

Create an overload of hasFocusable that optionally can filter out
auto-focusable views in its results. Have ListView use it to preserve
its previous behavior. This isn't public API for now, but perhaps it
should be if this pattern shows up in practice in places other than
ListView.

Bug: 34756767
Change-Id: Ie71ee6e388449f634b30f9162a8b3fa578e32db8
2017-01-27 13:31:44 -08:00
Clara Bayarri
ed00bfdfae Implement .xml font resource support
This change implements the loading and parsing
of xml type font resources, and makes sure it is
used properly by TextView styles.

Test: run cts -m CtsContentTestCases -t android.content.res.cts.ResourcesTest
run cts -m CtsWidgetTestCases -t android.widget.cts.TextViewTest#testFontResources*

Change-Id: I5a2930b3ba7dad67d9607e9036a5dde6bab0c5a4
2017-01-27 20:16:48 +00:00
Jason Long
31e8939491 Move autofill-specific logic from EditText to TextView.
Change-Id: I92725144d737ed182e6ece7018a9f8d075fb5ba7
Test: Manual
2017-01-27 01:57:46 -08:00
Felipe Leme
bd00fef41c Moar AutoFill Framework refactoring...
* Encapsulated application-level auto-fill logic on AutoFillSession.
  Currently, Activity.java directly manages the IAutoFillCallback binder
  object used to auto-fill its views, but this logic need to be
  extended so Views can use it to draw the auto-fill bar.

* Pass auto-fill id and boundaries to requests
  So AutoFillUI can display its affordance in the right places.

* Uses a new auto-fill id on View (instead of reusing accessibility's).
  That allows moving the logic on whether a new request should be made or
  the existing UI moved to the service side.

* Split service methods in 2, for shell cmd and app
  And applied the right permission check on both.

* Removed CancelationSignal from onSaveRequest()
  Since it's not really needed.

* Etc...
  ¯\_(ツ)_/¯

BUG: 34637800
BUG: 31001899
Test: CtsAutoFillServiceTestCases passes
Test: manual verification

Change-Id: Ibd0cb2cfff6d0f6bb6b697a423ed5e89df687b82
2017-01-26 15:39:59 -08:00
Elliot Waite
0ce4b0e4c3 Fix @links in reference docs. am: 54de77470d am: ab978c035e am: 28ba4722a9
am: 9b21265b2c

Change-Id: If246ebdb36cf2832d5a6c42cbe752e290b6fb6e8
2017-01-26 04:49:33 +00:00
Elliot Waite
9b21265b2c Fix @links in reference docs. am: 54de77470d am: ab978c035e
am: 28ba4722a9

Change-Id: I98177a8cf0a20677e140406bb7371474ca259e5b
2017-01-26 04:44:54 +00:00
Elliot Waite
28ba4722a9 Fix @links in reference docs. am: 54de77470d
am: ab978c035e

Change-Id: If0d0613362e0ea95cf48eaf9a16d3eea48b589ea
2017-01-26 04:39:57 +00:00
Elliot Waite
ab978c035e Fix @links in reference docs.
am: 54de77470d

Change-Id: Id38c30bad13d6b61ed504a06471b9f197b360f7b
2017-01-26 04:34:57 +00:00
Elliot Waite
54de77470d Fix @links in reference docs.
Change-Id: I40cea46efd80c448640ff69753698fe8404da40b
2017-01-25 17:00:55 -08:00
TreeHugger Robot
000f7cd646 Merge "Initial IME integration." 2017-01-25 19:44:33 +00:00
Alan Viverette
50df07a1ad Don't scroll popup parent in response to parent scrolling
Change-Id: I18c2a53f05341f3fd1dc870a6645b583f742b7ec
Fixes: 34096043
Test: PopupWindowTest#testPositionAfterParentScroll()
2017-01-25 17:30:32 +00:00
Felipe Leme
3461d3c069 Initial IME integration.
- Created an AutoFillManager class, which provides methods to show
  the auto-fill bar for views and virtual nodes.
- Automatically launches an auto-fill request when the IME is shown
(and an AutoFillService is set for the given user) on TextViews.
- Updated VirtualNodeListener to use this new API.

BUG: 31001899
BUG: 34171325
Test: CtsAutoFillServiceTestCases passes
Test: manual verification

Change-Id: Id72ce97da70217081b5823cfc7b138412634fcf3
2017-01-24 17:57:16 -08:00
Evan Rosky
975911cda8 Merge "Add support for automatic focusability determination" 2017-01-24 21:49:07 +00:00
Abodunrinwa Toki
f001fefff3 Update TextAssistant interface.
Rename to TextClassifier
Move to android.view.textclassifier package
Adds getTextClassifierInfo(...)
Changes addLinks(...) to getLinks(...)

This CL also integrates this interface with framework components
and passes a context to TextClassificationManager.

Test: Tests will be added with implementation.
Bug: 34661057
Change-Id: If9e90f034ebb702c1f78e72b6a844f39eebf738f
2017-01-24 15:01:24 +00:00
Andrei Stingaceanu
2317b64f02 Merge "AutoSize TextView (part 7) - APIs for configuring auto-size" 2017-01-23 11:21:57 +00:00
TreeHugger Robot
9a33bda070 Merge "Add @TestApi PopupMenu.getMenuListView" 2017-01-21 07:10:05 +00:00
Vladislav Kaznacheev
f087a17534 Add @TestApi PopupMenu.getMenuListView
This method returns the ListView representing the menu.
It is required to test the actual contents of a PopupMenu.

Bug: 34076597
Test: android.widget.cts.ToolbarTest#testItemViewAttributes,
          android.widget.cts.PopupMenuTest#testItemViewAttributes

Change-Id: Id72a8f482048d724d4fde15b126e0d08e1d18390
2017-01-20 08:29:17 -08:00
Andrei Stingaceanu
5d04239b3b AutoSize TextView (part 7) - APIs for configuring auto-size
Contains:
* getters/setters for all auto-size config attributes
* verbose JavaDocs
* isolated and reused the setup part of auto-size
* some variables had to become instance fields
* clarified some variable names

In a few words, whenever a configuration setter is
called, the value is assigned and setupAutoSizeTextXY()
gets called. The latter tries to build all the
intermediary values that it needs, attaches default
values, etc. If it is successful then it makes a call
to autoSizeText(), else it throws a runtime exception
with an appropriate message.

Bug: 32221168
Test: attached in the same topic
Change-Id: I448454ef4490102c8cc2b19e0e16e998aeb45cd0
2017-01-20 14:35:26 +00:00
Siyamed Sinir
24fac986ec Merge "Revert "Introduce set/getFontVariationSettings."" 2017-01-20 01:59:52 +00:00
Siyamed Sinir
a3b9f2e3c6 Revert "Introduce set/getFontVariationSettings."
This reverts commit ba3028c1fc.

Bug: 34378805
Change-Id: I8250c87af5d65fb45789632580be4ae1b8711372
2017-01-20 01:13:23 +00:00
Evan Rosky
4c8c963ece Add support for automatic focusability determination
New android:focusable attribute value "auto" and corresponding constant
FOCUSABLE_AUTO specifies that the framework can determine a view's
focusability. For now, the only "auto" logic is that focusable = clickable.

This has the effect of making clickable views focusable by default
unless the developer has explicitly set them focusable=false.

Bug: 31963283
Change-Id: Icce768fa701966970ea6b3469b33a4ef97ebc3ea
Test: Added CTS test, related CTS passes, made a test-app which
      enumerates all clickable/focusable combinations to verify
2017-01-19 15:39:05 -08:00
Ben Murdoch
769fb4ebcc Merge "When dragging text, take style data too." 2017-01-19 10:42:12 +00:00
Keisuke Kuroyanagi
a4371bc564 Merge "Fix: Wrong TextView height when DynamicLayout is used." 2017-01-18 05:56:07 +00:00
Svetoslav Ganov
631370fa36 [DO NOT MERGE] Prevent crash from early Toast surface destruction. am: 016c9c8cb5
am: a7ff8fbe74

Change-Id: Id672b82ddba7aee6e3c2748a7fae1e9f879538aa
2017-01-17 23:02:56 +00:00
Svetoslav Ganov
a7ff8fbe74 [DO NOT MERGE] Prevent crash from early Toast surface destruction.
am: 016c9c8cb5

Change-Id: Ib33d75a050a1b79de9590f2dbe03609c6e2b4463
2017-01-17 22:58:18 +00:00
Phil Weaver
0a78adea72 Merge "Provide hint text to accessibility." 2017-01-17 18:11:22 +00:00
Ben Murdoch
3dac460b48 When dragging text, take style data too.
Test: manual; dragged some formatted text. Style preserved.

Bug: 34264469
Change-Id: I8463782eba6d32dca054b8f59033745b9c5519a7
2017-01-17 11:28:58 +00:00
Keisuke Kuroyanagi
c2e38ce281 Fix: Wrong TextView height when DynamicLayout is used.
When DynamicLayout is used, max line is not set for
computing layout even if TextView has the limit. So, we
still need to use getLineTop in getDesiredHeight.
This bug was introduced by I1e1cae31cf33d503a8cf.

Bug: 34279529
Test: manually tested
Test: android.widget.cts.TextViewTest

Change-Id: I9b7a3c46e7671a84e6a830eb962a49d2b0856eab
2017-01-16 19:34:41 +09:00
Jason Monk
cd26af7054 Move all time ticks to bg handlers, and post
This will hopefully avoid blaming sysui for ANRs when the system
is hosed.

Test: Manual, build, push, wait for time to change
Change-Id: I1661ac1a997ad8917b449dd175229d8b77f583c9
2017-01-13 13:43:22 -05:00
Andrei Stingaceanu
564328b21e AutoSize TextView (part 6) - introduce autoSizeMaxTextSize
Using textSize as maxTextSize for autosizing is buggy and
unclean. Introduce and use new autoSizeMaxTextSize attribute for
TextView.

Also while doing this optimized the auto-size process by removing
unnecessary computations:

1. If auto-size is enabled than setTextSize(...) is no-op.
2. After setting the text size internally and from the auto-size
context onMeasure() will stop doing another round of redundant
measurements..

Bug: 33449596
Bug: 32221168
Test: atttached in the same topic
Change-Id: Ieecaea6df0aebb4c182bdd1114e3c6fc5066bed1
2017-01-13 11:52:00 +00:00
Keisuke Kuroyanagi
846946ec06 Merge "Make selection end handle stick to selection at line end." 2017-01-13 06:39:22 +00:00
Keisuke Kuroyanagi
7c263ddd58 Make selection end handle stick to selection at line end.
At line break, one offset can be mapped to two phisical
position: previous line end and next line start.
Previously, all cursor handles are placed at next line
start.
With this CL, selection end handle is placed at the
previous line end in such cases.

Test: FrameworksCoreTests
Bug: 21305922

Change-Id: I00d9f9a0cd417ca92534e93b3d3f655cd62f25d3
2017-01-12 19:24:18 +09:00
Seigo Nonaka
ba3028c1fc Introduce set/getFontVariationSettings.
This CL enables developers to specify axis values to the underlying
font collection. The specification of the font variation settings is
the same as the CSS font-variation-settings attribute in CSS working
draft as of 2016-11-30.

Code example: Here is an example to set width 100 and weight 1.5.

  TextView tv = (TextView) findViewById(R.id.textView);
  tv.setFontVariationSettings("'wdth' 100, 'wght' 1.5");

Bug: 33062398
Test: Manually done. Ran FrameworksGraphicsTests, CtsGraphicsTestCases
      and CtsWidgetTestCases
Change-Id: I249d464f8cdaa56017a987588b94ed685aadeb58
2017-01-12 18:11:03 +09:00
Vadim Tryshev
1abe85c867 Converting action bars to clusters.
ActionBar keyboard navigation logic is now implemented via clusters.
Old implementation using setTouchscreenBlocksFocus and Ctrl+Shift+<
shortcut is removed.

Looking at the code, I can’t rule out existence of all 3 categories
(1) action bars with a nested toolbar, (2) action bars without a
nested toolbar and (3) Toolbars outside of action bars.
Because of this, I set “cluster” attribute both on action bar and
toolbar, and have code to avoid nested clusters in case (1).

Support lib’s action/tool bars aren’t converted, however, they
didn’t regress since Ctrl+Shift+< never worked for them. Will be
done after feature freeze.

Bug: 32151632
Test: Manual checks.
Change-Id: Ieb93980088c0fb385a9bc8a5d218ffc269b94dc5
2017-01-11 17:19:39 -08:00
Seigo Nonaka
88296d221b Merge "Introduce full justification." 2017-01-11 08:24:08 +00:00
Felipe Leme
6d553874be YAMAFFR - Yet Another Major AutoFill Framework Refactoring
- Explicitly split View methods into Assist and AutoFill methods, rather
  than use an overloaded method that takes flags.
- Simarly, renamed ASSIST_FLAG_SANITIZED_TEXT and
  ASSIST_FLAG_NON_SANITIZED_TEXT flags to
  AUTO_FILL_FLAG_TYPE_FILL and AUTO_FILL_FLAG_TYPE_SAVE respectively.
- Created a AutoFillUI class to host the auto-fill bar and other UI
  affordances.
- Moved the temporary notifications to AutoFillUI (eventually that
  class will host the real UI).
- Moved FillData to android.app.view.autofill package.
- Split IAutoFillCallback in 2 (IAutoFillAppCallback and
  IAutoFillServerCallback, residing at the app and system_server
  respectively), so service cannot fill the app directly (which lets
  the framework control the UI).
- Moved assist's IResultReceiver to AutoFillServiceImpl so
  system_server can act as a mediator between the AutoFillService
  implementation and the app being auto-filled.
- Replaced FillData and FillableInputFields by a bunch of new objects:
  - FillResponse contains a group of Datasets, each representing
  different values
    that can be used to auto-fill an activity (for example, different
    user accounts), optional id of fields the service is interested
    to save, and an optional bundle for service-side extras.
  - Dataset contains a name, Fields, and an optional bundle for
    service-side extras.
  - Fields contain an AutoFillId (parcelable) and a value (Bundle)
- Changed the temporary notifications to emulate the new workflow:
  - Initial notification requests the auto-fill data but do not
    auto-fill.
  - Once service calls back, a new notification is shown with the
    results.
  - Then if the user selects a dataset, the activity is auto-filled
    with it.
  - It also shows a notification to emulate what can be saved.
- Created an VirtualViewDelegate for views that uses a virtual
  hierarchy for assist data.
- Added new methods on ViewStructure to add children with virtual ids.
- Added 2 methods on View to support auto-fill:
  - autoFill(Bundle) to auto-fill the view.
  - getAutoFillType() to return how the view can be auto-filled.
- AutoFillType defines the input fields that support auto-fill:
  - Text fields (like EditText)
  - Toggle fields (like CheckBox)
  - Lists (like RadioGroup)
- AutoFillType can also have a sub-type representing its semantic (for
  now only text fields have it, and it's the same as getInputType()).
- etc :-)

Bug: 31001899
Test: manual verification
Change-Id: I2dd2fdedcb3ecd1e4403f9c32fa644cb914e186f
2017-01-10 12:50:47 -08:00
TreeHugger Robot
a2b61657c4 Merge "Add @Nullable to CompoundButton#setOnCheckedChangeListener()." 2017-01-09 18:33:44 +00:00
Seigo Nonaka
09da71a6dc Introduce full justification.
Adds a new get/setJustify API to TextView and StaticLayout.Builder for
justification, and fully justifies text when it's enabled.

This is based on a patch by Raph Levien (raph@google.com).

Bug: 31707212
Test: Manually done and CTS will introduced with
      I0f3bbf39d60a66b71b30e1351f7c741208f05dce passes.
Change-Id: Icbfab2faa11a6a0b52e6f0a77a9c9b5ef6e191da
2017-01-05 18:14:15 +09:00
Phil Weaver
776afc212e Provide hint text to accessibility.
Bug: 30025621
Test: Adding CTS tests in linked CL.
Change-Id: Ib873352704a23c733a5eac36030a88fc55dc9b04
2016-12-27 13:58:29 -08:00
Svetoslav Ganov
016c9c8cb5 [DO NOT MERGE] Prevent crash from early Toast surface destruction.
To understand this change it's first helpful to review Toasts.
The ViewRoot is constructed on the client side, but it's added,
to a window token controlled by the NotificationManagerService.
When we call NotificationManagerService#cancelToast, the system
will remove this window token. With the window token removed,
the WindowManager needs to destroy the surface to prevent orphaned
windows. If we destroy the Surface before removing the toast on the
client side however, we've never asked the ViewRoot to stop rendering
and we could have a crash. To solve this we just have to ensure we call
removeView before cancelToast.

Bug: 31547288
Bug: 30150688

Change-Id: Ic7e8914a7fb2134a8b9e0c2f3810d7f075c8391e
2016-12-20 15:15:29 -08:00
Roozbeh Pournader
edef8505cb Merge "Expand characters temporarily skipped in spellchecking" 2016-12-20 19:36:54 +00:00
TreeHugger Robot
6fc806b56c Merge "Fix casting issue in use of ICU Measures" 2016-12-20 19:31:10 +00:00
TreeHugger Robot
19e2fb57c9 Merge "Implement requestKeyboardShortcuts for PopupDecorView" 2016-12-20 15:38:27 +00:00
Roozbeh Pournader
63a13cf754 Fix casting issue in use of ICU Measures
Bug: 19418509
Bug: 33670388
Bug: 33750033
Test: manual
Change-Id: I286cfed0cfe34166bd1fd1982089a11eb556fc44
2016-12-19 16:03:30 -08:00