Commit Graph

6933 Commits

Author SHA1 Message Date
Abodunrinwa Toki
fafdb7372f Fix TextClassifier.getTextClassificationResult()
Gracefully handles situations where a default app cannot be found
to handle the intent.

1. If we can not find any app to handle the intent,
   do not include an "assist" menu item entry to fire the intent.
   Also, do not linkify the entry.
2. If we do not have a default app to handle the intent,
   show a generic title for apps that will handle the intent
   and do not include an icon.

In the ideal case where we find a default app to include the intent,
show the app's (preferably activity's) title and icon.

Test: Manually tested. There's an AI to write more automated tests.
Bug: 34777322
Bug: 34927631
Change-Id: Ia94efbbdda3da8f181fac9228cd2d3a76cb727d3
2017-02-02 20:35:51 +00:00
Felipe Leme
5523f9a2fc Merge "Improved AutoFill Save workflow." 2017-02-02 02:05:32 +00:00
Felipe Leme
0200d9ea15 Improved AutoFill Save workflow.
Currently, the onProvideAutoFillStructure() methods can be called
twice: to auto-fill an activity and to save the activity's data
in the service.

The problem with this approach is that when the save workflow is
called, the activity might have been gone. Hence, a proper approach
is to keep the initial AssistStructure data in the system_service
memory, watch for view changes, and then passed the new structure
back to the AutoFillService.

A side effect of this change is that we need another way to determine
if the view is sanitized or not. For "standard" views, that will be
defined based on whether the view content come from a resource or not,
but that logic is not implemented yet (for now, all views will be
considered sanitized, except for TextView passwords). For "custom"
views (such as WebView), this logic is responsibility of the view
implementation, through the newChild() method, which now takes a
flag (whose value could be AUTO_FILL_FLAG_SANITIZED for sanitized
views).

The SaveCallback.onSuccess() method was simplified: it does
not need a list of saved ids anymore the auto-fill UI will not use it
anymore.

Another side effect is that the Save notification is gone - until
it's attached again, it can be test by using:

    adb shell cmd autofill save

Finally, hook AutoFillUI on ACTION_CLOSE_SYSTEM_DIALOGS events.

BUG: 33269702
BUG: 31001899
Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I907a7e21d1b3cd1ab6dec3a08d144a52655da46f
2017-02-01 11:00:15 -08:00
Abodunrinwa Toki
8e332cc54b Merge "Ignore smart selection for multi-word selections." 2017-02-01 10:51:06 +00:00
Abodunrinwa Toki
f9a81f352e Ignore smart selection for multi-word selections.
Test: See: Ic273fd68f300671d8e7c0dabe4a3ae9470056fcc
Bug: 34831428
Bug: 34778597
Bug: 34778381
Change-Id: Ib15828996081a72f02f5075acac1f2f6c51d3601
2017-02-01 00:17:59 +00:00
TreeHugger Robot
7b552516ae Merge "Implicitly cast views obtained via View.findView methods" 2017-01-31 22:04:25 +00:00
TreeHugger Robot
a06155011e Merge "Fix crash in TextView getFont" 2017-01-31 17:56:10 +00:00
Yura
e2896febe4 Merge "Fix for endless loop in RelativeLayout." 2017-01-31 15:18:13 +00:00
Clara Bayarri
060332400d Fix crash in TextView getFont
The wrong TypedArray was being used to retrieve the value.

Bug: 34818260
Test: run cts -m CtsWidgetTestCases -t
android.widget.cts.TextViewTest#testFontResources_setInXmlStyle

Change-Id: I09334710b9b21f1397bc02d92d14b41fbc96178f
2017-01-31 12:15:50 +00:00
TreeHugger Robot
cf45c85297 Merge "Introduce set/getFontVariationSettings." 2017-01-31 05:46:27 +00:00
TreeHugger Robot
9f5d2b0886 Merge "Don't scroll popup parent in response to parent scrolling" 2017-01-30 18:31:21 +00:00
Yura
a354c4f156 Fix for endless loop in RelativeLayout.
getRelatedView(int[] rules, int relation)

is stuck in the loop, when a view is GONE, and references itself.
There is already a check in:

  getSortedViews(View[] sorted, int... rules) {

to make sure there are no loops of ViewA -> ViewB -> ViewA

BUT, there was a change made in findRoots(int[] rulesFilter)

to "Remove exception throw when a view has a self dependency
inside a RelativeLayout." so this means we must allow this case.

Other change git commit sha: da3003e1d7

Bug: http://b/android.com/231353
Change-Id: Icc26b86ebbb19e482c3afe6a39db996ec493586d
2017-01-30 18:10:34 +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
Seigo Nonaka
9ff994d988 Introduce set/getFontVariationSettings.
This is 2nd attempt of I249d464f8cdaa56017a987588b94ed685aadeb58.
The original CL was reverted due to conflicting with another CL submitted
before.
Nothing has changed except for following class name changes.

Here is the original commit message of reverted change.

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: I9cdfbdecc87c995d805096883ef2652768c6c21e
2017-01-30 20:22:41 +09: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
Alan Viverette
06c2fffdaa Implicitly cast views obtained via View.findView methods
Removes all explicit casts from android.widget classes. Also @removes
methods on ListView that were overriding @hidden methods and should
never have been exposed as public API.

Bug: 24137209
Test: make
Change-Id: I6ccfc6f001b355c4880f2b54e1a5474df78d6228
2017-01-27 13:13:45 -05: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