Commit Graph

7679 Commits

Author SHA1 Message Date
TreeHugger Robot
ebd87bf395 Merge "Use on-screen text in a11y text changed event" into pi-dev 2018-03-28 02:06:27 +00:00
Phil Weaver
092f754397 Use on-screen text in a11y text changed event
The beforeText in a text changed event was coming from
the underlying CharSequence, not what was on the screen.
As a result, it was not sent for password fields. Now
we just provide whatever is on the screen, which is
obfuscated to the same degree it is for a user looking
at the screen.

Bug: 75324441
Test: Verified with password field in TalkBack sample app.
Also atest CtsAccessibilityServiceTestCases

Change-Id: Ib7a10313d2f9d0e44d2052e81e47f19967a67bc4
2018-03-27 17:07:24 -07:00
Mihai Popa
894469ce0e [Magnifier-35] Do not show when text is large
There is no point in displaying the magnifier when the text is large
enough. In this CL we are using the font metrics of the TextView to
decide whether the magnifier should be displayed or not.

Bug: 70608551
Test: manual testing
Change-Id: Icb2fb4412b6b930dfb3322e51fd0139152cf9d39
2018-03-27 15:24:11 +00:00
TreeHugger Robot
a1ff74c68d Merge "Stop using DynamicLayout in case of non selectable PrecomputedText" into pi-dev 2018-03-27 00:10:11 +00:00
TreeHugger Robot
d982f561cc Merge "Fix random SmartLinkify-related TextView bugs." into pi-dev 2018-03-26 23:21:37 +00:00
Seigo Nonaka
0c5daa19e3 Stop using DynamicLayout in case of non selectable PrecomputedText
DynamicLayout is required when
- The text is Editable.
- The selection is enabled on TextView.

This CL stops using DynamicLayout when the TextView is not selectable
TextView and the input text is PrecomputedText.

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

Change-Id: Ic4a66ad3ed8868570735e3199879b74132a8c4aa
2018-03-26 14:01:04 -07:00
Abodunrinwa Toki
520969191b Fix random SmartLinkify-related TextView bugs.
1. Preserve selection when the TC times out. (See: SelectionActionModeHelper)

2. Fix highlight/toolbar flicker when tapping on a smart link.
   - Highlight flicker happening because we reset the selection while in
     the process of starting a link action mode.
     i.e. onLinkDown: show highlight
          onLinkUp: start the link action mode asynchronously
	  onLinkUp: reset the selection to an insertion cursor*
	  onLinkActionModeStarted: reset the highlight
	  *Fix: Don't reset selection while starting a link action mode.
   - Toolbar flicker happening because the toolbar positions itself over
     the current selection. The way link highlights have traditionally
     been done is to set the selection to the links bounds*
     *Fix: Hide the toolbar for a few milliseconds when changing
     selection for smoother transition.

3. Fix Paste menu overriding link action mode toolbar after a recent
   "Copy" action. The Paste menu appearing is a feature. Whenever the
   user inserts a cursor after just copying some text, we show the Paste
   menu as a way to make it easy for the user to select the text.
   Because of the problem described in (2) above, changing the selection
   to an insertion triggers the Paste menu feature. Fixing (2) fixes
   this.

4. Fix IME popping up on non-selectable + focusable TextViews.
   See: imm.showSoftInput(...) in Editor. And see comment in the code
   around that. We should only pop up the IME for editable text.

Fixes: 73872461
Fixes: 75985239
Fixes: 76011461

Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: If9ddb7f4e6d4db480ba4a495a22f7f2924ab937e
2018-03-26 18:11:03 +01:00
Mihai Popa
953b134f2d [Magnifier-34] Keep magnifier inside its surface
Before this CL, the magnifier window was sometimes displayed partially
out of screen or overlapping with the system bar. This CL prevents this
issue by clamping the magnifier inside its parent surface, also taking
into account the system window insets of this surface.

Also, the CL fixes two kindof unrelated small bugs:
- remembers to reset the previous show and pixel copy coordinates on
  #dismiss()
