Commit Graph

16749 Commits

Author SHA1 Message Date
Siarhei Vishniakou
000beba278 Merge "Check mInputEventReceiver before sending timeline -- 2" into sc-dev am: 234adf7cb2 am: 12318a45bd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14350504

Change-Id: I55ef308fcebb9323496916fffa8d7b8af24ff3ae
2021-05-19 23:20:43 +00:00
Jeff Sharkey
e97c037d19 Apply AttributionSource during Intent delivery. am: dd6dd3b1fb am: 2d0e8e3d5d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14470318

Change-Id: Iac0646b8065a4e70ec0366db19943db33ba2e40b
2021-05-19 22:47:13 +00:00
Winson Chung
6b917e7216 Merge "Add fallback animation for auto-enter without source rect hint" into sc-dev am: 79914dfbd5 am: f4e6b4efba am: 61ab0fa320
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14105379

Change-Id: Ibfcb25cc29b213b2d514c6d650e46207d2a778a4
2021-05-18 20:22:03 +00:00
Siarhei Vishniakou
234adf7cb2 Merge "Check mInputEventReceiver before sending timeline -- 2" into sc-dev 2021-05-17 17:35:24 +00:00
Jeff Sharkey
dd6dd3b1fb Apply AttributionSource during Intent delivery.
There are some Parcelables which offer to perform Binder calls, and
when these are delivered via Intent extras they fallback to
ActivityThread.currentAttributionSource(), instead of being tagged
based on the relevant app component.

This change begins using Intent.prepareToEnterProcess() as a hook to
fix-up AttributionSource when those extras finally land in the
destination process.  It uses the relevant AttributionSource based
on the Activity or Service the Intent is delivered to, which
developers have control over via AppComponentFactory.

In the case of <receiver> manifest elements, this change applies the
first android:attributionTags value to the Context used for that
BroadcastReceiver.

Bug: 187097694
Test: atest AttributionTest
Change-Id: I8f5197db7e8d7277d34f0ef2bb90bfdf1871186a
2021-05-15 09:48:14 -06:00
Winson Chung
79914dfbd5 Merge "Add fallback animation for auto-enter without source rect hint" into sc-dev 2021-05-14 23:44:23 +00:00
Ahaan Ugale
78b1525f9c Merge "Fix IndexOutOfBoundsException when calling dispatchProvideStructure()" into sc-dev am: 9e22972568
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14442225

Change-Id: Ib5fb32c868130ecddb6b4e69673ac6cb0ffe8017
2021-05-14 21:18:33 +00:00
Ahaan Ugale
9e22972568 Merge "Fix IndexOutOfBoundsException when calling dispatchProvideStructure()" into sc-dev 2021-05-14 21:15:18 +00:00
Ahaan Ugale
083a25ff5b Merge "Make InputMethodInfo#showInInputMethodPicker public." into sc-dev am: 6bf4cb6147
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14489960

Change-Id: I20d6c8e37d649c0438f74bf3650f0a00f461eb69
2021-05-14 16:22:01 +00:00
Ahaan Ugale
6bf4cb6147 Merge "Make InputMethodInfo#showInInputMethodPicker public." into sc-dev 2021-05-14 16:14:00 +00:00
Huihong Luo
fdfd0d25de Merge "Fix leakage of ASurfaceTransactionCallback" into sc-dev am: f410f8134f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14454598

Change-Id: I30d356f30bbbaad0f3c09db600847c1aef722c5a
2021-05-14 04:32:50 +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
d9641ba9b7 Merge "Removed addValue from TranslationRequest because of potential bug in genrated builder code." into sc-dev am: 0a78fe6d5e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14471493

Change-Id: I91f0a66079e9b75df9f2dbb0cd5c26c89f0104ad
2021-05-13 22:07:00 +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
f7f45e358d Merge "Make getText() nullable and return null." into sc-dev am: af6aa6ffb7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14444961

Change-Id: I6d54d25388e150fc78d38e5778311f422be64367
2021-05-13 20:55:37 +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
ecc18d14e3 Merge "Do not recreate ImeInputEventSender for the same channel" into sc-dev am: 0d2041dec3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14229516

Change-Id: I7484c6aa892666fc7489f9a156ff2a3f24d9f346
2021-05-13 19:01:47 +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
fd490502aa Merge changes from topic "preferredDisplayModeId60120" into sc-dev am: c49b886d73
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14185079

Change-Id: I1b548d9b4666c30750cb13657d783c649ea04c3e
2021-05-13 16:22:00 +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
824e387465 Merge "Pipe UiTranslationSpec through to the UiTranslationController." into sc-dev am: cc4fa5f3b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14510558

Change-Id: Id006d635005a08b619a99742b7b8d41ad950a7f8
2021-05-13 15:37:30 +00:00
Ahaan Ugale
cc4fa5f3b6 Merge "Pipe UiTranslationSpec through to the UiTranslationController." into sc-dev 2021-05-13 15:24:12 +00:00
Winson Chung
8aa6016bb3 Add fallback animation for auto-enter without source rect hint
- Launcher will create a new surface which is faded in over the app,
  and as it finishes the recents animation, we transfer the overlay
  from the leash to the task (as with the transform), and when the
  pip task organizer receives it, it can fade out and remove the
  surface
