Commit Graph

9620 Commits

Author SHA1 Message Date
Steven Terrell
3d479ed222 Fix cursor not blinking when view re-added to layout
This fixes a bug where if the EditText view has or had focus and then
is removed from the layout and re-added the cursor does not resume
blinking.

There was a change several months ago that prevented the cursor from
blinking when the window is no longer visible.  That change added a
check in shouldBlink to verify that the window is visible.  This
created a situation where the window might not be visible when
makeBlink is called from onFocusChanged and as a result mBlink is
never instantiated. This resulted in the cursor not blinking after an
app starts. The fix was to call makeBlink again when onAttachToWindow
is called.  The Window is visible at this point and the cursor blinks
as expected.

The reason the code change below is needed is in the case where a view
is removed and added back after the mBlink object has been
instantiated. A call to unCancel is needed to ensure that the cursor
resumes blinking as expected. This was identified in this change
aosp/2540031.

The change also guards against the window not visible case as outlined
above.

Bug: 278907680
Test: Added following CTS test:
      testCursorResumeBlinking_AfterFocusedView_DynamicallyRemovedAdded
      testCursorBlinking_ViewDynamically_RemovedAdded_NeverHadFocus
      testCursorSuspendBlinking_ViewDynamicallyRemoved
      testCursorNotBlinking_ViewDynamicallyAdded_NoFocus
      testCursorBlinking_ViewDynamicallyAdded_WithFocus
