Commit Graph

9435 Commits

Author SHA1 Message Date
Mihir Patel
9064a4ef80 Merge "Reporting the Autofill IDs and Positions of active views in list view" into tm-qpr-dev am: 25192d7d0c am: f333fa0c93
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19054708

Change-Id: I2cbfe0cea3466bf0da1119ee9de1e52152ce6694
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 18:07:43 +00:00
Mihir Patel
f333fa0c93 Merge "Reporting the Autofill IDs and Positions of active views in list view" into tm-qpr-dev am: 25192d7d0c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19054708

Change-Id: I6b8ffade431d057334147ae9cd5386afbad13cbc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 17:41:15 +00:00
Mihir Patel
25192d7d0c Merge "Reporting the Autofill IDs and Positions of active views in list view" into tm-qpr-dev 2022-08-10 16:35:13 +00:00
TreeHugger Robot
40d744aa6f Merge "RemoteViews: fix BitmapCache after immutable Bitmap switch" into tm-qpr-dev am: fe195e6f74 am: 9c1576da1c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19450080

Change-Id: I493e5541d80c063cc9fc713b6817357bef3875d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 04:54:41 +00:00
TreeHugger Robot
9c1576da1c Merge "RemoteViews: fix BitmapCache after immutable Bitmap switch" into tm-qpr-dev am: fe195e6f74
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19450080

Change-Id: I7ea562c9433a85dcad6cb3241954140dcb8905b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 04:34:20 +00:00
TreeHugger Robot
fe195e6f74 Merge "RemoteViews: fix BitmapCache after immutable Bitmap switch" into tm-qpr-dev 2022-08-10 04:13:07 +00:00
Mihir Patel
a6e0f74c90 Reporting the Autofill IDs and Positions of active views in list view
Test: atest CtsContentCaptureServiceTestCases, observed events reported only once on scroll and stop as well as on fling
Bug: 211899037
Change-Id: Id67fcc360bf63fcab1d9f345c31d2bf7b9a173d6
2022-08-09 15:37:50 -07:00
Sunny Goyal
45bdf7a065 Merge "Wrapping various apply parameters into a separate class" into tm-qpr-dev am: b4b3a8bdeb am: b4b25e4f9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19531583

Change-Id: Ic6e6eda7ce96c0df0da665af0e32f75610981d08
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 16:56:53 +00:00
Sunny Goyal
b4b25e4f9e Merge "Wrapping various apply parameters into a separate class" into tm-qpr-dev am: b4b3a8bdeb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19531583

Change-Id: I1c24d06db68910c8a99028eca57b233c7e6c5b0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 16:39:36 +00:00
Sunny Goyal
6224d07127 Wrapping various apply parameters into a separate class
> This would allow us to easily extect the options
> Also passing the executor for async inflation. This will allow
  containing adapters to also be async if the parent View is using
  async inflation

Bug: 202766048
Test: Presubmit
Change-Id: I60a9b5db5f9b5f8d6e56521ee00de4be30decce6
2022-08-05 14:53:00 -07:00
Haoyu Zhang
ad2359e69b Merge "Introduce Layout#fillCharacterBounds" 2022-08-02 21:25:01 +00:00
Haoyu Zhang
e7422024fe Introduce Layout#fillCharacterBounds
Introduce Layout#fillCharacterBounds to compute character bounds faster.
This change makes TextView#populateCharacter 5 times faster.

After:
        populateCharacterBounds[mTextLength (100))]_min (ns): 52361
        populateCharacterBounds[mTextLength (300))]_min (ns): 148941
        populateCharacterBounds[mTextLength (1,000))]_min (ns): 463237
        populateCharacterBounds[mTextLength (3,000))]_min (ns): 1388081
        populateCharacterBounds[mTextLength (10,000))]_min (ns): 1165867

Before:
        populateCharacterBounds[mTextLength (100))]_min (ns): 204065
        populateCharacterBounds[mTextLength (300))]_min (ns): 653159
        populateCharacterBounds[mTextLength (1,000))]_min (ns): 2184327
        populateCharacterBounds[mTextLength (3,000))]_min (ns): 6770318
        populateCharacterBounds[mTextLength (10,000))]_min (ns): 22777530