- when clamping the pixel copy coordinates inside surface, consider the
  size of the copied content rather than the size of the window where
  this is scaled and then copied

Bug: 74234779
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Iec3404123145aa95b37c88f4fbfa3918cbf24f9d
2018-03-23 11:38:57 +00:00
Jean-Michel Trivi
d847d7d0a9 Merge "Hide Media*2 APIs" into pi-dev 2018-03-23 01:12:14 +00:00
Jean-Michel Trivi
3a582e73c1 Hide Media*2 APIs
Bug: 76121592
Test: make offline-sdk-docs
Change-Id: Ic5eba5ba0b3ef9f11c582ab6db7d8d61934941dd
2018-03-22 16:30:14 -07:00
TreeHugger Robot
02c8d1b07f Merge "Make PrecomputedText Spannable for supporting selection" into pi-dev 2018-03-22 23:21:54 +00:00
TreeHugger Robot
e9a7cb8158 Merge "Fix smart_linkify_enabled flag." into pi-dev 2018-03-22 22:56:58 +00:00
Abodunrinwa Toki
6563833cf3 Fix smart_linkify_enabled flag.
The flag should only ensure that smart linkify calls behave in the
legacy way instead of totally disabling linkify.
Also, to keep the flag consistent with smart_selection_enabled and
smart_text_share_enabled flags, the flag should only disable the
SmartLinkify (i.e. Linkify.addLinksAsync) feature not TextClassifier
APIs (i.e. TextClassifier.generateLinks).

Also fixes issue with non-focusable TextViews by firing the primary
action instead of showing the floating toolbar. (b/73156794)

Bug: 75967597
Bug: 73156794
Test: bit FrameworksCoreTests:android.text.util.LinkifyTest
Test: bit CtsTextTestCases:android.text.util.cts.LinkifyTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: manual - checked behaviour turning flag on/off
Test: manual - checked behaviour with TextView.setFocusableInTouchMode(true/false)
Change-Id: I541f60161b9cd63ce7e57235607500f2fb0841e7
2018-03-22 19:25:14 +00:00
Christofer Åkersten
6bd3ab6dc6 Remove unnecessary Context from ApiLoader
Bug: 76001644
Test: compile
Change-Id: I6ac81dac16374d90facfe33c68607c5c286b335f
2018-03-22 14:55:55 +09:00
kopriva
2285a662ea docs: fixing typo in reference document
am: 60b06bd217

Change-Id: Ie0a6380e8287d49b4d80f8742e51345372e5b8a9
2018-03-22 00:39:02 +00:00
Seigo Nonaka
a553477ddf Make PrecomputedText Spannable for supporting selection
This is 2nd attempt of I072dfd70b9a687d9c47e310d8cdb34f988fbb32e

The root cause of crashing is unexpected copying of NoCopySpan by
SpannableString constructor. To prevent crashing, stop copying
NoCopySpan by passing ignoreNoCopySpan=true to SpannableString
copy constructor.

The original commit message is following:

To support selectable TextView, make PrecomputedText spannable.
By this change, TextView start using DynamicLayout instead of
StaticLayout. DynamicLayout requires boundary rectangle of the
text, so this CL also adds getBounds method to PrecomputedText
which retrieves measured boundary box from native.

By this change, the selectable TextView performance for the
precomputed text 10x faster. On the other hand, the performacne
for the non-selectable text gets 2.5x slower. However, we concluded
that we accept this performance regression since it still 10 times
faster than non precomputed text.

