summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge "docs: Edited API documentation related to line-break and line-break ↵Jon Eckenrode2022-08-251-25/+38
|\ | | | | | | | | | | | | | | | | word styles." into tm-dev am: 1914a2f78e am: 0e9d7be16e Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19669167 Change-Id: I8c7e51969b81ec6f66c6009567d9805debe48ecc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * docs: Edited API documentation related to line-break and line-break word styles.joneckenrode2022-08-231-25/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Files patched from CL 19608033, https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/19608033. Could not cherry-pick CL because LineBreakConfig.java on master contains Android U code. Staged to: https://android.devsite.corp.google.com/reference/android/widget/TextView https://android.devsite.corp.google.com/reference/android/R.attr https://android.devsite.corp.google.com/reference/kotlin/android/R.attr Test: Built API docs Change-Id: Ie322096ee2cc0ab3e24bb7d2ff8c398e8861726f
* | Don't crash after unsetting char[] in TextViewSean McQuillan2022-07-191-6/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | 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 166c7217f45d312f026ea2be94101e7b39b6a2c5)
* Explain the difference between setBreakStragegy() and setLineBreakStyle() in ↵allenwtsu2022-06-071-2/+9
| | | | | | | | API doc Bug: 217951279 Test: build pass Change-Id: Ida98327a656edc4878f7ce1c7f2bc99b72cd91d6
* Translate selectable TextViews by temporarily disabling selectable.Mark Punzalan2022-05-251-16/+7
| | | | | | | | | | | | | | 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
* Merge "Auto append password hint for TextView" into tm-devTYM Tsai2022-04-211-0/+12
|\
| * Auto append password hint for TextViewTYM Tsai2022-04-201-0/+12
| | | | | | | | | | | | | | | | | | | | Some TextViews are made as password via input type but does not contain autofill password hint. This change auto append a hint for autofill to identify. Bug: 219844915 Test: atest android.autofillservice.cts.dialog.LoginActivityTest Change-Id: Ifd18c56ffe788a601821d178ace41413f9e0454e
* | Merge "Revert "Fixes for a11y selection". Reverts hiding some selection UI" ↵Sally Yuen2022-04-011-6/+5
|\ \ | |/ |/| | | into tm-dev
| * Revert "Fixes for a11y selection". Reverts hiding some selection UISally Yuen2022-03-301-6/+5
| | | | | | | | | | | | | | | | | | This reverts commit 55022a5880614ff6f048ab622160059a164e83b1. Reason for revert: b/226418848 Test: builds Change-Id: Id709d131754e14a67805ee981bc5ad0bc759121f
* | Merge "Make TextView do not show IME when fill dialog popup" into tm-devTYM Tsai2022-03-311-1/+18
|\ \ | |/ |/|
| * Make TextView do not show IME when fill dialog popupTYM Tsai2022-03-231-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make to show fill dialog only if IME is not showing. And if the field will show fill dialog, ignore to show ime when clicks on the field. Bug: 210926084 Test: Manual launch sample and click on password field -> show fill dialog click on username field (no fill dialog) -> show fill UI and IME IME is showing and click on password field -> show fill UI Test: atest android.autofillservice.cts.dialog.LoginActivityTest Test: atest android.widget.cts.EditTextTest Change-Id: I6080510d87c50969d85fd9ed746ceba7e3c1c685
* | Fixes for a11y selectionSally2022-03-161-10/+30
|/ | | | | | | | | | | | | | | | | | | | | | | - TextView should request focus before performing selection on non-editable text, since selection requires focus. On the a11y service side, input focus should not matter when selecting non-editable text. - Remove clickable and long-clickable states, since these are present due to TextView#setTextIsSelectable. - Make UI controller changes consistent between SET_SiELECTION and SET_TEXT. Using SET_SELECTION means the action mode menu won't pop up and the left/right selection handles won't appear. Interactions between multiple EditTexts were previously inconsistent - Delete some obsolete javadoc Bug: 218357385 Test: builds and install: highlighting is consistent between SET actions. highlighting works when selecting text in TalkBack, without the service needing to purposely put input focus, atest AccessibilityTextTraverssalText Change-Id: I67986020aa112d45bd670f77b2b415617226c094
* Update the text wrapping API.James.cf Lin2022-03-101-54/+76
| | | | | | | | | | | 1) Update the LineBreakConfig class to be immutable. 2) Do not return null in the PrecomputedText.Params#getLineBreaiConfig API Bug: 216638444 Test: atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest; atest TextViewPrecomputedTextTest; atest StaticLayoutLineBreakingVariantsTest Merged-In: I93bcb6ebc35344e34e9bb8a24df375aa7b3a8d81 Merged-In: I07766137ff6639c7d4acaad07dbcf11a2841cdb0 Change-Id: I07766137ff6639c7d4acaad07dbcf11a2841cdb0
* Rename ACTION_SHOW_SUGGESTSIONS TO ACTION_SHOW_TEXT_SUGGESTIONSyingleiw2022-03-041-2/+3
| | | | | | | | | | | | Fix: 217730256 Bug: 222537368 Test: Added test in EditTextTest (will merge later when reviewed). Merged-In: I78354a0f1d955c5b7c1ead044ea49086b3479841 Change-Id: I78354a0f1d955c5b7c1ead044ea49086b3479841 (cherry picked from commit e1f392d171acacbccb15516c73b06fa7835d2d2e)
* Merge "Add pasteAsPlainText in some documentation where it is missing." am: ↵Treehugger Robot2022-02-221-2/+6
|\ | | | | | | | | | | | | | | f7ee046cd6 am: 9317b1ce92 am: 428d587d1f Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1994510 Change-Id: I6c87c09b7d652d5f122c2b6d321fe019afc8908f
| * Add pasteAsPlainText in some documentation where it is missing.Arthur Milchior2022-02-221-2/+6
| | | | | | | | | | | | | | I discovered this error in documentation while I needed to capture "PasteAsPlainText" in an android app. I suspect it might be missing in other folder too, but I’m not familiar enough with Android to be sure Change-Id: I77af9b06eb602c4ba60b0744cc02f7449bc4f500
* | Merge "Migrate frameworks/base javadocs references to androidx"Alan Viverette2022-02-101-1/+1
|\ \
| * | Migrate frameworks/base javadocs references to androidxAlan Viverette2022-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Does not remove Support Library artifacts from docs classpath (ApiDocs.bp) because they are still used in development/samples, which is not as easy to migrate as javadoc. Bug: 158779503 Test: make docs Exempt-From-Owner-Approval: Mass find/replace for androidx migration Change-Id: Icf7f53ec36a0e970413352e2ebf40ce9d60ed17e
* | | Merge "fix TextView a11yNodeInfo isTextSelectable"Sally Yuen2022-02-091-1/+1
|\ \ \ | |/ / |/| |
| * | fix TextView a11yNodeInfo isTextSelectablesallyyuen2022-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | info.TextSelectable needs to also check isTextEditable for edit texts. Bug: n/a Test: atest AccessibilityTextTraversalTest Change-Id: Ic8d5a04db05f0cc4856997ecf5d5c51bc8d16da2
* | | Do not relayout when changing to MarqueeLucas Dupin2022-02-041-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text field size won't really change, so there's not reason to remeasure and relayout. This saves us up to 48 measure steps when unlocking the device. Test: https://ui.perfetto.dev/#!/?s=519ae4c7f943f3ebad09eae63e445112c1d4286dd8376e18e69d713f1a9c2 Bug: 210432290 Change-Id: Ie3b7e0f7e942aac23605e2588cf6b942d507588f
* | | Merge "Add AccessibilityNodeInfo.isTextSelectable"Sally Yuen2022-02-011-0/+1
|\| |
| * | Add AccessibilityNodeInfo.isTextSelectablesallyyuen2022-01-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ACTION_SET_SELECTION is needed on all TextView nodes to reset the cursor. But some non-edit texts are selectable and need to be identified by a11y services. ACTION_SET_SELECTION has been on these nodes for years so to avoid the complexity of breaking this, add a node property. Services should use ACTION_SET_SELECTION for nodes where property=true Bug: 62058901 Test: atest AccessibilityTextTraversalTest, TextViewTest cts and core (TextViewTest#testCutShouldNotThrowException keeps failing but it's unrelated to this change) Change-Id: Ia825dd806824e663e7fa7d274f51c6bf44f0c2c4
* | | Merge "Minor JavaDoc grammar fix" am: 86e1a45b56 am: fa264ae28b am: ↵Siyamed Sinir2022-01-311-2/+2
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | f1cbfa73ab am: 9a191546d1 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1964582 Change-Id: If44741849325764b37143eaa1016e201aab8a51f
| * | Minor JavaDoc grammar fixIan G. Clifton2022-01-291-2/+2
| | | | | | | | | | | | | | | | | | Replaced "than" (comparative) with "then" (temporal) for the setTextSize JavaDoc. No functional change. Change-Id: I84b5d1b250cb7a5d925cfbd0a86a2bfef55ade24
| * | Fix OOB crash in ContentCapture for translated viewsAhaan Ugale2021-08-171-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a view is partially visible on the screen, ContentCapture reports only the visible portion (+ a few additional lines). The offsets calculated for this can be out of bounds if the view's displayed text is longer from the original text. Fix: 196414491 Test: manual - translate app to lang with more characters and trigger a relayout (by scrolling for an app with ListView) Test: atest CtsContentCaptureServiceTestCases Change-Id: Iae98133c48cc67a0b00f1b0ab8b93e5adb293423 (cherry picked from commit 273a0eabc8faa46349c63a6836ae4004709aeb0b)
* | | Merge "Add line break word style parameter in the LineBreakConfig"James Lin2022-01-241-4/+93
|\ \ \
| * | | Add line break word style parameter in the LineBreakConfigJames.cf Lin2022-01-221-4/+93
| | |/ | |/| | | | | | | | | | | | | | | | | | | The line break word style(lw) provides the phrase-based breaking opportunities. When the line break word style is set, it will be brought to ICU for calculation. Bug: 183780874 Test: atest minikin_tests; atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest Change-Id: Idd851497e46c1fca87ff590230d93f8bb5c9afae
* | | Merge "Ensure that "smart" actions are shown in Talkback."Abodunrinwa Toki2022-01-241-3/+9
|\ \ \ | |/ / |/| |
| * | Ensure that "smart" actions are shown in Talkback.Abodunrinwa Toki2022-01-211-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Local Context Menu" (https://support.google.com/accessibility/android/answer/6007066?hl=en-GB) is missing smart actions. This CL adds them. We need this to happen even more now that we are going to be rendering the selection toolbar in a system UI and are experiencing accessibility focus issues. See referenced bugs for more details. Bug: 214122485 Test: m Test: https://screenshot.googleplex.com/3SdNNBt5bWMz2CN.png Change-Id: If5266c8b44461349877cf0029b7803e0bc8a9174
* | | Add setLineBreakConfig APISeigo Nonaka2022-01-151-5/+54
|/ / | | | | | | | | | | | | | | Add new API to allow applications to specify the line break word style. The line break style is one of the locale extension. When the line break style is set, it will be brought to ICU for calculation. Bug: 183780874 Test: atest minikin_tests; atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest Change-Id: Ia9cdb5b83e346f96ae22abbb1bcce05c43207bba
* | Implement fallback line spacing for BoringLayoutSeigo Nonaka2022-01-121-14/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallback line spacing is a feature of extending the line height when the fallback font has taller glyph. This was implemented to StaticLayout in Android P but not yet implemented in BoringLayout. This CL enables this feature to the BoringLayout as well. Not to break existing apps, change this behavior only if the targetSdk version is T or later. This is a 2nd attempt of Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44 The root cause of SystemUI crash was wrong API usage. (start, end) was passed instead of (start, count). Bug: 210923482 Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Test: atest SystemUITests Change-Id: I9137607b0120934f7ad2a12c0f0b8aaa52915831
* | Merge "Don't animate TextView marquee if not visible"John Reck2022-01-101-3/+10
|\ \
| * | Don't animate TextView marquee if not visibleJohn Reck2021-09-221-3/+10
| | | | | | | | | | | | | | | | | | Test: guess Bug: ??? Change-Id: I0d978d18ca66a36b24160f71eae0766da0bdd7d4
* | | Revert "Implement fallback line spacing for BoringLayout"Shubham Dubey2022-01-101-67/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Add font extent calculation" Revert "Add test case for fallback line spacing" Revert submission 16486662-fallback_line_spacing Reason for revert: Investigate test failures on master BUGID: b/213826416 BUGID: b/213829920 Reverted Changes: I06cd7ab71:Add font extent calculation I6214d52cd:Implement fallback line spacing for BoringLayout Ia5825c474:Add test case for fallback line spacing Change-Id: Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44
* | | Implement fallback line spacing for BoringLayoutSeigo Nonaka2022-01-061-14/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallback line spacing is a feature of extending the line height when the fallback font has taller glyph. This was implemented to StaticLayout in Android P but not yet implemented in BoringLayout. This CL enables this feature to the BoringLayout as well. Not to break existing apps, change this behavior only if the targetSdk version is T or later. Bug: 210923482 Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Change-Id: I6214d52cde25a044bc6e246d2118e35d3a243c9d
* | | Add AccessibilityAction ACTION_SHOW_SUGGESTIONSyingleiw2021-12-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And implement it for editable text to show the popup window for typo correction. Bug: b/143378480 Test: tested with modified talkback. Change-Id: I8bb1ec87f6bb2177fb4b8fb9a88bfbe10b374173
* | | Send TYPE_VIEW_TEXT_CHANGED a11y event when SuggestionSpan is addedyingleiw2021-11-171-51/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When user types space after a word, we receive a text change event, but the suggestion span is not added to the text yet. The spell checker adds the span after the text change event is sent. Previously we send the event in onSpanAdded in TextView, but we don't do anything or update the before text for span removed. This is a bit confusing and error prone. This change moves the send event logic into spell checker. Bug: b/143378480 Test: tested with talkback. Change-Id: Ibd45843494304602b177df8da520a51058989f10
* | | Require onCheckIsTextEditor() for IME_FLAG_NAVIGATE_{NEXT,PREVIOUS}Yohei Yukawa2021-10-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TextView#onCreateInputConnection() has automatically set the following EditorInfo flags depending on the presence of focusable elements next to it. * EditorInfo#IME_FLAG_NAVIGATE_NEXT * EditorInfo#IME_FLAG_NAVIGATE_PREVIOUS With those flags, IMEs may offer some additional UI for users to trigger InputConnection#performEditorAction() with the following command to achieve tabbing navigation to switch to other focusable elements. * EditorInfo#IME_ACTION_NEXT * EditorInfo#IME_ACTION_PREVIOUS The problem of the current TextView implementation is that it does not check whether the next element is also a text input field or not. As a result, users might be navigated to a UI element that does not natively support InputConnection APIs, which results in connecting the IME to a fallback InputConnection. We have actually received multiple bug reports that the IME was still shown but not tapping its keys did nothing. Based on such feedback, this CL aims to narrow down the condition to automatically set those navigation flags in TextView. With this CL, those flags will no longer be set if the next View in question returns true from View#onCheckIsTextEditor(). See also the corresponding CTS CL [1] to find examples of how it behaves now. [1]: I1b75b85f6c1fa4ff90ffa7d584f033b9510d2a36 Fix: 31099943 Test: atest CtsInputMethodTestCases:EditTextImeSupportTest Change-Id: Id004a77453952f36a2c572697db31c87518f842f
* | | Send TYPE_VIEW_TEXT_CHANGED a11y event when SuggestionSpan is addedyingleiw2021-09-241-2/+50
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When user types space after a word, we receive a text change event, but the suggestion span is not added to the text yet. The spell checker adds the span after the text change event is sent, but currently TextView doesn't send any notification. This change sends a TYPE_VIEW_TEXT_CHANGED event with the from and to index of the span, and beforeText which doesn't have the span and afterText which has the span. Bug: b/143378480 Test: tested with talkback. Change-Id: If16c2c578be5dcae20a9fd7014ff6fba2d487670
* | Merge "Fix OOB crash in ContentCapture for translated views" into sc-dev am: ↵TreeHugger Robot2021-08-151-0/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | f7fb6c535e am: 8737b67e6e am: 2f64986be1 am: a09d2a8581 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15546784 Change-Id: I707049893d1ba46617426d38b3e397d1055cfe68
| * | Fix OOB crash in ContentCapture for translated viewsAhaan Ugale2021-08-121-0/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | When a view is partially visible on the screen, ContentCapture reports only the visible portion (+ a few additional lines). The offsets calculated for this can be out of bounds if the view's displayed text is longer from the original text. Fix: 196414491 Test: manual - translate app to lang with more characters and trigger a relayout (by scrolling for an app with ListView) Test: atest CtsContentCaptureServiceTestCases Change-Id: Iae98133c48cc67a0b00f1b0ab8b93e5adb293423
* | Move EditableInputConnection into com.android.internal.inputmethodYohei Yukawa2021-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EditableInputConnection has been one of the most important and widely used InputConnection implementations. While having it under com.android.internal.widget would still make some sense, it'd become more easier for the IMF team to keep improveing it if EditableInputConnection is moved into com.android.internal.inputmethod Anyway, EditableInputConnection has never been a public API hence just moving its package should have no impact on app compatibility. Bug: 192412909 Test: atest CtsInputMethodTestCases CtsWidgetTestCases:TextViewTest Change-Id: I87974f779dbda60dfb79331cbe1ec975c475c695
* | Merge "Guarding against null pointer exception when setting view structure ↵Mihir Patel2021-07-021-15/+20
|\| | | | | | | | | | | | | | | info for content capture" into sc-dev am: 59fe064d75 am: d27d3a5d90 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15067633 Change-Id: I8170aa9134ad2cc50c0458c9ce817cfaf1150e3b
| * Merge "Guarding against null pointer exception when setting view structure ↵Mihir Patel2021-07-021-15/+20
| |\ | | | | | | | | | info for content capture" into sc-dev
| | * Guarding against null pointer exception when setting view structure info for ↵Mihir Patel2021-06-221-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | content capture Test: Manual, CTS Bug: 189329389 Change-Id: Iaaacd59dc377079847951ab635df9bb602467390
* | | Merge "Disable log default dumps in debug ROM" into sc-dev am: 559b8dd078 ↵Joanne Chung2021-07-021-3/+0
|\| | | | | | | | | | | | | | | | | | | | | | | am: ee7d107514 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15048193 Change-Id: I114b2bfdb9f5c79eb5293ece33937812cf95df9c
| * | Merge "Disable log default dumps in debug ROM" into sc-devJoanne Chung2021-07-021-3/+0
| |\ \
| | * | Disable log default dumps in debug ROMJoanne Chung2021-06-291-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We enable the logs dump in debug rom, we should only dump logs when the debug flag is on. Bug: 182433547 Test: Make sure the flag is disable after test and enable during test. Change-Id: I0a719ee9c545b4e66f3414d7f57f3d959004071e
* | | | Merge "Fix TextViewTranslationTest test fail." into sc-dev am: 27f397f55a ↵Joanne Chung2021-06-241-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: fa9dfa0d80 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15048192 Change-Id: I334bfc928978d5eebebfb7b5fbabf3c3a9a2059b