Commit Graph

8560 Commits

Author SHA1 Message Date
Jeff Sharkey
ea636fd945 Merge changes from topic "apr19" into rvc-dev am: b67e70aa40 am: ed91f7aabf am: a650421e92 am: a719ff7c61
Change-Id: I315e0b8f3a4309298951fed20c5a706f4707fd6a
2020-04-21 23:33:54 +00:00
Jeff Sharkey
b67e70aa40 Merge changes from topic "apr19" into rvc-dev
* changes:
  Update some Parcelables to send Strings UTF-8.
  Offer to write Strings through Parcels as UTF-8.
2020-04-21 22:59:40 +00:00
Jeff Sharkey
0223df096c Update some Parcelables to send Strings UTF-8.
An earlier CL with benchmarks has shown that sending strings as UTF-8
is 50% faster for US-ASCII strings, and still 68% faster for complex
strings referencing higher Unicode planes.  (So an improvement in
both cases!)

Since code across the OS still makes heavy assumptions about Parcel
strings typically being UTF-16, we need to carefully migrate
Parcelables by hand, which is what this CLs begins doing.

This is a purely mechanical refactoring with no functional changes.

Bug: 154436100
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ia9e581efd7c40269342b7528ca07363deb843c0f
2020-04-21 22:59:26 +00:00
Nikita Dubrovsky
ec0d63e9fc Merge "Rename RichContentReceiver.SOURCE_MENU to SOURCE_CLIPBOARD" 2020-04-21 18:14:25 +00:00
Joanne Chung
beb25afa62 Merge "Fix app crash if the selection is from reverse direction." into rvc-dev am: 4661207775 am: a922f821a8 am: 1c5842823a am: 2342e2f0c4
Change-Id: I6b06e5ad8c2f9168b292d0cf0b910bd4d1c40421
2020-04-20 07:11:00 +00:00
Joanne Chung
4661207775 Merge "Fix app crash if the selection is from reverse direction." into rvc-dev 2020-04-20 05:55:46 +00:00
Nikita Dubrovsky
bc495089fd Rename RichContentReceiver.SOURCE_MENU to SOURCE_CLIPBOARD
Using "menu" was ambiguous since ACTION_PROCESS_TEXT is also triggered
via the menu but has its own enum value.

Bug: 152068298
Bug: 154151141
Test: ran tests
  atest CtsWidgetTestCases:TextViewRichContentReceiverTest
Change-Id: I3805577e9d7bbf55d40339d37820cd7f510da37e
2020-04-19 22:55:37 -07:00
Hui Yu
4d488db68a Merge "Move noteAppWidgetTapped call into AppWidgetHostView." into rvc-dev am: 4db77a9749 am: 40c8596a10 am: 5a0784ed87 am: 99e5cb35fa
Change-Id: Ie318b4891c83db57c917c45be17f401b4f12491b
2020-04-18 05:42:20 +00:00
Hui Yu
4db77a9749 Merge "Move noteAppWidgetTapped call into AppWidgetHostView." into rvc-dev 2020-04-18 04:03:52 +00:00
Nikita Dubrovsky
b66a027f1d Merge "Integrate ACTION_PROCESS_TEXT with RichContentReceiver" 2020-04-17 17:16:04 +00:00
Nader Jawad
ee13e3cbcd Merge "Updated TextView#setCompoundDrawableTintList documentation to refer to BlendMode.SRC_IN instead of PorterDuff.Mode.SRC_IN" 2020-04-17 01:13:34 +00:00
Nader Jawad
2e40bb8b1e Merge "Updated TextView#setCompoundDrawableTintList documentation to refer to BlendMode.SRC_IN instead of PorterDuff.Mode.SRC_IN" into rvc-dev 2020-04-17 01:11:59 +00:00
Nikita Dubrovsky
90b8d4995a Integrate ACTION_PROCESS_TEXT with RichContentReceiver
Bug: 152068298
Bug: 152808432
Test: Ran existing/new tests for ACTION_PROCESS_TEXT
  atest FrameworksCoreTests:TextViewTest
  atest FrameworksCoreTests:TextViewProcessTextTest
