Commit Graph

7625 Commits

Author SHA1 Message Date
Mihai Popa
2d6b40b821 [Magnifier-32] Do not magnify outside selection
Currently, for selection, if we move one handle towards the other, the
moving handle will stop when the selection becomes 1 character long.
However, the magnifier would continue to follow the finger after this,
no longer being helpful for the selection.

This CL fixes this, by replicating what happens when the magnifier
reaches the end of the line also for the case when it reaches the other
handle.

Bug: 72314536
Test: manual testing (both English and Arabic)
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I5bde622421c7fb8ecce0ea00f0d8d2af7aa72cf4
2018-03-08 15:44:15 +00:00
Mihai Popa
dfc752bc74 [Magnifier-31] Do not magnify outside current line
Currently, after the cursor is reaching the end of a line, the magnifier
keeps following the finger even if the cursor cannot move anymore.

This CL limits the movement of the magnifier, ensuring it stays between
the bounds of the text line. Also, when the finger gets too far from the
end of the line, we dismiss the magnifier. We consider it went too far
when the cursor is not visible anymore inside the magnifier.

Bug: 72314536
Test: manual testing (both English and Arabic)
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I8dafba1fc8e7b8e482526e818831ece2ee20ac27
2018-03-08 15:43:03 +00:00
Mihai Popa
e1b93ddcbd [Magnifier-29] Expose size and zoom in the API
The CL exposes the size and the zoom of the magnifier in the public API.
These are required for implementing a number of UX requests in WebView
and Chrome - see the two bugs referenced.

Also, the CL fixes a bug in the #getContent() TestApi, which was
returning the bitmap before (instead of after) scaling.

Bug: 70608551
Bug: 72314536
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Idc583b923010d7dca075b05b6f4dbafa74cfec1f
2018-03-06 14:53:01 +00:00
Jin Seok Park
a986a96d30 Merge "MediaControlView2: Hide API for customization" 2018-02-27 08:00:30 +00:00
TreeHugger Robot
255ed5cbdc Merge "[Magnifier-26] Wire up frame callback for realsies" 2018-02-27 02:13:46 +00:00
Jaewan Kim
6cc1a5de46 MediaSession2: Unhide APIs
Bug: 64098437
Test: make update-api
Change-Id: Ib73a32b422502cef324869356d56acaa7c48b219
2018-02-27 09:58:03 +09:00
Mihai Popa
9568800d90 [Magnifier-26] Wire up frame callback for realsies
Test: none yet
Bug: 73810478
Bug: 72041926
Change-Id: I7154ed4b3d2cd820dc8c8ff55eed130be87d1606
2018-02-26 11:23:27 -08:00
Jin Seok Park
0d636bfe29 MediaControlView2: Hide API for customization
Customization will be supported in the next release. This CL hides
the public API that is needed for customizing MediaControlView2.

Test: build
Change-Id: Ie8132f70f2dc5bc3fbcf73c1e39edd9d5f8cb3f6
2018-02-27 01:50:10 +09:00
TreeHugger Robot
2425752026 Merge "[Magnifier-25] Fix race condition after #dismiss" 2018-02-23 12:50:37 +00:00
Jin Seok Park
b9f6febce4 MediaControlView2: Add Support for Ad
Add APIs for getting/setting MediaMetadata2 in oder to add support
for Advertising media type.

Bug: 73136129
Test: run VideoViewTest.apk
Change-Id: Iab8e23c1f02f4e2df62a6732112b233541f8f35c
2018-02-23 05:33:33 +00:00
Mihai Popa
39a7133893 [Magnifier-25] Fix race condition after #dismiss
The CL adds synchronization around the InternalPopupWindow instance
used, between the main thread and the thread that handles pixel copy
results. This comes to fix a potential null pointer exception that
might occur after a #dismiss().

Bug: 73765118
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I8a8feb02f3ee418597ce3eee50db77b4b67e462e
2018-02-22 19:30:24 +00:00
Mihai Popa
acd4e6de6e Merge changes from topic "magnifier_sync_movement"
* changes:
  [Magnifier-24] Add completion callback TestApi
  [Magnifier-21] Rate-limit drawings to renderer
  [Magnifier-20] Raw Surface instead of PopupWindow
2018-02-22 12:03:01 +00:00
TreeHugger Robot
00ddbbc8c3 Merge "Don't end transitions on a detached window, prevent crash in WindowId" 2018-02-21 21:26:36 +00:00
Mihai Popa
2ba5d8e8e8 [Magnifier-24] Add completion callback TestApi
The CL adds a TestApi callback mechanism which enables CTS tests to know
when magnifier operations have completed. This is required since
the magnifier is using an auxiliary thread (different from the main
thread) to do work.

