Commit Graph

7696 Commits

Author SHA1 Message Date
Mihai Popa
b99c021e4c Merge "[Magnifier-34] Keep magnifier inside its surface" into pi-dev am: 14372aaabc
am: 3c0ad631d5

Change-Id: I66801721fbbf1b60b1e1523555b8f990807ccf05
2018-03-23 19:07:49 +00: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
9f504f3118 Merge "Merge "Hide Media*2 APIs" into pi-dev am: d847d7d0a9" into pi-dev-plus-aosp
am: afe151935a

Change-Id: I40f0b08af3387975e4ca30f6da38b6942ee21077
2018-03-23 06:00:08 +00:00
Seigo Nonaka
284a0ae76b Merge "Make PrecomputedText Spannable for supporting selection" into pi-dev am: 02c8d1b07f
am: 42033475dd

Change-Id: Ibac099cd1256e4a87299196dcfeda8d50c900197
2018-03-23 03:34:31 +00:00
Abodunrinwa Toki
80f5725d1e Merge "Fix smart_linkify_enabled flag." into pi-dev am: e9a7cb8158
am: 27d8cf774a

Change-Id: I4d0c13b480cdd0f2fa134716575e86630a7e90d4
2018-03-23 02:31:56 +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
85701d1043 Merge "Remove unnecessary Context from ApiLoader" into pi-dev am: bf121d2f13
am: 0f524c02b2

Change-Id: I648e9a39a7c546cedae9b20cc264dc88d9598473
2018-03-22 12:07:20 +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
37bf05d2b2 docs: fixing typo in reference document am: 60b06bd217 am: 2285a662ea
am: 0dd8c40343

Change-Id: Iaa09e1c22a8cf705b6e5eeb989860b0d6d7dc8c2
2018-03-22 01:48:24 +00:00
kopriva
2285a662ea docs: fixing typo in reference document
am: 60b06bd217

Change-Id: Ie0a6380e8287d49b4d80f8742e51345372e5b8a9
2018-03-22 00:39:02 +00:00
TreeHugger Robot
c97cd14751 Merge "Show hint instead of auto-populating timepicker." 2018-03-21 16:54:44 +00:00
David Ogutu
07b2bb7f2f Show hint instead of auto-populating timepicker.
Textboxes will now show hint text if not set rather than populating
text. Also changed validation text to have similar behaviour to the
radial setter.

Change-Id: I8ce55d7d7898be9b0a842d3f1f9a2e8deb01f5b3
Test: manually https://drive.google.com/file/d/1bD_dbIF9dgOr1B3EuSMBlJY9M97Z19vc/view?usp=sharing
Fixes: 36863667
2018-03-21 11:26:09 -04:00
David Ogutu
2e654f764c Fix DatePicker highlight to be year-aware.
Before this change, a date would be highlighted for all years.

Test: manual https://drive.google.com/file/d/1X579-KokrMEO7p19A5xtamTs45VQaPAA/view?usp=sharing
Change-Id: I09bb7fa98eac61c4e160a133e421fb31ce57511d
Fixes: 74434011
2018-03-21 10:40:43 -04: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
Seigo Nonaka
8d2084e84c Merge "Revert "Make PrecomputedText Spannable for supporting selection"" into pi-dev am: b3aec698e8
am: efd7a037d0

Change-Id: I4abfd9ade6928106f21a598dd33ab5be5e86d1b8
2018-03-19 22:28:28 +00: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
Siyamed Sinir
4d696b3b5b Merge "Fix rounding error related to autoSize" 2018-03-17 03:24:55 +00:00
Siyamed Sinir
db86a6b047 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
2018-03-16 14:49:23 -07:00
Seigo Nonaka
35570276db Merge "Make PrecomputedText Spannable for supporting selection" into pi-dev am: 71ed54f377
am: b8293dee84

Change-Id: Id9e287da1a41e2088f2cdd91ac4305b910789a84
2018-03-16 16:35:55 +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
TreeHugger Robot
69ba985bf5 Merge "Auto-advance after hour in entered in timepicker." 2018-03-15 20:33:19 +00:00
David Ogutu
b875238d0f Auto-advance after hour in entered in timepicker.
Only advances when no accessibility services are enabled.

Test: manually
Change-Id: If2ef9062391fd628cc86f49d356a46a86f82e4e9
Fixes: 36863243
2018-03-15 15:03:35 -04: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