Commit Graph

7644 Commits

Author SHA1 Message Date
Mihai Popa
e301746a0e [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
(cherry picked from commit dfc752bc74)
Merged-In: I8dafba1fc8e7b8e482526e818831ece2ee20ac27
2018-03-09 13:57:35 +00:00
Mihai Popa
17ea30584a [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
(cherry picked from commit e1b93ddcbd)
Merged-In: Idc583b923010d7dca075b05b6f4dbafa74cfec1f
2018-03-09 13:32:20 +00:00
Sungsoo Lim
ec75d51e74 VideoView2: Remove setRouteAttributes
Being consistent, create route player internally and do not expose it
since VideoView2 creats a MediaPlayer inside and do not expose it.

Bug: 72527212
Test: manually with VideoViewTest
Change-Id: I6db3bc668f6ab77587fed49b2d34611bc3c30465
2018-03-08 13:55:21 +09:00
Evan Rosky
758a6523bc Don't consume all BACK keys in SearchView
If SearchView is the first focusable, it will always get focus
(in non-touch-mode) when it tries to clearFocus on BACK pressed.
This lead to a situation where SearchView always consumed the
BACK key leaving users unable to leave some activities.

It looks like this was done so that pressing back both closed the
auto-correct popup AND the ime (whereas without reimplementing
onPreIme, it would require 1 back-press to close the auto-correct
popup and then a subsequenty press to close the IME). It also,
however, tried to clearFocus as well.

This change only consumes the Back press if the auto-correct popup
is open (to have the same effect of BACK closing both the popup
and the IME at the same time). It ignores the back press otherwise.
If there is no pop-up, this results in the BACK being handled by
the ime and thus hiding it. Otherwise, back is not consumed.

The only effective difference is that the SearchView remains
focused now.

Bug: 73181998
Test: SearchView CTS tests still pass. Back can now exit test-app
      once IME is hidden.

Change-Id: I3fe687b5344300b86131f44a1c9798cd736955bd
2018-03-07 22:08:18 +00:00
TreeHugger Robot
0efaf2088d Merge "Introduce new perf test for TextView with precomputed text" into pi-dev 2018-03-07 21:40:45 +00:00
Seigo Nonaka
d15f04ef69 Introduce new perf test for TextView with precomputed text
Here is an example of perf test result:

TextView new layout creation time:
  PrecomputedText           :    740,173
  PrecomputedText_Selectable: 17,727,649
  RandomText                : 17,130,685

TextView onDraw time:
  PrecomputedText           :  1,471,075
  PrecomputedText_Selectable: 31,971,393
  RandomText                : 17,667,572

TextView onMeasure time:
  PrecomputedText           :    177,669
  PrecomputedText_Selectable: 17,773,204
  RandomText                :  6,296,358

TextView setText (w/o layout creation) time:
  PrecomputedText           :     91,858
  PrecomputedText_Selectable:    152,665
  RandomText                :     11,130

Bug: 72998298
Test: ran perf test
Change-Id: I69af74ba743499bc444c441c1472fb19878c2eec
2018-03-07 11:34:54 -08:00
Seigo Nonaka
e1ffb54167 Throw an exception in case of parameter mismatch of precomputed text
If the given precomputed text is not compatible with the TextView,
reject the text by throwing IllegalArgumentException.

Bug: 73091756
Test: atest CtsWidgetTestCases:EditTextTest
    CtsWidgetTestCases:TextViewFadingEdgeTest
    FrameworksCoreTests:TextViewFallbackLineSpacingTest
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
    CtsTextTestCases FrameworksCoreTests:android.text
    CtsWidgetTestCases:TextViewPrecomputedTextTest

Change-Id: I4fbf89a5f1409e8eefdeb9f208f9a3758220fe1a
(cherry picked from commit 3a0787af5e)
2018-03-07 18:30:27 +00:00
Richard Ledley
27db81baf8 Don't use highlighting in non-selectable text. Also fixes potential discrepancy in indexes for Linkified entities.
Test: atest CtsWidgetTestCases:TextViewTest FrameworksCoreTests:android.widget.TextViewActivityTest CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest FrameworksCoreTests:android.view.textclassifier.TextLinksTest

Change-Id: Ib479afa9af2b921e6a217a34322a766561867b79
(cherry picked from commit bda1d9e740)
2018-03-06 18:33:20 +00:00
Insun Kang
7c5b02dff8 VideoView2: Move MediaContolView2's hidden constant
Bug: 74173212
Test: VideoViewTest app
Change-Id: Ic91e0b0bfb910d555c1dbe77f028a017f2a18b79
(cherry picked from commit a0fdcc97f0)
2018-03-06 05:51:56 +00:00
TreeHugger Robot
f8f0c8df78 Merge "Revert "Introduce InputConnection#reportLanguageHint()"" 2018-03-03 23:36:37 +00:00
Yohei Yukawa
4397591f3d Revert "Introduce InputConnection#reportLanguageHint()"
This reverts commit e77386e8fb [1].

Reason for revert:
The protocol is not yet ready to be exposed and we are still unsure
what is the best approach.

 [1]: Ie86edafd1ed68b58f702116f561fc448fdbb57a8

Bug: 7031513
Bug: 72522601
Fix: 74087970
Test: atest CtsInputMethodTestCases
Change-Id: Ia61dc9b3d5b116199382994430fb16ee804942b3
2018-03-02 17:35:18 -08:00
TreeHugger Robot
b60ca84e23 Merge "Fix toast lifetime" 2018-03-02 20:58:34 +00:00
Seigo Nonaka
904fcdad41 Fix CTS TextViewTest
Id65a7e36487375f0e3a2c2da44ad8d7c5ea49734 changes the typeface
associated with the TextView. It used be null if no attribute was set,
but after above change, it is now Typeface.DEFAULT.

The typeface is null means Typeface.DEFAULT but there is an expectations
in CTS that getTypeface must return null if no attribute was set.

To keep this behavior, call setTypeface with null if no font weight value
was set.

Bug: 74080879
Test: atest CtsWidgetTestCases:EditTextTest
    CtsWidgetTestCases:TextViewFadingEdgeTest
    FrameworksCoreTests:TextViewFallbackLineSpacingTest
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
    CtsTextTestCases FrameworksCoreTests:android.text

Change-Id: Ic91827bbeed8a3a4b148dd8d305c78e384407ab0
2018-03-01 14:29:34 -08:00
Robert Carr
99742734e3 Fix toast lifetime
In NotificationManagerService#cancelToast we have been calling
WindowManagerService#removeWindowToken with 'removeWindows'=true. This
is allowing for Surface destruction without any sort of synchronization
from the client. Before the call to removeWindowToken we are emitting
a one-way hide call to the Toast client. As a solution to the lifetime
issue we have the client callback to let us know it has processed the
hide call (and thus stopped the ViewRoot). On the server side we also instate
a timeout. This mirrors the app stop timeout. All codepaths I could find
leading to this sort of situation where a client is still rendering
in to a toast following the total duration expiring seem to indicate a hung
client UI thread.

Bug: 62536731
Bug: 70530552
Test: Manual. go/wm-smoke
Change-Id: I89643b3c3a9fa42423b498c1bd3a422a7959aaaf
2018-03-01 12:43:40 -08:00
Abodunrinwa Toki
db8fc314d2 Associate TCconstants with the TCM instead of TCImpl
Also updates flags list.

Bug: 72946306
Bug: 72946123
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationConstantsTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: I8af9d3d1da01836fbadcbbf6ce7c1c0db7456a05
2018-02-28 14:35:49 +00:00
TreeHugger Robot
58c83fa7c8 Merge "Unhide VideoView2 APIs" 2018-02-28 10:43:38 +00:00
TreeHugger Robot
dc66a1d891 Merge "Unhide MediaControlView2 APIs" 2018-02-28 10:28:25 +00:00
Insun Kang
b785faa1d7 Unhide VideoView2 APIs
Test: make update-api
Bug: 64293205
Change-Id: Ie57e3ea78dd623fc095c1ad5f270f3b97320f155
2018-02-28 08:45:37 +00:00
Jin Seok Park
a64d4b98b5 Unhide MediaControlView2 APIs
Test: make update-api
Bug: 64293205
Change-Id: Ia202a7fc1f8733cc2d95d13e7126916affe4f52e
2018-02-28 05:06:10 +00:00
TreeHugger Robot
bf6edacac9 Merge "New attribute textFontWeight for selecting weight in the font family" 2018-02-28 01:21:41 +00:00
Seigo Nonaka
e245116af3 New attribute textFontWeight for selecting weight in the font family
Note that AppCompatTextView doesn't work well with this attribute since
it overwrites the selected Typeface.

Bug: 63135308
Test: atest android.widget.cts.TextViewFontWeightTest
Change-Id: I76ee5e3007ea5f96249d2a0bfb66ff5975c62522
2018-02-27 11:39:13 -08:00
Mihai Popa
d870b880c5 [Magnifier-27] Make it more prominent
When used on views with a dark background, the magnifier does not really
stand out from the view, which is potentially confusing for users. This
CL mixes the magnifier content with 5% white in order to make the
magnifier more prominent on dark backgrounds. Also, the CL increases the
elevation of the magnifier window, useful in light backgrounds.

Bug: 70608551
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I7c6e4418b49b7fe0d69344668fa66d39417b4ecc
2018-02-27 14:36:27 +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