Bug: 72041926
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I44f324297b63910d19d60bd7462e9aee8d8a4f3e
2018-02-21 18:29:48 +00:00
Mihai Popa
8b78910635 [Magnifier-21] Rate-limit drawings to renderer
Previously, we would make a renderer draw whenever a pixel copy
completes. Because of this happening more than once per view frame,
magnifier frames were being dropped or queued up and displayed later,
which was consequently leading to the magnifier movement getting out of
sync with the updates to its content.

This CL changes the magnifier to be rendered from a draw job post'd to
the UI thread queue. This way, multiple magnifier updates (the ones
already pending in the UI thread queue when the draw job is added) are
batched together in a single draw, naturally rate-limiting the draws we
send to the magnifier renderer by the number of frames of the magnified
view - this only holds when the user of the magnifier sends updates as a
result of user interaction or when the magnified view is drawn.

Also, previously the pixel copy finished events were post'd to the UI
thread. Since they were not post'd as async messages, they would have to
wait at frame barriers before being executed. This CL creates a
dedicated thread for them to be post'd, to avoid this from happening.

Bug: 72041926
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I89563a341a74e958f903eff2d470c6c33fb203ef
2018-02-21 18:29:38 +00:00
Mihai Popa
78cab5a596 Merge "[Magnifier-23] Fix invisible cursor in magnifier" 2018-02-21 11:51:34 +00:00
Narayan Kamath
81945916f1 Merge "Remove uses of libcore.util.Objects.hashCode / equals." 2018-02-21 09:34:42 +00:00
TreeHugger Robot
0f5fd79a96 Merge "VideoView2: Remove redundant listeners" 2018-02-21 00:27:13 +00:00
Seigo Nonaka
e68ba070bb Merge "Reorganize MeasuredText API (2nd)" 2018-02-20 21:14:53 +00:00
Alan Viverette
6d89f48255 Don't end transitions on a detached window, prevent crash in WindowId
A WindowId's token should never be null, but let's avoid getting into
that situation in the first place.