Here is a precomputed text performance result of TextView.
android.widget.TextViewPrecomputedTextPerfTest:
  newLayout_PrecomputedText           :    736,130 ->  1,648,694: (+124.0%)
  newLayout_PrecomputedText_Selectable: 17,379,765 ->  1,700,146: (-90.2%)
  onDraw_PrecomputedText              :  1,274,921 ->  1,848,076: (+45.0%)
  onDraw_PrecomputedText_Selectable   : 17,367,238 ->  1,399,169: (-91.9%)
  onMeasure_PrecomputedText           :    752,875 ->  1,766,606: (+134.6%)
  onMeasure_PrecomputedText_Selectable: 17,647,842 ->  1,810,704: (-89.7%)
  setText_PrecomputedText             :     92,894 ->    135,471: (+45.8%)
  setText_PrecomputedText_Selectable  :    145,134 ->    215,757: (+48.7%)

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

Change-Id: Ie98c75d8b4ba962eaf0a544357b2ff1ade891118
2018-03-20 22:22:30 -07:00
kopriva
60b06bd217 docs: fixing typo in reference document
Test: make ds-docs

Bug: 36998786
Change-Id: I7b0f5623eec608436eacd5d27d63a3f6b41cc419
2018-03-20 20:42:59 -07:00
Siyamed Sinir
46c84bf237 Merge "Fix rounding error related to autoSize" into pi-dev 2018-03-19 22:15:31 +00:00
TreeHugger Robot
b3aec698e8 Merge "Revert "Make PrecomputedText Spannable for supporting selection"" into pi-dev 2018-03-19 19:02:34 +00:00
Seigo Nonaka
e887f4d2c1 Revert "Make PrecomputedText Spannable for supporting selection"
Crash on Sheets APp
This reverts commit 80ed5a35a9.

Bug: 75652829
Change-Id: I40ddd1b9754e74fbd90d7a029cce9c6a7ede0777
Test: Manual
2018-03-19 17:04:30 +00:00
Siyamed Sinir
948693ea28 Fix rounding error related to autoSize
setupAutoSize fills in the possible text sizes that can be generated
between a min and max value. In order to do that, it counts the number
of steps starting from minSize until maxSize. However, while counting
it rounds the initial value, which causes rounding error at the final
step.

Test: Change system font scale to 1.1 via
      adb shell settings put system font_scale 1.1
Test: atest android.widget.cts.TextViewTest

Bug: 73917559
Bug: 75266270
Change-Id: I61811db28ef01262bd48f5042d783d75c71c3614
(cherry picked from commit db86a6b047)
2018-03-17 04:27:37 +00:00
TreeHugger Robot
71ed54f377 Merge "Make PrecomputedText Spannable for supporting selection" into pi-dev 2018-03-16 15:43:46 +00:00
Seigo Nonaka
80ed5a35a9 Make PrecomputedText Spannable for supporting selection
To support selectable TextView, make PrecomputedText spannable.
By this change, TextView start using DynamicLayout instead of
StaticLayout. DynamicLayout requires boundary rectangle of the
text, so this CL also adds getBounds method to PrecomputedText
which retrieves measured boundary box from native.

By this change, the selectable TextView performance for the
precomputed text 10x faster. On the other hand, the performacne
for the non-selectable text gets 2.5x slower. However, we concluded
that we accept this performance regression since it still 10 times
faster than non precomputed text.

Here is a precomputed text performance result of TextView.
android.widget.TextViewPrecomputedTextPerfTest:
  newLayout_PrecomputedText                             :    736,130 ->  1,648,694: (+124.0%)
  newLayout_PrecomputedText_Selectable                  : 17,379,765 ->  1,700,146: (-90.2%)
  onDraw_PrecomputedText                                :  1,274,921 ->  1,848,076: (+45.0%)
  onDraw_PrecomputedText_Selectable                     : 17,367,238 ->  1,399,169: (-91.9%)
  onMeasure_PrecomputedText                             :    752,875 ->  1,766,606: (+134.6%)
  onMeasure_PrecomputedText_Selectable                  : 17,647,842 ->  1,810,704: (-89.7%)
  setText_PrecomputedText                               :     92,894 ->    135,471: (+45.8%)
  setText_PrecomputedText_Selectable                    :    145,134 ->    215,757: (+48.7%)

