Commit Graph

16624 Commits

Author SHA1 Message Date
Ahaan Ugale
6bf4cb6147 Merge "Make InputMethodInfo#showInInputMethodPicker public." into sc-dev 2021-05-14 16:14:00 +00:00
Ahaan Ugale
76bf20fce7 Make InputMethodInfo#showInInputMethodPicker public.
Allows custom Input Method Pickers to exclude relevant IMEs, like the
system picker does now.

Fix: 184890628
Test: atest InputMethodInfoTest InputMethodManagerTest
Change-Id: I20033de2f6679ed8cd538de66e157f737792d847
2021-05-13 20:58:32 -07:00
Huihong Luo
f410f8134f Merge "Fix leakage of ASurfaceTransactionCallback" into sc-dev 2021-05-14 03:33:53 +00:00
Adam He
0a78fe6d5e Merge "Removed addValue from TranslationRequest because of potential bug in genrated builder code." into sc-dev 2021-05-13 22:03:42 +00:00
Adam He
af6aa6ffb7 Merge "Make getText() nullable and return null." into sc-dev 2021-05-13 20:52:48 +00:00
TreeHugger Robot
0d2041dec3 Merge "Do not recreate ImeInputEventSender for the same channel" into sc-dev 2021-05-13 18:55:14 +00:00
Ady Abraham
c49b886d73 Merge changes from topic "preferredDisplayModeId60120" into sc-dev
* changes:
  Enable preferredDisplayModeId for frame rate override
  Add preferredMaxDisplayRefreshRate
2021-05-13 15:59:00 +00:00
Ahaan Ugale
cc4fa5f3b6 Merge "Pipe UiTranslationSpec through to the UiTranslationController." into sc-dev 2021-05-13 15:24:12 +00:00
Siarhei Vishniakou
85d8f5c669 Do not recreate ImeInputEventSender for the same channel
InputEventSender is used to send events to an InputChannel. On the other
side, InputEventReceiver receives the events and processes them.

There's no good way to synchronize InputEventSender and
InputEventReceiver today. If the InputEventSender object changes in the
middle of interaction with the InputEventReceiver, it will confuse the
receiver. Recently added strict checking of state in InputEventReceiver
causes the other side to crash.

In the IME case, there are dup'ed InputChannel being compared to each
other by object. Since the objects are different, the equality check
fails, even though they represent the same connection. This causes the
InputEventReceiver to receive a sequence of events like this:

incoming event seq = 1
incoming event seq = 2
incoming event seq = 3
incoming event seq = 1
incoming event seq = 2
...

If the InputEventReceiver is slow, it might only send finished signal
after it processed first event with seq = 2, but the sender has already
changed, and has already sent a new event with seq = 2. This would cause
the receiver to overwrite the state of the second event with the first
event, thus later causing a crash when it tries to ack the second event.

The events received by the InputEventReceiver should all have unique
seq. The pattern of re-creating InputEventSender breaks this contract.

To fix this issue, we check whether the provided InputChannel represents
the same connection. If the connection is the same, we do not re-create
the InputEventSender, and just keep using the same object. This ensures
that InputEventReceiver is always communicating with only one
InputEventSender and the state remains consistent.

In this CL, only a minimal change is made, and it is not rootcaused why
the 'setInputChannelLocked' call is being made for the same connection.

Bug: 183434055
Test: adb shell monkey 10000; run this test several times until it
crashes. No more crashes observed with "Abort message: 'Could not find consume time for seq=2'"
Test: use soft keyboard on device

Change-Id: If8317941dd1c6d5db77f1239b9a9f45d49997df9
2021-05-13 00:06:28 +00:00
Ahaan Ugale
f765882432 Pipe UiTranslationSpec through to the UiTranslationController.
And use it to conditionally enable content padding for requested views.

Fix: 179693024
Test: atest android.translation.cts.UiTranslationManagerTest
Test: adb shell dumpsys activity <ACTIVITY> --translation
Change-Id: I23fb29a60525d736f2dcf9d11b548c62332c412c
2021-05-12 11:47:15 -07:00
Jeff DeCew
9e30756592 Merge "Show minimized header text with the correct text weight" into sc-dev 2021-05-12 17:57:57 +00:00
TreeHugger Robot
3d18b83a20 Merge "Fix UiTranslationSpec#shouldPadContentForCompat javadoc." into sc-dev 2021-05-12 14:00:03 +00:00
Ahaan Ugale
4b7d0eddc5 Fix UiTranslationSpec#shouldPadContentForCompat javadoc.
Corrects the documented behaviour to reflect the implementation.