Bug: 233922052
Test: atest android.text.TextViewPopulateCharacterBoundsTest
Test: atest android.text.TextViewCursorAnchorInfoPerfTest
Change-Id: I68a47cf3099b89e0a10604b7706fa7a3dea66d32
2022-08-02 09:39:12 -07:00
TreeHugger Robot
ad5f5557f1 Merge "Stop cursor from blinking when not visible" 2022-08-01 21:24:45 +00:00
Tim Murray
c930727226 RemoteViews: fix BitmapCache after immutable Bitmap switch
Test: widgets appear correctly
Bug: 237256275

Change-Id: I864ac1ba8ac771c326dc215ae4e712ceb0b6057b
2022-07-27 17:45:14 +00:00
Yi-an Chen
c48f21a557 Merge "Add PbA branding to clipboard" into tm-qpr-dev am: 2b04393a1d am: 89e8a943d8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19152769

Change-Id: I9c0a86d4eaab28baccceeef713cde9141d71d492
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 16:45:09 +00:00
Yi-an Chen
89e8a943d8 Merge "Add PbA branding to clipboard" into tm-qpr-dev am: 2b04393a1d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19152769

Change-Id: I5e965626328b0d60f67ff43094f38e28304287c0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 16:25:47 +00:00
Yi-an Chen
2b04393a1d Merge "Add PbA branding to clipboard" into tm-qpr-dev 2022-07-25 16:08:26 +00:00
Steven Terrell
941de7ed8f Stop cursor from blinking when not visible
Cursor continues to blink in a text field even when the text field is
not currently visible. This change checks the visibility of the window
that houses the text field in addition to checking if the view is in
focus.

Bug: 228354442

Test: Added logging to the shouldBlink() method ran following steps:
     1: open contacts app
     2: tap add new contact, tap in an edit field
     3: move back to home screen
     4: lock screen, then unlock screen
     5: observed logs written out to logcat console when app not
        visible.
     after change logs no longer printed to console, cursor still blinks
     correctly after app is re-opened or when new field becomes in
     focus.
Test: CtsWidgetTestCases:EditTextTest#
        testCursorNotBlinkingOnNewActivity_WithoutFocus()
	testCursorBlinkingOnNewActivity_WithFocus()
	testSuspendAndResumeBlinkingCursor()
Change-Id: Iad4396e5f7fd810344c711320d65c57ea25eda70
2022-07-21 16:31:34 +00:00
Sean McQuillan
cd4d5991b2 Merge "Don't crash after unsetting char[] in TextView" into tm-qpr-dev am: 469768f559
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19340644

Change-Id: Id975fe1ef50e8bab6a0ac851eab071b3f246c2ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 16:22:58 +00:00
Yi-an Chen
edfc44079c Add PbA branding to clipboard
Bug: 213357911

Test: Manually on Raven
Change-Id: If9944393fe64c7f94a5be139a538833d91ae98fe
2022-07-19 13:52:13 -07:00
Sean McQuillan
81cde0b584 Don't crash after unsetting char[] in TextView
TextView.setText(char[]) is from API 1 and follows a running with
scissors API style of not copying the passed array.

To avoid a leak, in TextView.setText(String), the char[] would be nulled
out. However, an internal object could have been read using .getText()
prior to this second setText would immmediatly become a
CharSequence that crashed when you called any methods on it.

After this change, the CharWrapper will stay valid if had been
previously retrieved. The general shape of the API will be maintained.

Fixes: b/227218386
Test: atest android.widget.TextViewTest
Relnote: "Calling TextView.getText() after calling TextView.setText(char[])
will now return a valid CharSequence. The char[] pointed to by this char
sequnece may still be mutated by future calls to setText(char[]), but it
will no longer allow a (char[]) null to be set, which lead to crashes
when reading CharSequence returned from getText on TextView."

Merged-In: I35a2a76d58ec1946dace2f615cacf6a6085efdeb

Change-Id: I35a2a76d58ec1946dace2f615cacf6a6085efdeb
(cherry picked from commit 166c7217f4)
2022-07-19 20:38:10 +00:00
Sean McQuillan
782e063d25 Mark nullability for TextView.setText(char[])
Add @NonNull to TextView.setText(@NonNull char[], ...)

