Commit Graph

18529 Commits

Author SHA1 Message Date
Tiger Huang
228988d5e7 Merge "Send the attached frame to the client" into tm-qpr-dev 2022-06-23 06:11:07 +00:00
Chavi Weingarten
7534f6e76f Merge "Prevent windows from drawing if they're in an active sync set" into tm-qpr-dev 2022-06-21 21:52:38 +00:00
Yunfan Chen
d9fa425f92 Merge "Print layout extended by cutout private flag in toString()" into tm-qpr-dev 2022-06-21 05:43:03 +00:00
Vadim Caen
9e2a134dde Merge "Prevent callback registration when back flag is disabled" into tm-dev am: 1c6de844ce am: 0592820f44
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18794217

Change-Id: I367c3888b726f0f7c83d382881741478e715d549
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-20 21:19:32 +00:00
Tiger Huang
157514510f Send the attached frame to the client
The attached frame is the frame of the parent window that its child
attaches to, as long as the child is not
TYPE_APPLICATION_ATTACHED_DIALOG. It is a factor while computing the
window frame.

Previously, we let the child obtain the attached frame from its parent
view root. However, if the parent and the child are not in the same
process, it can be tricky.

This CL sends the attached frame from the server to the client via
ClientWindowFrames. In this way, the child can compute its window frame
without having to accessing the parent view root.

Bug: 161810301
Bug: 175861127
Test: atest ActivityRecordTests WindowLayoutTests
Change-Id: Ia844a4c927027e305a56114216eaee2bf7933b1f
2022-06-20 21:09:40 +08:00
Vadim Caen
a2e45f1ed1 Prevent callback registration when back flag is disabled
When the enableOnBackInvokedCallback is set to false (or not set),
registering an OnBackInvokedCallback should be a no-op to avoid
overriding the default compat callback.

Test: Manual testing registering a callback on an app with the flag
disabled and doing a back gesture. Currently we don't have test
executing a back gesture so automated tests are not possible

Bug: 235206960

Change-Id: I54d843f11130a78ed5a68cbe4722e601a2086ee1
Merged-In: I54d843f11130a78ed5a68cbe4722e601a2086ee1
(cherry picked from commit aa48dc3c2d)
2022-06-20 11:40:18 +02:00
An An Yu
37b3f06461 Merge "Setup T style clear top transition animation for ActivityEmbedding." into tm-qpr-dev 2022-06-15 21:21:21 +00:00
Yunfan Chen
6bc2232a3c Print layout extended by cutout private flag in toString()
This is missing while introduced the new private flag. To include it and
print it out when it's set to help debugging layout related issue.

Bug: 236101339
Test: LayoutParams#toString()
Change-Id: Ifa37a989f497f6f6d0f4d2ac2f884f83d537c9aa
2022-06-15 18:29:20 +09:00
Louis Chang
c885c27e57 Merge "Make sure the relayoutWindow is called when Activity restarted" into tm-dev am: 909495e9d6 am: 046ee5ce74
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18886507

Change-Id: I26d4b5afbc5a00a400a8b54d9d3e205cdcff48ca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-15 06:22:33 +00:00
An An Yu
588e1f94d2 Setup T style clear top transition animation for ActivityEmbedding.
This registers system default clear-top xmls and propagate the
showBackdrop flag.
Test: atest RemoteAnimationsControllerTest
Bug: 221048002