Fixes: 70015590
Test: manual, cannot reliably repro in CTS test
Change-Id: I378ba9ba822ecc445d3b8de265b5ec0d20a12dd3
2018-02-20 15:11:58 -05:00
Phil Weaver
6ef5bbc9b1 Merge "Get text positions from transformed text" 2018-02-20 17:32:27 +00:00
Mihai Popa
a4e39c4f59 [Magnifier-23] Fix invisible cursor in magnifier
Previously, if the magnifier was triggered when the cursor was invisible
between blinks, the cursor would remain invisible until its position
first changed as a result of user dragging. This CL fixes this, by
forcing the cursor to become visible when the magnifier is triggered.

Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Bug: 72314929
Bug: 63531115
Change-Id: I95dd0c2474f1cd1695ff3083e062ee38867b8a0c
2018-02-20 17:22:03 +00:00
Insun Kang
a35d1b1946 VideoView2: Remove redundant listeners
Bug: 73598418
Test: build
Change-Id: Ibc79fde985a98c2323c2c63feef874a90e084652
2018-02-20 01:31:35 +09:00
Mihai Popa
4bcd4d40ff [Magnifier-20] Raw Surface instead of PopupWindow
Since the movement of PopupWindows is handled by the global window
manager, using one does not provide synchronization guarantees between
the window movement and its view tree rendering. In the case of the
magnifier this was producing a shaky-text effect, when the window was
moved in one frame, but the content was only updated in the following
one (although the movement and content update were issued during the
same #show operation on the UI thread).

This CL abandons the usage of a PopupWindow for the magnifier, in favour
of a raw Surface whose movement can be controlled using the deferred
transactions API. This way, we can defer the surface movement until the
frame when the updated content is rendered. The allocated magnifier
surface is slightly bigger than the magnifier content to have space for
drawing the elevation. We obtain a native elevation by using a
RenderNode to draw the content of the magnifier.

Bug: 72041926
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Icb8ecf48a2f528e06790db95d54575f2ae119747
2018-02-19 14:32:15 +00:00
Narayan Kamath
607223f3b7 Remove uses of libcore.util.Objects.hashCode / equals.
Use public API in java.util.Objects instead.

Test: make
Change-Id: I413280f254743a2efa2640a2194693aeb5980605
2018-02-19 14:12:01 +00:00
TreeHugger Robot
944836c6c7 Merge "TextClassifier: Support service intents." 2018-02-19 11:04:16 +00:00
Seigo Nonaka
beafa1f9d2 Reorganize MeasuredText API (2nd)
This is 2nd attempt of I7db9e2ca4db68a16648cfb8fcf63555f501304c2

This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
  (It can not be used for TextView)

Bug: 67504091
Bug: 72861572
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
    CtsWidgetTestCases:TextViewFadingEdgeTest \
    FrameworksCoreTests:TextViewFallbackLineSpacingTest \
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
    CtsTextTestCases

Change-Id: Ie73bce52c6c673cda58973ddad04627a7cf2e5e9
2018-02-16 19:42:00 -08:00
Abodunrinwa Toki
2f19b92c75 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
2018-02-17 01:30:55 +00:00
Phil Weaver
cc595bb4a7 Get text positions from transformed text
Using the non-transformed text is bad because the
transformed text is what's actually on the screen,
so it is the thing whose position is relevant.

Bug: 69044691
Test: Updating a11y cts test to use an all-caps
german strong s, which causes the transformed text
to be longer than the original text. That changed
test fails without this fix.

Change-Id: Ia7aac3b4322ffb48f10771f4d1b33c80ca28b120
2018-02-16 16:23:35 -08:00
TreeHugger Robot
243239504a Merge "Always remeasure weighted children, even if there's no excess space" 2018-02-16 22:53:42 +00:00
Alan Viverette
9049fd996a Always remeasure weighted children, even if there's no excess space
Bug: 72630654
Test: atest LinearLayoutTest
Change-Id: Ie9637950aef32f080b8284a63003eb61c0a88841
2018-02-16 14:47:05 -05:00
TreeHugger Robot
f759af6f3b Merge "Optimization: don't call AFM.notifyValueChanged() when value didn't change." 2018-02-16 18:24:18 +00:00
Felipe Leme
27d0446d08 Optimization: don't call AFM.notifyValueChanged() when value didn't change.
Test: manual verification
Test: atest CtsAutoFillServiceTestCases

Bug: 73078981

Change-Id: Ib0a40d4ab0e6f4a1300622fa4d7a2f6026aa98a1
2018-02-16 08:23:17 -08:00
Siyamed Sinir
813d17d67e Update text OWNERS with set noparent
Test: N/A
Change-Id: Ic3d83909a780ae3e3bac81d39719ad60435d95f2
2018-02-15 15:14:50 -08:00
Dake Gu
eb46f6fc32 Merge "autofill: render autofill ui in fullscreen for tv" 2018-02-15 20:39:24 +00:00
Dake Gu
9f879a2da4 autofill: render autofill ui in fullscreen for tv
When IME and autofill are both showing on TV, it's confusing which
window has the input focus. This CL changes autofill window to
full screen for TV.

Bug: 72122929
Test: Manual tested on TV with github example. Manually tested on
phone that UI doesn't change.

Change-Id: Id97b6389523b2ee744d02f5bc7847b307b0b29e4
2018-02-14 13:02:52 -08:00
Seigo Nonaka
4e90fa262d Revert "Reorganize MeasuredText API"
The last change needs more discussion and found some edge cases. Revert and make small step-by-step changes.

Bug: 73091756

This reverts commit 7fd36d19e3.

Change-Id: I89ff52a70cf6a5d6c553afa20f83719e1f9eb726
2018-02-14 17:03:16 +00:00
Seigo Nonaka
7fd36d19e3 Reorganize MeasuredText API
This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- PrecomputedText is no longer a Spanned.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
  (It can not be used for TextView)

Here is a performance scores: (median, walleye-userdebug, N=20)

StaticLayout creation time (w/o patch -> w/ patch)
 PrecomputedText Balanced Hyphenation  :    743,615 ->    737,145: (-0.9%)
 PrecomputedText Balanced NoHyphenation:    551,544 ->    542,715: (-1.6%)
 PrecomputedText Greedy Hyphenation    :    500,343 ->    499,601: (-0.1%)
 PrecomputedText Greedy NoHyphenation  :    497,987 ->    492,587: (-1.1%)
 RandomText Balanced Hyphenation       : 19,100,592 -> 19,135,289: (+0.2%)
 RandomText Balanced NoHyphenation     :  8,015,088 ->  7,954,260: (-0.8%)
 RandomText Greedy Hyphenation         :  7,950,915 ->  7,877,424: (-0.9%)
 RandomText Greedy NoHyphenation       :  7,939,337 ->  7,863,471: (-1.0%)

PrecomputedText creation time (w/o patch -> w/ patch)
 NoStyled Hyphenation                  : 18,935,638 -> 18,925,422: (-0.1%)
 NoStyled Hyphenation WidthOnly        : 18,469,726 -> 18,978,413: (+2.8%)
 NoStyled NoHyphenation                :  7,940,792 ->  7,919,127: (-0.3%)
 NoStyled NoHyphenation WidthOnly      :  7,463,230 ->  7,922,643: (+6.2%)
 Styled Hyphenation                    : 14,822,501 -> 14,809,017: (-0.1%)
 Styled Hyphenation WidthOnly          : 13,891,770 -> 14,656,617: (+5.5%)
 Styled NoHyphenation                  : 14,511,134 -> 14,301,503: (-1.4%)
 Styled NoHyphenation WidthOnly        : 13,495,345 -> 14,264,314: (+5.7%)

StaticLayout draw time (w/o patch -> w/ patch)
 PrecomputedText NoStyled              :    663,974 ->    661,610: (-0.4%)
 PrecomputedText NoStyled WithoutCache :    648,294 ->    648,766: (+0.1%)
 PrecomputedText Styled                :    879,322 ->    852,770: (-3.0%)
 PrecomputedText Styled WithoutCache   :  1,084,570 ->  1,110,147: (+2.4%)
 RandomText NoStyled                   :    565,682 ->    555,435: (-1.8%)
 RandomText NoStyled WithoutCache      :  9,070,533 ->  9,064,825: (-0.1%)
 RandomText Styled                     :  2,955,202 ->  2,962,008: (+0.2%)
 RandomText Styled WithoutCache        : 12,242,325 -> 12,228,573: (-0.1%)

Bug: 67504091
Bug: 73091756
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
    CtsWidgetTestCases:TextViewFadingEdgeTest \
    FrameworksCoreTests:TextViewFallbackLineSpacingTest \
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
    CtsTextTestCases
Change-Id: I7db9e2ca4db68a16648cfb8fcf63555f501304c2
2018-02-12 20:50:41 -08:00
TreeHugger Robot
9036a88d95 Merge "Logging for linkify selections" 2018-02-12 14:44:35 +00:00
Siyamed Sinir
a454df9c06 Merge "Fix Editor ActionMode content rectangle" 2018-02-09 21:57:14 +00:00
Siyamed Sinir
fdbc5ee763 Fix Editor ActionMode content rectangle
We have made a mistake in a previous change and change the single cursor
selection bounds in a wrong way. 

Test: atest CtsWidgetTestCases:TextViewTest
Bug: 72244890
Change-Id: Ie597ff5a9f82e04d673534e35c49da513132cd5b
2018-02-09 11:24:16 -08:00
Siyamed Sinir
bc48bd8f61 Merge "Remove Toki from text OWNERS files" 2018-02-08 18:55:17 +00:00
Clara Bayarri
d293d6d4b6 Remove Toki from text OWNERS files
Test: none
Change-Id: I9e444318df4a77ee06949d5141667f6c00d9a508
2018-02-08 11:14:10 +00:00
TreeHugger Robot
98517be352 Merge "Revert "Remove @hide from ViewGroup debug methods"" 2018-02-06 22:45:40 +00:00
Richard Ledley
db96b03495 Merge "Remove selection on nonselectable text (which would be there if a user tapped Linkified text) if a TextView loses focus." 2018-02-06 21:34:45 +00:00
TreeHugger Robot
8744f57386 Merge "[Magnifier - 19] Add non-basic CTS tests" 2018-02-06 18:53:33 +00:00
Richard Ledley
5f2f820c81 Remove selection on nonselectable text (which would be there if a user tapped Linkified text) if a TextView loses focus.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest

Bug: 67629726
Change-Id: Ifc3039f0c814c422b2d727f837ca9c88abc2ebe8
2018-02-06 18:09:49 +00:00
Mihai Popa
137b5843d6 [Magnifier - 19] Add non-basic CTS tests
This CL adds two @TestApis required for the magnifier CTS tests.

Bug: 69407609
Bug: 63531115
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I49e53223730f5fbbf353f6574429c1b1a3d877a1
2018-02-06 15:14:44 +00:00
David Ogutu
93ac6d01bb Fix TimePicker keyboard UI num digits for min
Force the minutes to always format to 2 digits. This is a temporary fix
that's not quite fully Locale aware but fixes UI issue. Will need to
refactor code to seperate Locale info, share code with non-keyboard UI
and use more native Locale functions to determine number of digits.

Test: Manual https://drive.google.com/file/d/1iabh2Zzl0YRhj17gbVKr8GvVDXEHUnWI/view?usp=sharing
Bug: 72041032
Change-Id: I0eb479b9aece4726db7bf7fba04dc50ad0f175c5
2018-02-06 09:22:20 -05:00
Alan Viverette
2d7771ca60 Revert "Remove @hide from ViewGroup debug methods"
This reverts commit 1244815e8f.

Bug: 71555179
Test: make
Change-Id: Ibfd97660e5f91fc7fac13b66efa8aa587ba20b4e
2018-02-05 19:14:14 +00:00