Change-Id: Idf88839f96087cdc403ea1b5413c238413e005d3
2020-04-16 14:54:55 -07:00
Shu Chen
ba5955d210 Merge "Prevents multi touch among TextView and handle reviews." into rvc-dev am: 9b6af1dcc5 am: f4d56c5846 am: 124c5949d4 am: bf33940153
Change-Id: I1124d9c2acb5c96b6e21a1c21c396944bb00607d
2020-04-16 16:13:54 +00:00
Shu Chen
9b6af1dcc5 Merge "Prevents multi touch among TextView and handle reviews." into rvc-dev 2020-04-16 15:32:32 +00:00
Joanne Chung
cb3c97db0c Fix app crash if the selection is from reverse direction.
When user types some text and then long presses on end of empty area
to open context menu, if user opens Gboard and selects text from the
reverse direction, SelectionEnd will be less than SelectionStart. The
IllegalArgumentException occurred because TextClassification does not
allow SelectionEnd is less than SelectionStart. We swap the start and
end index if end index is less than start index.

Bug: 150916165
Test: Manual. No crash occurs.
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest

Change-Id: I8dbc92f0f31e64b7e3a45ae91762e1b741629a8e
2020-04-16 17:37:05 +08:00
Shu Chen
eb8b1ba3df Prevents multi touch among TextView and handle reviews.
- First touch on TextView blocks secondary touches on handles.
 - First touch on handles blocks later touches on TextView but doesn't block secondary touches on other handles.

Bug: 150995597
Test: manually tested & automation tests:
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest
Change-Id: I7717fc061fc81514fc1dad0d3acbc73e683516cf
2020-04-16 13:58:10 +08:00
Hui Yu
4803268229 Move noteAppWidgetTapped call into AppWidgetHostView.
RemoteViews is public API used out of scope of widget. The correct place
to call noteAppWidgetTapped is in AppWidgetHostView.

Fix: 153676411
Test: manual test, tap a widget, "adb shell dumpsys usagestats | grep
USER_INTERACTION" to oberserve USER_INTERACTION event sent to UsageStas, "adb shell dumpsys appops | grep appWidgetVisible" to observer appWidgetVisible flag.

Change-Id: Ic473211b91fd952dbb81b09b1e1568d6f69a0dd8
2020-04-15 22:06:12 -07:00
Nader Jawad
18e49a9bd4 Updated TextView#setCompoundDrawableTintList
documentation to refer to BlendMode.SRC_IN
instead of PorterDuff.Mode.SRC_IN

Fixes: 151952140
Test: N/A
Change-Id: Ie4b9a585c2dae49e633f6741180b6749493d069a
2020-04-15 20:26:10 +00:00
Nader Jawad
af5ff36051 Updated TextView#setCompoundDrawableTintList
documentation to refer to BlendMode.SRC_IN
instead of PorterDuff.Mode.SRC_IN

Fixes: 151952140
Test: N/A
Change-Id: Ie4b9a585c2dae49e633f6741180b6749493d069a
2020-04-15 20:21:52 +00:00
Sally Yuen
d74bcd3ca2 Merge "Check for text when adding CollectionInfo and CollectionItemInfo" into rvc-dev am: 387529809d am: 9f924154dc am: 6c546f7350 am: 8dc832099f
Change-Id: I3351d99c6e8df0e0426d607e9ab4400a1bc297cd
2020-04-07 17:43:41 +00:00
Sally Yuen
387529809d Merge "Check for text when adding CollectionInfo and CollectionItemInfo" into rvc-dev 2020-04-07 17:06:04 +00:00
Bernardo Rufino
4aef02d1e6 Merge "Wire user info and use user context for text toasts" into rvc-dev am: 2de79fb6fd am: ec0e67b052 am: 8499e595fe am: 95cc45f79f
Change-Id: Ic2121b6fe6509537a61eedb46307e6bb094ee3ce
2020-04-06 22:52:14 +00:00
sallyyuen
5a5c74f350 Check for text when adding CollectionInfo and CollectionItemInfo
Generally, the button's text is displayed next to the check box, but
Sound Settings uses its own views to display the text, distinct from
RadioGroup and RadioButton. This results in TalkBack announcing out
of list state too early, since the text content is not considered
part of the collection.