Verified no effects for other performance metrics:
android.widget.TextViewPrecomputedTextPerfTest:
  newLayout_RandomText                                  : 16,495,200 -> 16,450,483: (-0.3%)
  newLayout_RandomText_Selectable                       : 17,482,439 -> 17,534,207: (+0.3%)
  onDraw_RandomText                                     : 17,224,949 -> 17,228,072: (+0.0%)
  onDraw_RandomText_Selectable                          : 18,067,397 -> 17,958,235: (-0.6%)
  onMeasure_RandomText                                  : 16,435,649 -> 16,516,352: (+0.5%)
  onMeasure_RandomText_Selectable                       : 17,724,819 -> 17,879,508: (+0.9%)
  setText_RandomText                                    :     11,130 ->     11,259: (+1.2%)
  setText_RandomText_Selectable                         :     48,900 ->     48,607: (-0.6%)

android.text.PrecomputedTextPerfTest:
  create_NoStyled_Hyphenation                           : 17,695,377 -> 17,660,233: (-0.2%)
  create_NoStyled_Hyphenation_WidthOnly                 : 17,677,423 -> 17,541,823: (-0.8%)
  create_NoStyled_NoHyphenation                         :  7,021,486 ->  7,030,069: (+0.1%)
  create_NoStyled_NoHyphenation_WidthOnly               :  7,045,453 ->  7,067,021: (+0.3%)
  create_Styled_Hyphenation                             : 12,090,933 -> 12,267,730: (+1.5%)
  create_Styled_Hyphenation_WidthOnly                   : 12,105,491 -> 12,277,272: (+1.4%)
  create_Styled_NoHyphenation                           : 11,835,249 -> 11,960,278: (+1.1%)
  create_Styled_NoHyphenation_WidthOnly                 : 11,871,765 -> 11,912,444: (+0.3%)

android.text.StaticLayoutPerfTest:
  create_PrecomputedText_NoStyled_Balanced_Hyphenation  :    709,839 ->    697,134: (-1.8%)
  create_PrecomputedText_NoStyled_Balanced_NoHyphenation:    527,671 ->    528,928: (+0.2%)
  create_PrecomputedText_NoStyled_Greedy_Hyphenation    :    477,259 ->    481,966: (+1.0%)
  create_PrecomputedText_NoStyled_Greedy_NoHyphenation  :    479,772 ->    482,278: (+0.5%)
  create_PrecomputedText_Styled_Greedy_NoHyphenation    :    639,322 ->    637,790: (-0.2%)
  create_RandomText_NoStyled_Balanced_Hyphenation       : 17,123,681 -> 16,989,227: (-0.8%)
  create_RandomText_NoStyled_Balanced_NoHyphenation     :  7,040,572 ->  7,064,175: (+0.3%)
  create_RandomText_NoStyled_Greedy_Hyphenation         :  7,000,681 ->  7,002,322: (+0.0%)
  create_RandomText_NoStyled_Greedy_NoHyphenation       :  6,997,115 ->  6,996,953: (-0.0%)
  create_RandomText_Styled_Greedy_NoHyphenation         : 11,948,744 -> 12,052,791: (+0.9%)
  draw_PrecomputedText_NoStyled                         :    543,623 ->    513,741: (-5.5%)
  draw_PrecomputedText_NoStyled_WithoutCache            :    564,742 ->    541,795: (-4.1%)
  draw_PrecomputedText_Styled                           :    838,581 ->    837,438: (-0.1%)
  draw_PrecomputedText_Styled_WithoutCache              :    826,775 ->    850,586: (+2.9%)
  draw_RandomText_NoStyled                              :    538,162 ->    533,603: (-0.8%)
  draw_RandomText_NoStyled_WithoutCache                 :  6,401,486 ->  6,424,604: (+0.4%)
  draw_RandomText_Styled                                :  1,024,683 ->  1,011,575: (-1.3%)
  draw_RandomText_Styled_WithoutCache                   :  2,733,204 ->  2,722,828: (-0.4%)

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