This has always thrown a NPE since API 1.

Bug: b/227218386
Test: atest android.widget.TextViewTest
Relnote: "TextView.setText(@NonNull char[], ...) added nullability
annotation."

Change-Id: I212bb5b73d00185f83adb5e74d4acd07a1410ca8
2022-07-12 15:18:47 -07:00
Sean McQuillan
166c7217f4 Don't crash after unsetting char[] in TextView
TextView.setText(char[]) is from API 1 and follows a running with
scissors API style of not copying the passed array.

To avoid a leak, in TextView.setText(String), the char[] would be nulled
out. However, an internal object could have been read using .getText()
prior to this second setText would immmediatly become a
CharSequence that crashed when you called any methods on it.

After this change, the CharWrapper will stay valid if had been
previously retrieved. The general shape of the API will be maintained.

Fixes: b/227218386
Test: atest android.widget.TextViewTest
Relnote: "Calling TextView.getText() after calling TextView.setText(char[])
will now return a valid CharSequence. The char[] pointed to by this char
sequnece may still be mutated by future calls to setText(char[]), but it
will no longer allow a (char[]) null to be set, which lead to crashes
when reading CharSequence returned from getText on TextView."

Change-Id: I35a2a76d58ec1946dace2f615cacf6a6085efdeb
2022-07-12 15:05:59 -07:00
joneckenrode
1173840230 Fixed the reference to the compat version of the widget. Revised the class description.
Fixes: 234585459
Test: Built API documentation
Signed-off-by: joneckenrode <joneckenrode@google.com>
Change-Id: I0215c1e19983e85431fb8a9b0b600d9c18765f3d
2022-07-08 00:18:47 +00:00
TreeHugger Robot
828bff7d95 Merge "Support fling back in scrolling containers" 2022-06-28 23:03:09 +00:00
George Mount
28b3b51c4e Support fling back in scrolling containers
Bug: 232903223

When a user flings the overscroll toward the scrolling
content, the user might think that any left-over velocity
should apply to scrolling the content. This CL makes that
happen. If the fling is less than the overscroll distance,
then the normal spring is applied.

This CL changes ListView, ScrollView, and HorizontalScrollView.

Test: manual testing and new CTS tests
Change-Id: I1a759377f5183eec805598a6b016515297191624
2022-06-28 13:55:27 -07:00
Yohei Yukawa
7c4912ba08 Deprecate mRequestUpdateCursorAnchorInfoMonitorMode part 3
This is the third step towards deprecating

 InputMethodManager#mRequestUpdateCursorAnchorInfoMonitorMode,

which was introduced as a minimum implementation to support
CursorAnchorInfo API in EditText [1].

With this CL, mRequestUpdateCursorAnchorInfoMonitorMode is effectively
deprecated and does nothing except for methods marked with
@UnsupportedAppUsage.

All the remaining valid usages will be handled by the following newly
introduced fields:

 - Editor.InputMethodState#mUpdateCursorAnchorInfoMode
 - Editor.InputMethodState#mUpdateCursorAnchorInfoFilter

 [1]: I3c6b69bd9d79b199afe68d838f25effa6048e5cc
      cf8421df856a5950729ff1d0e73f21d480aa98fb

Bug: 236713697
Test: atest CtsInputMethodTestCases:InputMethodServiceTest#testOnUpdateCursorAnchorInfo
Test: atest CtsInputMethodTestCases:StylusHandwritingTest
Change-Id: I9fc930fbe39c3bdf913e3d7012fdd22805564d3b
2022-06-22 21:41:48 +00:00
Neil Fuller
135079a38d Merge "Use CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE..." 2022-06-14 07:48:58 +00:00
TreeHugger Robot
67818f9fbe Merge "Explain the difference between setBreakStragegy() and setLineBreakStyle() in API doc" into tm-dev am: 2b868683ad am: 4e9b6a3839 am: e0d6f903b9 am: 3c7b2c3fe0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18769766

Change-Id: I93eefec1b916f5fcfcf98815b2b68c881bf0e5a0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 08:10:56 +00:00
TreeHugger Robot
3c7b2c3fe0 Merge "Explain the difference between setBreakStragegy() and setLineBreakStyle() in API doc" into tm-dev am: 2b868683ad am: 4e9b6a3839 am: e0d6f903b9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18769766