Bug: 187739356
Test: n/a
Change-Id: I6b64ebf56e32da4d4718cfa6b5501e5314a62aac
2021-05-11 20:28:18 -07:00
Joanne Chung
f13de286ff Merge "API feedback: Translation View API improvement." into sc-dev 2021-05-12 00:29:53 +00:00
Jeff DeCew
9c1f4e12c9 Show minimized header text with the correct text weight
Fixes: 184863420
Test: visual
Change-Id: Ic16f9e88e118e7ea5fe14054cf1c35318d4a6ddd
2021-05-11 17:10:34 -04:00
TreeHugger Robot
ab367ab510 Merge "AttachedSurfaceControl: Respond to API feedback." into sc-dev 2021-05-11 19:13:05 +00:00
TreeHugger Robot
d85097d1ad Merge "Add android: to text constant to prevent namespace conflicts." into sc-dev 2021-05-11 12:50:54 +00:00
Ady Abraham
26c834522b Add preferredMaxDisplayRefreshRate
Add a new private window attribute for allowing apps to specify the max
display refresh rate. This is useful for use cases such as keyguard
where the refresh rate should be limited to preserve power.

In the next CLs the preferredDiplayModeId would be enabled for
frame rate override (60-on-120) and the preferredMaxDisplayRefreshRate
would be the alternative to control the display refresh rate (as opposed
to the frame rate experienced by the app).

Test: atest RefreshRatePolicyTest
Test: atest DisplayModeDirectorTest
Test: Launch camera app and observe refresh rate
Bug: 183226498
Change-Id: I1c5e9f6047cbea4bfb581251b8dd2b9058b3e378
2021-05-10 16:37:33 -07:00
Joanne Chung
1450a8706d API feedback: Translation View API improvement.
1. Rename dispatchRequestTranslation().
2. Provide what should be done in onViewTranslationResponse().

Bug: 186578468
Bug: 186578311
Test: atest CtsTranslationTestCases
Test: manual.
CTS-Coverage-Bug: 177960696

Change-Id: Id90e7d68a92ec17ec302d7ff05ef67c8bfa6454b
2021-05-10 17:19:09 +08:00
Adam He
d5a4499faa Removed addValue from TranslationRequest because of potential bug in
genrated builder code.

* if Builder.setValues is called with an immutable list, future calls to
addValue will throw.

Fixes: 187542825
Test: atest CtsTranslationTestCases
Change-Id: Ie405975e1a0a8aa90bde7358afde15b8c60aa95a
2021-05-07 16:41:15 -07:00
Adam He
b9cdc84c87 Add android: to text constant to prevent namespace conflicts.
Fixes: 187219011
Test: atest CtsTranslationTestCases
Change-Id: I980156c8653581aa5020afaa5bcb97e909d291df
2021-05-07 15:14:30 -07:00
Rob Carr
84c2f5bf21 Merge "SyncRtSurfaceTransactionApplier: Improve thread safety" into sc-dev 2021-05-07 22:11:00 +00:00
TreeHugger Robot
14449b8794 Merge "Add NO_FOCUS_CHANGE flag to MotionEvent" into sc-dev 2021-05-07 20:54:30 +00:00
Robert Carr
e9ea91f47d SyncRtSurfaceTransactionApplier: Improve thread safety
If the calling thread releases the SurfaceControl passed
to SyncRtSurfaceTransactionApplier concurrently with the
applier preparing the transaction, this can lead to a
synchronization error and a crash. Once the state is
inside the transaction no further synchronization is required
as the native transaction will hold its own sp<SurfaceControl>
reference. By constructing the Transaction on the calling thread
and deferring application to the RenderThread we enable the calling
thread to not have any release synchronization requirements with
RenderThread.