Change-Id: I072dfd70b9a687d9c47e310d8cdb34f988fbb32e
2018-03-15 14:09:08 -07:00
Andrew Solovay
666f0fe0b2 docs: Fixing broken hyperlinks
A couple of links were badly formatted. Updated doc staged to:

go/dac-stage/reference/android/widget/RelativeLayout.LayoutParams.html

Test: make ds-docs
Bug: 72624598
Change-Id: I197f5ef52f2476134db674d342dee812ceebec2a
Exempt-From-Owner-Approval: Doc-only change
2018-03-14 16:05:53 -07:00
Seigo Nonaka
687bf8fe58 Add @attr for justificationMode
Bug: 74510862
Test: "m docs" then see TextView API docs.
Change-Id: I65b75232402d7ad52aba194e6e9def80c5486a18
2018-03-13 11:17:54 -07:00
Abodunrinwa Toki
ad52f4b97c TextClassifierService.onSelectionEvent
Bug: 74466564
Bug: 67609167
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.logging.SelectionEventTest
Merged-In: Ib5af1ec80a38432d1201fbc913acdc3597d6ba82
Change-Id: Ib5af1ec80a38432d1201fbc913acdc3597d6ba82
2018-03-12 19:32:51 +00:00
Abodunrinwa Toki
9554dd94ec Merge "Merge textclassifier/logging/ into textclassifier/" into pi-dev 2018-03-12 15:16:53 +00:00
TreeHugger Robot
d50aa52596 Merge "[Magnifier-28] Set corner radius" into pi-dev 2018-03-12 14:12:16 +00:00
Mihai Popa
fb4b6b8fd2 [Magnifier-28] Set corner radius
This CL updates both the magnifier and the floating toolbar to use the
dialogCornerRadius attribute for the corner radius of their windows. In
both we use its value defined in the default device theme, rather than
the value defined in the application's custom theme.

Bug: 70848492
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ifcf4cff1f38fd18b7dbb4c1802390e3beb92cd3c
(cherry picked from commit 3dcbc2112d)
Merged-In: Ifcf4cff1f38fd18b7dbb4c1802390e3beb92cd3c
2018-03-12 11:49:23 +00:00
Mihai Popa
3872238081 [Magnifier-33] Add animation on line jump
This CL adds a simple motion animation when the magnifier jumps between
lines.

Bug: 74381647
Test: manual testing
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I27caba47b18e694f93739866d6fd69569cb89184
(cherry picked from commit 8175edc755)
Merged-In: I27caba47b18e694f93739866d6fd69569cb89184
2018-03-12 11:48:10 +00:00
Mihai Popa
8a06a9f7dd Merge "[Magnifier-32] Do not magnify outside selection" into pi-dev 2018-03-12 11:46:06 +00:00
Abodunrinwa Toki
f1d939910f Merge textclassifier/logging/ into textclassifier/
This is based on feedback on Ib5af1ec80a38432d1201fbc913acdc3597d6ba82

Bug: 74466564
Bug: 67609167
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.LoggerTest
Merged-In: Ic8d58acb2bbd63cedcac4aa16940b4ac852aadc8
Change-Id: Ic8d58acb2bbd63cedcac4aa16940b4ac852aadc8
2018-03-10 13:13:14 +00:00
Makoto Onuki
87030d72b0 Merge "Fix min handling in AbsSeekBar" into pi-dev 2018-03-09 21:59:16 +00:00
Mihai Popa
27e4dfbc2c [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
(cherry picked from commit 2d6b40b821)
Merged-In: I5bde622421c7fb8ecce0ea00f0d8d2af7aa72cf4
2018-03-09 16:04:31 +00:00
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
Makoto Onuki
a46d2d0424 Fix min handling in AbsSeekBar
Bug: 74353295
Test: Manual test with the "Reduced power mode" setting screen.
Change-Id: Ic097f6ddeb3a27d8c30099b00aa8b71675f6de71
2018-03-07 15:12:08 -08: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