Change-Id: I530759c97e64b8be4254b411b1e9021857db3d64
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 07:50:25 +00:00
Neil Fuller
8fc8607cb7 Use CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE...
Use CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE in place of
CAPITALIZATION_FOR_STANDALONE for date formats, since ICU does not
capitalize (at least) month names correctly today according to
https://unicode-org.atlassian.net/browse/ICU-21631. The motivating
example is the DatePicker/SimpleMonthView for Vietnam with "{month}
{year}" (as used in the manual date selection in the Date & Time screen
of the System settings): it does not capitalize the month without this
change.

It's difficult to know which formats will be affected, so this change
modifies all the formats found in frameworks/base/ that currently
express a preference for STANDALONE. The fix may be available by ICU 72,
at which point this change can presumably be reverted as signified in
the TODOs.

Bug: 229287642
Test: Inspection of Date & Time settings + compilation only
Change-Id: Iea753d0318aef55c6dd4f7e09068a0362ac970d8
2022-06-08 14:34:45 +00:00
allenwtsu
289d576548 Explain the difference between setBreakStragegy() and setLineBreakStyle() in API doc
Bug: 217951279
Test: build pass
Change-Id: Ida98327a656edc4878f7ce1c7f2bc99b72cd91d6
2022-06-07 13:06:52 +08:00
Treehugger Robot
87e108d038 Merge "Fix owner files in text components in the widget directory" am: 5078370e5f am: a375a95fd4 am: 9942758628 am: 5e951a2d41 am: 4104637d65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115546

Change-Id: I8e377ae123f8333983e34dbf4c1a9867ef8b52ef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 00:31:20 +00:00
Treehugger Robot
9942758628 Merge "Fix owner files in text components in the widget directory" am: 5078370e5f am: a375a95fd4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115546

Change-Id: I275376ed1252beb7bb26d27de6d435c5c2760407
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-06 23:21:20 +00:00
Treehugger Robot
a375a95fd4 Merge "Fix owner files in text components in the widget directory" am: 5078370e5f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115546

Change-Id: I10ff5646a9168fa2a4737a680fd539bf8a3b4b60
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-06 22:53:37 +00:00
Seigo Nonaka
fa29f96603 Fix owner files in text components in the widget directory
Text team owns the text related module in widget.
The previous per-file line was not working due to extra spaces between
files list.
Fixed by removing white spaces and also change to refer the text team
OWNERS file.

Bug: 234759754
Test: N/A

Change-Id: I3302de8fd90a12e7745f15d07c8c53c900bb3a14
2022-06-03 21:16:55 +00:00
TreeHugger Robot
1a8d6458e7 Merge "Always dismiss magnifier when cursor is detached." 2022-06-02 20:50:51 +00:00
Seigo Nonaka
d8a61e8a9d Always dismiss magnifier when cursor is detached.
Bug: 182484248
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: Manually done
Change-Id: I79b5b8b7d000bbab114ef341327d3d0c21bab697
2022-06-02 11:01:42 -07:00
Mark Punzalan
89f3d4968d Merge "Translate selectable TextViews by temporarily disabling selectable." into tm-dev am: 8bbc7f6554 am: 8f85334591 am: 905979b385 am: af0c004e46
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18490753

Change-Id: I4d327ef4f8ff677a338df1a4be488d3e452da4d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 20:39:01 +00:00
Haoyu Zhang
99e6506d13 Merge "Optimize TextView#populateCharacterBounds" 2022-05-26 21:29:41 +00:00
Haoyu Zhang
bc317e642c Optimize TextView#populateCharacterBounds
Avoid unnecessary calls of getPrimaryHorizontal/getSecondaryHorizontal,
this will make the method around 2 times faster.
Also avoid repeat calls of isPositionVisible, which reduces the
computation time around 5%.

Before:
	populateCharacterBounds[mTextLength (100))]_min (ns): 416685
	populateCharacterBounds[mTextLength (300))]_min (ns): 1315209
	populateCharacterBounds[mTextLength (1,000))]_min (ns): 4480508
	populateCharacterBounds[mTextLength (3,000))]_min (ns): 13526504
	populateCharacterBounds[mTextLength (10,000))]_min (ns): 44841361