Bug: 186391509
Change-Id: I585e1a9d3baf9ea384b00408b6253f34487d5037
2021-05-07 18:53:00 +00:00
Huihong Luo
e76f181372 Fix leakage of ASurfaceTransactionCallback
The callback needs to set to null when thread renderer is destroyed.

Bug: 187419942
Bug: 186869429
Test: blaze test --test_strategy=local --test_arg=--device_broker_type=LOCAL_ADB_SERVER //javatests/com/google/android/testing/elizabot/internal/sanity/subscriptionleak:SubscriptionLeakTest_generic_phone_google_31_x86
Change-Id: Ic80c58f102ee5f21830542030021828f6231cc37
2021-05-07 08:17:26 -07:00
Adam He
bd20cf5004 Make getText() nullable and return null.
* Will update once we add more type values to this class.

Fixes: 187219782
Test: atest CtsTranslationTestCases
Change-Id: Ib8e9fbca70b6808370791da5bd8561dc9e8b1822
2021-05-06 17:19:58 -07:00
TreeHugger Robot
d8ef2b30f4 Merge "Add a default implementation of UiTranslationStateCallback#onResumed." into sc-dev 2021-05-06 23:07:12 +00:00
Evan Rosky
afb641756c Merge "Compat-rotate motion-events injected into dispatcher" into sc-dev 2021-05-06 22:08:20 +00:00
Ahaan Ugale
ebc8d5154a Add a default implementation of UiTranslationStateCallback#onResumed.
This is temporary, to avoid breaking clients that already implemented
the API before onResumed was added.

Bug: 185274258
Test: manual
Change-Id: Icd2c392e248f01c22b95e0b88ba56847ae71f10a
2021-05-06 13:48:58 -07:00
Evan Rosky
1476d63b2b Compat-rotate motion-events injected into dispatcher
With the flag, dispatcher operates in physical space, so
if injecting into dispatcher, the events need to be 'un'rotated.

Bug: 179274888
Test: atest Launcher3Tests:com.android.launcher3.ui.TaplTestsLauncher3
Change-Id: I9abdfd0540354ab6e3eac34ae15b784c0fcf6e2e
2021-05-06 12:18:42 -07:00
Evan Rosky
abc24090f0 Revert "Add reporting to monitor apps incorrectly using getRaw"
This reverts commit 8b82086722.

Reason for revert: Metrics no-longer needed, we are adding compat for this.

Bug: 187153492
Test: N/A
Change-Id: I31bbe36378a2da969a094405b0e0a7b7b9cde3a0
2021-05-06 01:44:51 +00:00
Robert Carr
599f912e4e AttachedSurfaceControl: Respond to API feedback.
"Root" is eliminated from the interface name as it is a property
of the object and not the interface, but remains highlighted in the
getters to express the relationship between the called and returned
object.

Bug: 185365821
Test: Existing tests pass
Change-Id: I163fc23f2c37c984ef3ffeb7514c4d8c1c1a3f90
2021-05-05 14:28:25 -07:00
John Reck
bd78fd02de Merge "Don't animate invisible views" into sc-dev 2021-05-05 18:19:40 +00:00
Joanne Chung
bd351242a9 Merge "API feedback: seperate start and resume state for UiTranslationStateCallback" into sc-dev 2021-05-05 06:36:24 +00:00
Joanne Chung
8e9d678ff0 API feedback: seperate start and resume state for UiTranslationStateCallback
Bug: 185274258
Test: manual
Test: atest android.translation.cts.UiTranslationManagerTest

Change-Id: Ic2246a9ef64a214ce39e187056a9add56e616d1a
2021-05-05 12:31:25 +08:00
Lucy Chang
bb52fabf07 Merge "Correct typo in TYPE_SYSTEM description" into sc-dev 2021-05-05 03:36:26 +00:00
Lucy Chang
4bdb297c10 Merge "Clarify javadoc for ACTION_LONG_CLICK" into sc-dev 2021-05-05 03:17:36 +00:00
Nader Jawad
603d612707 Merge "Update hole punch logic in HWUI" into sc-dev 2021-05-05 02:59:18 +00:00
Adam He
20e9693c3e Merge "Remove logging of translation requests/responses/chat related views." into sc-dev 2021-05-05 01:26:30 +00:00
John Reck
12bb4739d2 Don't animate invisible views
Bug: 184230269
Test: wasn't
Change-Id: Iec6eefedc2c82750ea721ae3d1184be1939066ef
2021-05-04 13:53:01 -04:00
Joanne Chung
2c6a3b5cd0 Merge "Fix UiTranslationStateCallback crash due to null locales." into sc-dev 2021-05-04 13:26:01 +00:00
Jorim Jaggi
a4d6988f12 Merge "Mark first frames in metrics properly" into sc-dev 2021-05-04 10:55:59 +00:00
lucychang
272103f2b7 Correct typo in TYPE_SYSTEM description
Correct typo in TYPE_SYSTEM description