(cherry picked from https://android-review.googlesource.com/q/commit:61d982884fa0e14dc5f58e872f182bb5c1b04afd)
Merged-In: I07afc7ef1a707549240479015a00a66db814afb7
Change-Id: I07afc7ef1a707549240479015a00a66db814afb7
Cherrypick from AOSP master to udc-dev.
2023-04-24 19:04:30 +00:00
Treehugger Robot
3d10089d1e Merge "Hide hint text when starting handwriting" into udc-dev 2023-04-21 05:09:26 +00:00
Justin Ghan
4cf7ba6342 Hide hint text when starting handwriting
Bug: 277153261
Test: atest android.view.stylus.HandwritingInitiatorTest
Change-Id: I64007e8ea9a52a76cff78b04bc5b307c117b77c8
2023-04-20 16:24:57 -07:00
Treehugger Robot
fa88b4502d Merge "VelocityTracker should not be cleared until pointer up" into udc-dev 2023-04-18 00:45:18 +00:00
Tyler Freeman
48e1f12c18 Merge changes from topics "fontscaling-lineheight-after", "fontscaling-lineheight-spfix" into udc-dev
* changes:
  fix(non linear font scaling): recalculate proportional line height if they setTextSize() after setting line height
  fix(non linear font scaling): preserve proportionality of lineHeight when non-linear font scaling is in effect
  feat(non linear font scaling): add FontScaleConverterFactory.isNonLinearFontScalingActive()
2023-04-17 21:51:12 +00:00
George Mount
b5f473ed01 VelocityTracker should not be cleared until pointer up
Fixes: 266736911

VelocityTracker was being cleared when it hit the end
of the View, but stretch overscroll can be flung.

Test: ScrollViewTest

Change-Id: Iadeca98360dc5a5462bcefbdd266bca92c0b6d5a
2023-04-14 16:37:05 -07:00
Tyler Freeman
fa043bb5d9 fix(non linear font scaling): recalculate proportional line height if they setTextSize() after setting line height
This will only recalculate if both were set in SP, since that's the only
time the proportion calculation happens anyway.

Bug: 273326061
Test: atest cts/tests/tests/widget/src/android/widget/cts/TextViewFontScalingTest.kt

Change-Id: I41ad12cdef6f1b93b60deca039c9ab72bb59e39f
2023-04-13 23:57:11 +00:00
Tyler Freeman
a4d59758d4 fix(non linear font scaling): preserve proportionality of lineHeight when non-linear font scaling is in effect
This ensures that the design intent is preserved when using large font
scales and non-linear font scaling: the line height proportions should
still match even when using SP units for both text size and line height.

If the dev does not define both textSize and lineHeight in SP units, we
don't do the corrective recalculation. Unfortunately, this could result
in cramped-looking text due to the lineHeight not scaling with text
size. There are linters to warn the developer of this though, so we hope
they do the right thing.

Bug: 273326061
Test: atest cts/tests/tests/widget/src/android/widget/cts/TextViewFontScalingTest.kt
Change-Id: I17f9b7c8d3e0e63deed4037ebf0e99b690bc694a
2023-04-13 23:57:11 +00:00
Haoyu Zhang
4a0f969ce1 Merge "Fix insert mode draws extra rectangle at the end of the first line" into udc-dev 2023-04-08 19:49:16 +00:00
Sihua Ma
53ea832024 Merge "Upload bitmap to GPU in RemoteViews" into udc-dev 2023-04-07 22:06:24 +00:00
Haoyu Zhang
5a7bf6e00a Fix insert mode draws extra rectangle at the end of the first line
Bug: 276784691
Test: manually tested
Change-Id: If0433c9bb3744d4bd0385c11b6d5c37d299af196
2023-04-06 19:23:31 -07:00
Alice Yuan
d5494efd55 Merge "Update AnalogClock deprecation tag to be more explicit about the where it is deprecated and still supported" am: aacf42716b am: a9f6ea7e10 am: a94fb8d5f8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2523715

Change-Id: If614bd8019316363cca1dbd6a467733cbaa1a180
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-05 23:52:37 +00:00
Alice Yuan
97f78a0bef Update AnalogClock deprecation tag to be more explicit about the where it is deprecated and still supported
Change-Id: Iea142c219aad76a7e606c32ec3ec52e74252a567
2023-04-05 20:23:23 +00:00
Tyler Freeman
4c319d0774 fix(non linear font scaling)!: add ComplexDimensionUnit annotation to setLineHeight()
Bug: 273326061
Test: n/a
Change-Id: I28e489d4814a60507d43affa3517cf5a15d28ec0
2023-03-30 22:16:58 +00:00
Sihua Ma
d58bdf9b9f Upload bitmap to GPU in RemoteViews
Upload the bitmap to GPU when the RemoteView intends to use it.

Test: Manually verified that widget drawing method is accelerated by
approximately 2 micro seconds. The longest drawing time down from 52 micro seconds to 47 micro seconds.
Fix: 226298376

Change-Id: If57f3127dfa0c01550c8388a43a79acac37fcfb7
2023-03-30 00:45:49 +00:00
Johannes Gallmann
04c7e4a566 Merge "Fix requestRectangleOnScreen not called" into udc-dev 2023-03-29 07:17:13 +00:00
Tyler Freeman
1c42936dc2 Merge "fix(non linear font scaling): add a setLineHeight() that accepts explicit units." into udc-dev 2023-03-29 03:50:45 +00:00
Tyler Freeman
ba9126c49b fix(non linear font scaling): add a setLineHeight() that accepts explicit units.
This is so the TextView can properly calculate a proportional line
height when non-linear font scaling is in effect. Otherwise, a desired
2x line height at font scale 1.0 will not be 2x at font scale 2.0, due
to non-linear font scaling compressing higher SP sizes.

It also better mirrors the setTextSize() API.

The actual fix for calculating the proportional sizes will come in a
subsequent CL.

Bug: 273326061
Test: atest cts/tests/tests/widget/src/android/widget/cts/TextViewTest.java

Change-Id: I79d74ff4f5fe1886ca2ed9c4df708be484fd888f
2023-03-27 21:43:23 +00:00
Johannes Gallmann
4de1d1c3e3 Fix requestRectangleOnScreen not called
The requestRectWithoutFocus boolean was introduced in ag/20641595.

Bug: 263152665
Test: Manual, i.e. verifying requestRectangleOnScreen is called when TextView is focused
Change-Id: I13e2856fc0488526fccb4ab5d945d1d983d7c4d4
2023-03-24 10:05:03 +00:00
Felipe Leme
0d4546d1d4 Fixes Toast.show() for visible background users.
When its caller is a visible background user using a non-ui context
(like the application context), the Toast must be displayed in the
display the user was started visible on.

Test: atest --user-type secondary_user_on_secondary_display android.widget.cts.ToastTest#testShow_whenTextToast,testShow_appContext_whenTextToast

Test: atest android.widget.cts.ToastTest#testShow_whenTextToast,testShow_appContext_whenTextToast # to make sure the "normal" case still works

Test: atest NotificationManagerServiceTest

Fixes: 273314058
Bug: 272376728

Change-Id: I0a28d20462900eb0437781ab26d520be824014d1
2023-03-23 16:42:30 -07:00
Seigo Nonaka
200e8d2c26 Add icon to the context menu
This CL reuses cut, copy, paste, select all and share icon.
This CL adds new undo, redo icon from Material library.

Bug: 240385199
Test: Manually done
Change-Id: Ia88452de436d36a1d5f2cbf44e55a61be866f894
2023-03-22 15:23:00 +09:00
Julia Reynolds
e88e680d70 Merge "Add juliacr and jeffdq to owners of Toast.java" am: 80060eaa43 am: adbca36577 am: 593e383f03
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2493855

Change-Id: I039984d3fe2a9a33853b111a727049ad85c18897
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-20 19:23:24 +00:00
Julia Reynolds
80060eaa43 Merge "Add juliacr and jeffdq to owners of Toast.java" 2023-03-20 17:19:08 +00:00
Treehugger Robot
a2a8116412 Merge "Add Toast#show() specific javadoc" into android13-tests-dev am: 1d8b567ae1 am: f8ba53d9c9 am: 532379563a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2477605

Change-Id: Idfb45d95320bbb8bf0209a5fc73d275c1174ac2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-16 20:39:28 +00:00
Treehugger Robot
30cc06231e Merge "Add Toast#show() specific javadoc" into android13-tests-dev am: 1d8b567ae1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2477605

Change-Id: I6f3c95c46c67553fb88c85032ab80b6d1f503926
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-16 19:23:46 +00:00
Treehugger Robot
f8ba53d9c9 Merge "Add Toast#show() specific javadoc" into android13-tests-dev am: 1d8b567ae1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2477605

Change-Id: I0df3d37f69a0876d166e341a7fb7affe25777edc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-16 19:21:16 +00:00
Azhara Assanova
b6a0f1f9fc Add juliacr and jeffdq to owners of Toast.java
Test: N/A
Change-Id: I14595da84f41df6471a023465bac20a9a1521b4f
2023-03-16 13:28:44 +00:00
Riddle Hsu
405fbab6fe Merge "Remove window replacement" into udc-dev 2023-03-16 12:02:52 +00:00
Riddle Hsu
0fec5269b6 Remove window replacement
It is almost dead code because
- It was added for SurfaceView using a child window.
  But SurfaceView no longer uses a window for years.
- It only executes for 2 conditions:
  - Main window
    - For freeform, there was general change-transition which uses
      a screenshot of window container to animate.
    - For splitscreen, there is TaskOverlay to cover the change.
  - Child window (from ActivityThread r.mPreserveWindow)
    - Server side config change
      Always no-op because config change will clear drawn state
      and then WindowState#hasContentToDisplay return false that
      skips setWillReplaceWindow.
    - Client side calls Activity#recreate.
      But it usually only causes a removal timeout because app
      may not add the child window again.

So no case needs it anymore.

Bug: 163976519
Test: CtsActivityManagerDeviceTestCases

Change-Id: If78155ac453c02cda8bf448bb353061e861747fe
2023-03-16 00:47:56 +08:00
Seigo Nonaka
43748ce328 Merge "Connect TextFlag feature flag to the application process" into udc-dev 2023-03-15 11:10:28 +00:00
Haoyu Zhang
1733a2ab06 Fix: TextLine IndexOutOfBoundsException when input password
Bug: 271500223
Test: manually tested
Change-Id: If20f7b2a53972f9dfbf9b0c2d5d81b87f8eeffd7
2023-03-14 05:33:53 -07:00
Azhara Assanova
33f83bf7a5 Add Toast#show() specific javadoc
The added javadoc comment already exists in Toast's class level javadoc on line 75.

Bug: 265306493
Test: None
Change-Id: I5692db36461dae1f79a72eb2bb15d8379bd24a84
2023-03-10 14:02:06 +00:00
Seigo Nonaka
1a0efbedf7 Connect TextFlag feature flag to the application process
Bug: 240385199
Test: Manually done
Change-Id: I906260c2bd122bbf5fcad1e2231c643d77bbed8c
2023-03-03 18:29:50 +09:00
Daniel Norman
4c68e35d46 Merge "Rename AccessibilityDataPrivate -> AccessibilityDataSensitive" into udc-dev 2023-03-02 18:40:48 +00:00
TreeHugger Robot
4687a546e1 Merge "Adjust icon spacing for text alignment" into udc-dev 2023-02-24 14:57:16 +00:00
Daniel Norman
7ea7d33ca2 Rename AccessibilityDataPrivate -> AccessibilityDataSensitive
Also adds this as a boolean property for AccessibilityNodeInfo so that
accessibility services can query the property (for nodes visible to the
service) if they want to use it for behavioral changes.

Bug: 268509740
Test: atest AccessibilityNodeInfoTest (frameworks/base and cts)
Test: atest AccessibilityEndToEndTest
Change-Id: I05d30b1e709bde33b0f566210cd2513e3a566962
2023-02-22 16:48:11 +00:00
Seigo Nonaka
00e5b1f512 Adjust icon spacing for text alignment
Bug: 240385199
Test: atest TextViewContextMenuTest
Test: manually verified
Change-Id: I375d4069fb0e5c6da0115574cd839045652af22c
2023-02-22 15:04:13 +09:00
Achim Thesmann
860b4f6f65 Allow RemoteViews to start Activities via PI
A remoteview shows an UI rendered by another app and allows starting
that app's Activity. Since that App probably does not possess BAL
permissions the App showing the RemoteView needs to grant its
permissions.

Bug: 269240329
Test: manual testing with feature enabled
Change-Id: Ic2ec605631654cead5cb6cf47c4d0125b0765b7a
(cherry picked from commit cbef1ced75)
2023-02-21 17:22:34 +00:00
Josep del Rio
041219c9bc Add IME action to Enter editor action
At the moment apps need to support pressing "Enter" to search
differently if they want to support physical keyboard, as
currently no editor action is sent from it. This is a proposal
that will resolve that issue by sending that information.

Bug: 269672396
Test: built, flashed on device, confirmed pressing enter starts
the search

Change-Id: I1694303540295603097db2fd4e4206f1ca71cec0
2023-02-20 13:15:16 +00:00
Haoyu Zhang
9ebb0ec4af Merge "[Scribe] Support setTransformationMethod in insert mode" 2023-02-16 20:41:53 +00:00
TreeHugger Robot
561d143788 Merge "Set smart selection menu into context menu item" 2023-02-15 01:08:39 +00:00
Seigo Nonaka
54b3bd8c64 Disable new context menu
Bug: N/A
Test: N/A
Change-Id: I05b974ee1a88206fdf00cf3b61c3f8a877a6d379
2023-02-14 14:17:44 +09:00
Seigo Nonaka
b57c8180da Set smart selection menu into context menu item
This CL extract the common logic between ActionMode and ContextMenu and
put it to AssistantCallbackHelper.

Bug: 267984410
Test: atest TextViewContextMenuTest SelectionActionModeHelperTest
Change-Id: I82a1d4873cd34a250c920e91a88382b509a46adc
2023-02-14 12:54:19 +09:00
Seigo Nonaka
a57445f57a Put new context menu behind the flag
Bug: 240385199
Test: Manually done
Change-Id: I6ef81fcb793b9ed45d087a3d73adae3ef261286e
2023-02-13 14:52:31 +09:00
Seigo Nonaka
df1930321f Merge "Make icon visible on context menu" 2023-02-13 01:40:02 +00:00
TreeHugger Robot
24a3120fbd Merge "Fix cursor position after delete gesture" 2023-02-10 08:11:34 +00:00
Seigo Nonaka
5144448633 Make icon visible on context menu
Bug: 240385199
Test: manually verified
Change-Id: I530d0e3cc6ab4d49c215f6d603dbab978a09ec3d
2023-02-09 16:05:35 +09:00
Haoyu Zhang
ace5b65475 [Scribe] Support setTransformationMethod in insert mode
Bug:265871733
Test: atest TextViewHandwritingGestureTest

Change-Id: Ic7cbbc55930613ceeae3c3a2be732322982e9116
2023-02-08 17:01:44 -08:00
Justin Ghan
289aee901e Fix cursor position after delete gesture
Deleting text inside a selection causes the selection to be updated
asynchronously, so setting the cursor position synchronously after the
deletion could get overwritten by the asynchronous update.

This is fixed by setting the cursor position before deleting the text.

Bug: 266984004
Test: tested manually
Change-Id: I8801cc0bc9d0a3acd7952e2a88691f480c58d453
2023-02-08 13:07:07 -08:00
Haoyu Zhang
abdb05e9cb Merge "Refactor CursorAnchorInfoNotifier" 2023-02-08 20:04:55 +00:00