After:
        populateCharacterBounds[mTextLength (100))]_min (ns): 204065
        populateCharacterBounds[mTextLength (300))]_min (ns): 653159
        populateCharacterBounds[mTextLength (1,000))]_min (ns): 2184327
        populateCharacterBounds[mTextLength (3,000))]_min (ns): 6770318
        populateCharacterBounds[mTextLength (10,000))]_min (ns): 22777530

Bug: 233922052
Test: atest android.text.TextViewCursorAnchorInfoPerfTest
Change-Id: I24a470e204e4a2e52f881828c707adfcca21f890
2022-05-26 09:27:32 -07:00
Mark Punzalan
6758b3f7e7 Translate selectable TextViews by temporarily disabling selectable.
The text is not selectable while translated. Making translated text
selectable requires many more changes.

This was tested in Nextdoor in the feed/posts activity. When there is a
"Read more" link in the post, the link doesn't work while translated,
and doesn't behave the same way after translation is paused.

Bug: 202966891
Test: atest CtsTranslationTestCases
Test: Manually - with Nextdoor on feed and chat activities
Change-Id: I6e8f532d427d85ff22df0deb248d8416a15f4821
2022-05-25 20:03:10 +00:00
TreeHugger Robot
19d57551fc Merge "Migrate AutoCompleteTextView to use OnBackInvokedDispatcher." into tm-dev am: d1263fb5ce am: b97f7b4760 am: cb69608f94 am: 218a9a7a7c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18432995

Change-Id: I7f94a47997d06f4d3fd5469090cd6e485e505514
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 09:03:14 +00:00
Shan Huang
7caa2c1c6b Migrate AutoCompleteTextView to use OnBackInvokedDispatcher.
With ag/17952046 we now actively intercept KEYCODE_BACK before they are
sent to IME when new back flow is used. This requires us to migrate
AutoCompleteTextView#onKeyPreIme, and is also what causes the test
failure in b/231960630.

Test: atest AutoCompleteTextView test.
Test: Test back behavior of AutoCompleteTextView in BackTestApp.
Bug: 231960630
Change-Id: I1a5e01c9a4f8f0e762b493284650854a230aecd3
2022-05-18 19:08:59 +00:00
Justin Ghan
d49d0fe228 Merge "Move setHandwritingArea call to View#sizeChanged" 2022-04-29 15:42:08 +00:00
Haoyu Zhang
abbb1d9969 Merge "Scribe: Introduce setHandwritingBoundsOffset API" 2022-04-28 22:04:41 +00:00
Haoyu Zhang
8b4aacab1e Scribe: Introduce setHandwritingBoundsOffset API
Introduced View#setHandwritingBoundsOffset and xml attributes to
enlarge the view's stylus handwriting bounds. With this API, it's
possible to make handwriting bounds larger than the view's visible
bounds, and makes handwriting easier to trigger.

Bug: 211764956
Test: atest android.view.stylus.HandwritingInitiatorTest
Test: atest android.view.cts.HandwritingBoundsOffsetTest
Change-Id: I7a3749f78df82eee08ad29761cd52d7452114873
2022-04-27 17:11:04 -07:00
Justin Ghan
dd482fe91e Move setHandwritingArea call to View#sizeChanged
This enables handwriting to be started before the input connection is created for custom text editor views which are not EditTexts.

Fix: 218907674
Test: atest CtsInputMethodTestCases:android.view.inputmethod.cts.StylusHandwritingTest
Change-Id: I1ff3b0ffd609e1ec9f1efc477d00fee998ac9966
2022-04-26 13:22:01 -07:00
Lucas Dupin
b5b1807a3c Merge "Don't trigger full relayout if DateTimeView doesn't change" into tm-dev am: 06ac74c54f am: e2c8005b11
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17606881

Change-Id: If6d59f47507f1c6e17b853e3635976e1bb0b1d00
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-22 15:45:21 +00:00
Lucas Dupin
06ac74c54f Merge "Don't trigger full relayout if DateTimeView doesn't change" into tm-dev 2022-04-22 15:21:23 +00:00