Bug: 149000879
Test: manual test
Change-Id: Id98036af9b23de31e0980c80129c0d69452ccfa7
2021-05-04 16:34:35 +08:00
lucychang
de719fd8cf Clarify javadoc for ACTION_LONG_CLICK
Clarify in javadoc that ACTION_LONG_CLICK does not include coordinate
information.

Bug: 179692809
Test: manual test
Change-Id: I6a4edda48e140f9ba444fdef67feca4d3ed3d146
2021-05-04 15:26:37 +08:00
Ahaan Ugale
e19085a0cd Fix UiTranslationStateCallback crash due to null locales.
The locales aren't available on a RESUMED event; now they're stored on a
STARTED event. The crash happens because the default Callback impl
converts the Locale to a string to support a deprecated method.

Fix: 186392998
Test: manual - install test apk which triggers the crash. no crash with
 this change.
Change-Id: Iaceca8d29f4c2b0d692c8f6780b0ab963e4e2243
2021-05-04 05:35:26 +00:00
Nader Jawad
197743ff9c Update hole punch logic in HWUI
--Updated HWUI holepunch logic for SurfaceView to
also apply the stretch to the hole punch
--Updated RenderNode callbacks to also include
an offset from the ancestor RenderNode that also
has a stretch configured on it
--Added new test activity to verify hole punch
logic

Bug: 179047472
Test: manual
Change-Id: Ibbaf8248a31839ba9dc352ecb9fef54e1276918e
2021-05-03 18:08:47 -07:00
Adam He
7fa1b19c86 Remove logging of translation requests/responses/chat related views.
Bug: 176208267
Test: manual verification
Change-Id: Id76ac895c263a32506df6a6dc6a09495904e20cb
2021-05-03 17:29:10 -07:00
Nikita Dubrovsky
f3c059b9f0 Merge "Release drag-and-drop URI permissions on gc if not tied to an activity" into sc-dev 2021-05-03 21:53:10 +00:00
Nikita Dubrovsky
f333d26f0d Release drag-and-drop URI permissions on gc if not tied to an activity
The implementation for drag-and-drop provides two ways of taking URI
permissions: a public API that ties permissions to an activity and
an internal API that grants "transient" permissions. The latter is
used in a single code path: dropping content into an editable
TextView (implemented in android.widget.Editor).

The transient code path was previously (Android R and below)
implemented using a try/finally block in Editor.onDrop. The change
I7ae38069fb741925211b42c7ff28784eb9722ce3 had updated that logic to
tie permissions to the app process lifecycle instead, to account for
the new OnReceiveContentListener which apps can use to implement
custom drop handling (and use a background thread to do the processing
of the content). The problem with having permissions tied to the app
process lifecycle is that the app process could potentially be
long-running.

This change updates the logic to tie transient permissions to the
DragAndDropPermissions object lifecycle (release whenever there are no
more reference to the object and it is garbage collected). This
follows the same approach as used for IME permission grants
(InputContentInfo.java and InputContentUriTokenHandler.java).

Bug: 181178998
Test: atest CtsWindowManagerDeviceTestCases:CrossAppDragAndDropTests
Test: Manually verified using development/samples/ReceiveContentDemo
Change-Id: I950d4572ee19af64da1ace1572fe12e17d09c609
2021-05-03 16:36:56 +00:00
TreeHugger Robot
fe4a41f16b Merge "Fix SurfaceControl.setDisplayBrightness error msg" into sc-dev 2021-05-03 16:02:07 +00:00