Add a check to exclude buttons with no text when counting the children
to be in the collection. Developers should be either setting the button
text or implementing their own views to appear alongside the buttons.

Bug: 149064784
Test: Added CTS test. Manual testing of Settings -> Sound -> Do no
disturb -> Advanced -> Set Duration for Quick Settings

Change-Id: Ie9abe4cccc4ab53e79a583b9a2ce45535dcf1cc0
2020-04-06 14:00:21 -07:00
Bernardo Rufino
78f5d83ac8 Wire user info and use user context for text toasts
Text toasts don't currently support multi-user. This CL prepares toasts
for multi-user by wiring the user information from who requested the
toast (in the form of uid) to ToastUI, where text toasts are actually
rendered.

We go only as far as obtaining a new user-specific context for that user
and using that to construct the view. Actual support will come in future
CLs.

Bug: 151414297
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
      ToastWindowTest ToastUITest NotificationManagerServiceTest
      LegacyToastTest
Change-Id: I8c92453c6a2b73c31f9a41ca9ff463d194d4f44f
2020-04-06 20:20:09 +01:00
Nikita Dubrovsky
ce3894baa4 Merge "Minor javadoc fixes for RichContentReceiver API" 2020-04-06 17:47:59 +00:00
Nikita Dubrovsky
186b4eba0a Minor javadoc fixes for RichContentReceiver API
Bug: 152068298
Test: Presubmit
Change-Id: If86fa3d68ae2af616f234a3fe283f333c29888cd
2020-04-03 17:57:19 -07:00
Automerger Merge Worker
1d0031bf41 Merge "Merge "Refactor ToastPresenter to perform show()/hide()" into rvc-dev am: 918db9ecde am: 9a2f55df99" into rvc-d1-dev-plus-aosp am: 34460a2f67 am: 7af99a7101
Change-Id: I994e37b4b940f96fcb9df49d2957e7e4dfad1dc0
2020-04-03 17:03:18 +00:00
Bernardo Rufino
dd4f238127 Refactor ToastPresenter to perform show()/hide()
In order to support multi-user, we need to create a new context based on
the user id and retrieve the services from it
(http://b/151414297#comment9). This meant retrieving the services in
ToastUI.showToast() instead of on its constructor, which would make the
code diverge from Toast$TN.handleShow(). In order to avoid that, now
seemed a good time to refactor ToastPresenter to perform show() and
hide().

This means ToastPresenter will now be instantiated in every request for
a new toast in ToastUI, but fortunately with the refactor we were able
to get rid of ToastEntry (which was also beign instantiated in every
request).

Also found out a bug with this where window tokens were being used to
locate the toasts instead of the (non-window) tokens. This is a bit
confusing because the method NM.finishToken(package, token) receives a
non-window token to locate the ToastRecord and then finish its window
token. This didn't have any side-effects because NM itself finishes the
tokens after a time-out. Added a test for this.

Bug: 152973950
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
      ToastWindowTest ToastUITest NotificationManagerServiceTest
      LegacyToastTest
Change-Id: I13cf18890ca22022adb7576c8ecf3285a9b82299
2020-04-03 12:57:08 +00:00
Bernardo Rufino
feb39a637a Merge "Rename test in TEST_MAPPING" into rvc-dev am: 884e9515d6 am: f2c0580ea2 am: 0ed8b87bd3 am: e2b6aaf551
Change-Id: I4fa1d411e81a3ceca8dbcbb577796ff522ce23a1
2020-04-03 11:23:43 +00:00
Bernardo Rufino
884e9515d6 Merge "Rename test in TEST_MAPPING" into rvc-dev 2020-04-03 10:02:09 +00:00
Bernardo Rufino
434c17c0e6 Rename test in TEST_MAPPING
ToastTest became ToastWindowTest in ag/10919524, updating TEST_MAPPING
to reflect that.

Test: croot frameworks/base/core/java/android/app && atest --dry-run --test-mapping
Test: croot frameworks/base/core/java/android/widget && atest --dry-run --test-mapping
Test: croot frameworks/base/services/core/java/com/android/server && atest --dry-run --test-mapping
Bug: 152973950
Change-Id: I5b9e9b83d17c4a93a1e830c26d7f44001ccf175d
2020-04-03 08:48:00 +01:00
Feng Cao
f8347366d2 Merge "Define custom equals method for bundles in the inline APIs" into rvc-dev am: 257aa916ac am: 8ab445a7a9 am: 3f185c6881 am: 6c8b4417cc
Change-Id: Iff11cae258441c0adbccc16bf28b2ccc2f61d252
2020-04-02 18:34:58 +00:00
Feng Cao
59b682f5cd Define custom equals method for bundles in the inline APIs
Test: atest android.view.inputmethod.cts
Bug: 152811052

Change-Id: I15051493bb37f05b579b16d6e7fee36b05ab10cc
2020-04-01 12:46:15 -07:00
Feng Cao
9c6842e884 Merge "Replace Nullable bundle with NonNull and use Bundle.EMPTY" into rvc-dev am: f1771c0d33 am: 12a7be983b am: b6ad7232ad am: 85ff58a80a
Change-Id: I053719f33f9319312087b1f4ef0ae1589952e46a
2020-04-01 03:16:24 +00:00
Nikita Dubrovsky
832edc3cc9 Add unified API for inserting rich content (e.g. pasting an image)
The new callback provides a single API that apps can implement to
support the different ways in which rich content may be inserted.

The API is added to TextView and unifies the following code paths:
* paste from the clipboard (TextView.paste)
* content insertion from the IME (InputConnection.commitContent)
* drag and drop (Editor.onDrop)
* autofill (TextView.autofill)

Corresponding API in support lib: aosp/1200800

Bug: 152068298
Test: Manual and unit tests
  atest FrameworksCoreTests:TextViewRichContentReceiverTest
  atest FrameworksCoreTests:AutofillValueTest
  atest FrameworksCoreTests:TextViewActivityTest
Change-Id: I6e03a398ccb6fa5526d0a282fc114f4e80285099
2020-03-31 15:15:36 -07:00
Feng Cao
edb332c645 Replace Nullable bundle with NonNull and use Bundle.EMPTY
Test: atest InlineSuggestionsRequestTest
Bug: 152525467

Change-Id: Ie510e08ced8be4cc8df486f1acfa6eb330d194ef
2020-03-31 14:50:51 -07:00
TreeHugger Robot
fa5431d8fa Merge "Properly layout InlineContentView" into rvc-dev am: 7f70f707b5 am: cb5de77e05 am: 705877256b am: 171e46ee9d
Change-Id: I62beabf1e624e9ff0a7b71f6ec0c3aa4c2af9717
2020-03-31 06:23:45 +00:00
Svet Ganov
5baa279868 Properly layout InlineContentView
bug:152723089
bug:152319052

Test: atest android.view.inputmethod.cts.InlineSuggestionTest

Change-Id: I656c2fb75560719210aa1efe8b9f06a0ced4d7e0
2020-03-31 03:37:24 +00:00
Adam He
1830552d39 Merge "Migrate android.view.inline to android.widget.inline" into rvc-dev am: 5a3a3f2239 am: c47f8abf1c am: c70f5e6254 am: 970ff93fa9 am: 321c7868fd
Change-Id: I5f2e3be463ce8a04e5475d4891acb2481ab831a6
2020-03-30 19:12:15 +00:00
Adam He
f27433af0f Migrate android.view.inline to android.widget.inline
Old APIs are kept and marked as @hide + @removed to maintain
compatibility.

Bug: 151262653
Test: manual verification
Change-Id: Ia50a1f87c194211be5256e948d43fb54c1cbf941
2020-03-29 17:29:32 -07:00
Shu Chen
79812eedc1 Merge "Calculates the slop values per upper/lower line height." into rvc-dev am: 27daeb0307 am: 1bb808525d am: 06e177368b am: 01755d22e8
Change-Id: I77430e4dbcfee7bc81b6e836594dcd43d7aa453e
2020-03-25 11:08:37 +00:00
Bernardo Rufino
32d774c9a8 Merge "Gate toast block and remove warning" into rvc-dev am: 7afc8b101b am: fed3f548d3 am: 36e998520a am: 0af032a87e
Change-Id: I4cce87e4661b9d47d2558794f54a48096206fba9
2020-03-25 10:33:58 +00:00
Shu Chen
27daeb0307 Merge "Calculates the slop values per upper/lower line height." into rvc-dev 2020-03-25 09:54:48 +00:00
Shu Chen
afbcf851d3 Calculates the slop values per upper/lower line height.
Also applies the max/min damping range for slop.
The max/min damping range includes lineHeight + slop.
Note: slop must >= zero.

Bug: 150531840
Test: manual & automated tests
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest

Change-Id: I26cdf69fd2cf7d4514dd2a902ed34c480c9e8781
2020-03-25 15:56:06 +08:00
TreeHugger Robot
13480370e3 Merge "Clarify Toast.Callback javadoc" into rvc-dev am: 8ac8b257f1 am: a0ffa7d718 am: eaa961f2a1 am: 72774da3d2
Change-Id: I72075202d424069960c15ce6a60ef493f0439271
2020-03-24 21:13:52 +00:00
Bernardo Rufino
c797aac41e Gate toast block and remove warning
Gate background custom toast block on targetSdk for beta 1, after
having gathered dogfood feedback. So, enabling the change for apps with
targetSdk > Q (>= R). Also removed warning toast.

Added tests in topic CL to cover all the cases.

Bug: 144152069
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
Change-Id: If368a97a2a8ff56770635615f89c79007bb27075
2020-03-24 20:22:18 +00:00
Bernardo Rufino
255094826d Clarify Toast.Callback javadoc
Text was ambiguous and could mean callback object construction instead
of toast construction.

Test: Builds
Bug: 144152069
Change-Id: I06160de2b85f339517ae45d3bd4cc1098f433ef0
2020-03-24 18:12:44 +00:00
Hui Yu
c30238be22 Merge "Update AppOps & UsageStats when app widget tapped." into rvc-dev am: aa3d42b129 am: aab97af060 am: 8b7fcb5766 am: d4d426a94c
Change-Id: Ib6ad73f64e04a4fdd1bf53cce628af06bc52139a
2020-03-21 20:52:54 +00:00
Hui Yu
3dc45fbc57 Update AppOps & UsageStats when app widget tapped.
When the app widget on the launcher is tapped on:
1. Update AppOps. AppOps treats the underlying app as foreground so the app can get while-in-use
permission.
2. Report a USER_INTERACTION event to UsageStats so UsageStats can
update mLastTimeUsed and mLastTimeVisible of this package.

Bug: 149043079
Test: manual test, tapped on a widget.
Change-Id: Ic8c91190881cf5dcf89f0f72cfd410b0c2e86bf6
2020-03-21 08:36:54 -07:00