- Fixes flash of status bar colors when going from light status bar
  to home (dark status bar) by deferring whether a task affects the
  sysui flag until it enters pip (only for autoenter)

https://recall.googleplex.com/projects/e3f080d7-2818-43f0-a087-405000b8fdf5/sessions/971a84c8-a622-4b34-a9de-4e595595da42

Bug: 184703546
Test: Swipe up from app with auto-enter but no source hint rect

Change-Id: I0a00cdb98d0a599ef065206e0cd2cfc0e6cc72b1
2021-05-12 23:53:25 -07: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
e07dcedf9b Merge "Show minimized header text with the correct text weight" into sc-dev am: 9e30756592
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14506599

Change-Id: Ifa55cc928ea55696eb9fc46f8878710bd1d71a90
2021-05-12 18:00:25 +00: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
0d8c939e20 Merge "Fix UiTranslationSpec#shouldPadContentForCompat javadoc." into sc-dev am: 3d18b83a20
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14506857

Change-Id: Id01636b431584c3112f06a4d554951b047a7e9c0
2021-05-12 14:16: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
9d7d389eb2 Merge "API feedback: Translation View API improvement." into sc-dev am: f13de286ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14326990

Change-Id: I00d85356561bd5ff09f007e1a4bd038e72f88996
2021-05-12 00:35:37 +00: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
c406ed409f Merge "AttachedSurfaceControl: Respond to API feedback." into sc-dev am: ab367ab510
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14443528

Change-Id: I5379ca05d097ffd510245f611bdd90263b901206
2021-05-11 19:46:19 +00:00
TreeHugger Robot
ab367ab510 Merge "AttachedSurfaceControl: Respond to API feedback." into sc-dev 2021-05-11 19:13:05 +00:00
TreeHugger Robot
ed63ba4f24 Merge "Add android: to text constant to prevent namespace conflicts." into sc-dev am: d85097d1ad
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14444768

Change-Id: Ia43e71acb33caf6c417d0c9857f651b758e77dc2
2021-05-11 12:55:06 +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
Rob Carr
b29c9c0a5d Merge "SyncRtSurfaceTransactionApplier: Improve thread safety" into sc-dev am: 84c2f5bf21
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14445476

Change-Id: I1b95bcd15fd06fa5af3ac61b1cdfe51fe6c088f8
2021-05-07 22:26:46 +00: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
c2e0167133 Merge "Add NO_FOCUS_CHANGE flag to MotionEvent" into sc-dev am: 14449b8794
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13837775

Change-Id: Ie3c4a1ab687f24f01516de877baada85461bbad1
2021-05-07 21:14:16 +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
Siarhei Vishniakou
b3ea67fa42 Check mInputEventReceiver before sending timeline -- 2
Try to submit the 'Check mInputEventReceiver' patch again.

This reverts commit 35fccc4535.

Reason for revert: Added a check to ensure that only valid data is
getting sent. Now, the InputChannel will not be closed because all
InputMessages will always be valid.
Added logging to help investigate the reason why the present time is in
the past of the gpuCompletedTime.

Original commit message:

Previously, it was possible to receive a FrameMetrics callback after the view was already detached from window. In that situation, the mInputEventReceiver is set to null and the object is disposed.

But InputMetricsListener used to store another reference to mInputEventReceiver. So it's own object was never set to null. We would then try to send the timeline to native input receiver, and crash because the native object has already be deleted by the earlier dispose() call.

So the sequence of events was:

dispatchDetachedFromWindow
mInputEventReceiver.dispose()
native input receiver is deleted
InputMetricsListener::onFrameMetricsAvailable
mInputEventReceiver.reportTimeline
try to access a native object using a null pointer
crash

A few options to fix this were investigated:

1) Unregister the observer when mAttachInfo.mThreadedRenderer is set to null.

This is good to do, but it's not sufficient. The problem is that the native call to RenderProxy 'removeObserver' is not serviced immediately, but is posted to be completed sometime in the future. Therefore, the crash would not be fixed by it.
Still, we should always register the observer for the active threadedRenderer, which is done in this CL.

2) Keep a weak reference to mInputEventReceiver inside InputMetricsListener. This would allow InputMetricsListener to check on the status of mInputEventReceiver. When it's disposed, it would be also set to null, so the weak reference resolution would fail.

Unfortunately, 'mInputEventReceiver' is not the only reference to the object of WindowInputEventReceiver. It turns out that the receiver is also stored inside the queued events (see class QueuedInputEvent { private InputEventReceiver mReceiver }). From reviewing ag/153113, it should be OK to remove the receiver from QueuedInputEvent and simply keep track of whether the event is synthesized or not.
But, that change would be too significant to make in this CL. Also, weak references have performance impact, so this may not be desirable anyways.

3) Do not store mInputEventReceiver in InputMetricsListener
The chosen option is to simply use the variable mInputEventReceiver from the outer class. If the receiver is null, we don't notify about the metrics.

Bug: 169866723
Bug: 184255546
Bug: 184771626
Bug: 185015591
Bug: 186664409
Test: verified on fold 2 device, open/close the phone, touch remains
operational
Test: atest InputEventSenderAndReceiverTest
Change-Id: I01076d771e9432f08a3b5f8426c14759b56f3e12

Change-Id: Ie71c9ed38051e3e5ec9cb089951d759f52937fdd
2021-05-06 19:46:37 -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