Change-Id: I664f7edd181fd7d625b7010a77cd1f7b58fc3113
2022-06-14 13:36:57 -07:00
Pablo Gamito
e58a36c1c3 Merge "Expose transaction id" into tm-qpr-dev 2022-06-14 14:41:25 +00:00
Tiger Huang
f017558a95 Merge "Replace WindowState#getLayoutingAttrs with LayoutParams#forRotation" into tm-qpr-dev 2022-06-14 12:36:25 +00:00
Louis Chang
4b91fbf942 Make sure the relayoutWindow is called when Activity restarted
The host visibility was always invisible while making an Activity
window active because the host visibility was updated afterward
(in ActivityThread#handleStartActivity). Therefore, #relayoutWindow
could be skipped and not recreating Surface if the view visibility is
not changed since last traversal.

Bug: 226324982
Test: repro steps on the bug
Change-Id: Id677a375bc2f75b055a9d35c8b8488e97c24eae9
2022-06-14 17:23:42 +08:00
Tiger Huang
c003eacc7c Replace WindowState#getLayoutingAttrs with LayoutParams#forRotation
When LOCAL_LAYOUT is enabled, the client needs to use the params for the
rotation to layout.

Bug: 161810301
Test: presubmit
Change-Id: I41c94970a600a7a4a3d5bcbab9e79adc1d93d72e
2022-06-14 16:31:34 +08:00
Chavi Weingarten
acc2838241 Merge "Make sure VRI waits for SV to draw before report" into tm-dev am: 4c2c7ebfaa am: 1ee9e52fe4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18820396

Change-Id: I8284e93eeac89f6693ccef251ceda92db41d0b85
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-13 23:38:17 +00:00
chaviw
d1ada44ddb Prevent windows from drawing if they're in an active sync set
If a window is in a sync, but it already drew it's sync buffer, it
normally would be allowed to continue processing draws and just block
when it runs out of buffers. It would unblock once the sync is complete
at the sync buffer was sent to SF. However, this has a few issues

1. In some cases, WMS wants to retry the draw again due to configuration
   changes. This could cause deadlocks because the client may already be
   blocked since there are no more buffers. Instead, the client will
   block and WMS would be responsible for dropping the last buffer and
   notifying the client that it can draw for a sync again

2. If there are multiple UI threads, each can block each other due to
   the shared Render Thread. If one of the windows in the sync continues
   to draw and then blocks RT due to no more buffers, all other UI
   threads are unable to draw. If the behavior in 1 is desired, we'd
   need to make sure no one in the same sync continues to draw until
   everyone is complete. This is to ensure dropping will actually allow
   another render to occur. If other windows are blocking the RT, then
   even with dropping, the requested sync window cannot get another buffer
   and will cause a deadlock.

Test: Current sync requests work
Bug: 233625646
Change-Id: I3a0a4f36bf61a6677507672578e447060b806651
2022-06-13 13:21:55 -07:00
Tiger Huang
12b430a7a0 Merge "Fix InsetsState#calculateUncontrollableInsetsFromFrame" into tm-qpr-dev 2022-06-13 12:28:18 +00:00
Yunfan Chen
7ced0e2438 Refine the provide insets parameters
There're 3 different parameters trying to affect the insets provided by
a window and can be set independently but are related. This change will
make a new class InsetsFrameProvider to let the window set all the
information needed for the insets at the same place.

Besides, this change also extends the insets calculation logic to
support more use cases. With this, the bars can provide insets outside
of its window frame as well.

Test: atest DisplayPolicyLayoutTests
Bug: 161689946
Bug: 232044523
Merged-In: I7059b3a222745818b6852a288416e197e2afd7b2
Change-Id: I7059b3a222745818b6852a288416e197e2afd7b2
2022-06-13 03:13:37 +00:00
chaviw
783ae3c7d9 Make sure VRI waits for SV to draw before report
VRI is not currently waiting for SV to draw since SV may start its draw
before VRI opened the SyncSet. If that happens, VRI will not include SV
in its SyncSet and report draw finished even if SV is not complete.

This fix has SV create its own SyncSet when redrawNeeded. Then if VRI
creates a sync, SV will merge its own SyncSet into that one. If SV
already finished drawing, then nothing will get merged, but it means SV
is ready already. If SV is not finished, VRI will now also wait for SV's
draw to finish before calling finishDraw.

Test: Long delay in surfaceRedrawNeededAsync
Test: SurfaceSyncerTest
Bug: 230998394

Change-Id: I44331b8f54951e6dc633a4845bbf690abde0f95e
2022-06-10 12:15:00 -05:00
Pablo Gamito
0ada73d3f5 Expose transaction id
We will need to dump the transaction id in transition traces to be able to reliably associated the start and end of a transition to the states in the SF trace.

Bug: 230462538
Test: N/A
Change-Id: I2a040503d9e1f4f4636549bae6b7fe12d5632049
2022-06-10 11:05:49 +00:00
Chavi Weingarten
78b2a87d6b Merge "Report sync complete when VRI won't draw" into tm-dev am: 72a26f7912 am: 8ebe22e33b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18775294

Change-Id: I6cd47246a4046e634e1a5189cf15beab41c17a6c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 21:58:22 +00:00
Chavi Weingarten
72a26f7912 Merge "Report sync complete when VRI won't draw" into tm-dev 2022-06-07 21:14:42 +00:00
Chet Haase
f6541ab73e Pause animators when app is not visible am: b99cc5b4c8 am: f2e66fa4ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18528824

Change-Id: I4a220654954199c26f29a93d8afc3ad8a448547e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 20:28:07 +00:00
Chet Haase
f2e66fa4ed Pause animators when app is not visible am: b99cc5b4c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18528824

Change-Id: I2b041e112cfa55949a9d3f753388de3536dbd33a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 20:06:35 +00:00
Steven Terrell
a4ac1574bd Merge changes from topic "stop-leaked-animators" into tm-dev
* changes:
  Use System Property to Control Animator Pausing
  Disable debug logging in AnimationHandler
  Allow system to disable behavior of pausing animators for bg apps
  Pause animators when app is not visible
2022-06-07 19:49:48 +00:00
chaviw
71e6329765 Report sync complete when VRI won't draw
There is some checks in performDraw that will skip drawing. For example,
if the display is off or if there's no view. In those cases, we don't
want to wait for a frame since there will be none and instead
immediately report back that the sync for this VRI is complete.

Test: Repro from bug
Fixes: 234426290
Change-Id: I7d5993f9980b9cdafc99a5712e74a4de704aef47
2022-06-07 12:02:07 -05:00
Tiger Huang
2f6389cd28 Merge "Don't set extreme values of Integer to safe bounds" into tm-dev am: 0a194469f0 am: 7f00295029
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18746081

Change-Id: I774a3bb0757ee8e59897eea05b0bce26e2f14877
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 12:41:43 +00:00
Tiger Huang
32dd1b916a Don't set extreme values of Integer to safe bounds
This is to prevent getting unexpected results while calculating the
width or height of the rectangle, due to the overflow.

This CL defines the borders of the window layout with large enough
integers, which are also the borders of the safe bounds.

Fix: 227276622
Test: atest ConfigurationScreenLayoutTest#testScreenLayout
Change-Id: Iee14e6de48f57be4999f64dbdce01815de88a9df
2022-06-06 13:02:59 +00:00
TreeHugger Robot
8e8c28eea2 Merge "Fix modulo div by 0 in Choreographer." into tm-dev am: 6dadf45f60 am: 994032fc1f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18718035

Change-Id: I2f73342ddf5ab1e6dfafb2050eb90766eb1b1de7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-04 00:12:58 +00:00
TreeHugger Robot
6dadf45f60 Merge "Fix modulo div by 0 in Choreographer." into tm-dev 2022-06-03 19:03:33 +00:00
TreeHugger Robot
2b27ef0a4b Merge "Make GPU duration metrics more accurate for Vulkan" into tm-dev am: 9bcdb76b98 am: 258905ed7e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18639113

Change-Id: Ia75d3e4724d5e91b0ca5cf19d1b2bf402629387f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-02 06:43:38 +00:00
TreeHugger Robot
9bcdb76b98 Merge "Make GPU duration metrics more accurate for Vulkan" into tm-dev 2022-06-02 06:12:33 +00:00
Rachel Lee
2c303b3f51 Fix modulo div by 0 in Choreographer.
Bug: 234483897
Test: atest ChoreographerTest
Change-Id: I7d7766f6ea120109490d307e971a3da80a3d92ad
2022-06-01 15:24:05 -07:00
Alec Mouri
3afb3972f4 Make GPU duration metrics more accurate for Vulkan
In the Vulkan pipeline, the GPU start time was measured to be when
swapBuffers starts. But the command queue has already been submitted at
this point, which means that the GPU work would already have begun. This
means that it's possible to measure a negative time since for very light
GPU workloads, the GPU fence can fire prior to CPU making it to
swapBuffers().

To compensate, instead measure from after skia completed submitting GPU
commands, until the GPU fence fires. Since it is theoretically possible
for GPU work to complete if the render thread gets descheduled
immediately after submitting the GPU, we also add some clamping to
ensure that the duration from command submission -> completion of GPU
work is nonnegative.

Bug: 230713131
Test: atest android.view.cts.FrameMetricsListenerTest
Change-Id: Ia30b7732eaab71e4e29766f788d5cd94ec63c38a
2022-06-01 21:18:30 +00:00
Chavi Weingarten
beab74891e Merge "Remove lock when calling Surface.destroy" into tm-dev am: 3868362584 am: 9eb9c476f3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18674393

Change-Id: I729b871bde2b714f8fb85795af0f3b6aeabfee34
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 17:27:04 +00:00
Chavi Weingarten
3868362584 Merge "Remove lock when calling Surface.destroy" into tm-dev 2022-06-01 16:36:34 +00:00
Pablo Gamito
9fd0212e95 Merge "Revert "Revert "Add ability to trace shell transitions""" into tm-qpr-dev 2022-06-01 12:19:49 +00:00
TreeHugger Robot
0232f47db6 Merge "Log why presentation was not shown" into tm-dev am: bd26701a6b am: e25d1148e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18519537

Change-Id: I6a7a3a46319f614e4a13cf73ffdd328714970c08
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 09:17:05 +00:00
TreeHugger Robot
bd26701a6b Merge "Log why presentation was not shown" into tm-dev 2022-06-01 08:04:53 +00:00
Ryan Lin
e49dcfca1b Merge "Drop the cloned windows from visible window list" into tm-dev am: 8ef351123b am: 2684945fb5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18659076

Change-Id: Ib2521d2807afeeb61614532957caa48c82785d7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 01:52:06 +00:00
Ryan Lin
8ef351123b Merge "Drop the cloned windows from visible window list" into tm-dev 2022-06-01 01:29:36 +00:00
skxu
48a5cbb2d6 Log why presentation was not shown
Fixes: 219613425
Test: b/233833739
Change-Id: Ic95cc69b912e8144726124ebc8355c2d1e24079e
Merged-In: Ic95cc69b912e8144726124ebc8355c2d1e24079e
2022-06-01 00:10:02 +00:00
chaviw
9e3cd0533f Remove lock when calling Surface.destroy
Surface already has a lock on the native object so it's safe to call
destroy without holding additional locks. This also fixes ANR issues
where an app is still attempting to render when the window is destroyed.

Test: App from bug doesn't ANR
Bug: 234006724
Change-Id: I0d323c03f299e5857d1950870498f3182d019924
2022-05-31 13:48:56 -05:00
Tiger Huang
ea97f83f8f Fix InsetsState#calculateUncontrollableInsetsFromFrame
If a type of insets doesn't provide any insets to a window, the previous
logic would think the type is controllable. This is wrong.

If a type of insets provides the entire inset to a window, the previous
logic would think the type is not controllable when the width or height
doesn't match the display frame. This doesn't make much sense as well.

This CL fixes the issues mentioned above and also refines
WindowInsetsTests. It displays the name (string) of the controllable
types, not the value (number).

Fix: 234426300
Test: WindowInsetsTests
Test: atest InsetsControllerTest
Change-Id: Ice71db61cc4963c6d8489096bec9c295d58bfd78
2022-05-31 13:38:29 +00:00
ryanlwlin
70764c141a Drop the cloned windows from visible window list
Currently the cloned windows is avaialbe from window list,
however the node info from the cloned window is incorrect.
To avoid confusion, we would drop them for a short term solution.

Bug: 230300971
Test: manually test with switchaccess
      adb shell dumpsys accessibility to observe the window list
Change-Id: I7a03376567698a493c9eb5e26d1f3390aacdb408
2022-05-31 13:48:08 +08:00
Pablo Gamito
fcdcd75faf Revert "Revert "Add ability to trace shell transitions""
This reverts commit 0dced9da30.

Reason for revert: Re-land change

Change-Id: I6f0159d239582c655d3a10f57f10a54f42967ebd
2022-05-30 14:42:34 +00:00
Tiger Huang
d95834c214 Merge "Only update the compat system UI visibility if the source is valid" into tm-dev am: 1fab45404b am: 8893bc9d06
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18583184

Change-Id: I887327b4d504f7c9576f11bf263c8e4d942c757e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-30 09:20:07 +00:00
Tiger Huang
1fab45404b Merge "Only update the compat system UI visibility if the source is valid" into tm-dev 2022-05-30 08:40:03 +00:00
Mark Punzalan
b8432ae0ad Merge "Don't clear translation state on temporary detachment." into tm-dev am: 76ba87f909 am: 29e91d3a0a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18624095

Change-Id: Ie2f7e9d9f56c31ba342b790e565b547728524bae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 17:57:31 +00:00
Mark Punzalan
76ba87f909 Merge "Don't clear translation state on temporary detachment." into tm-dev 2022-05-27 17:15:29 +00:00