Commit Graph

18449 Commits

Author SHA1 Message Date
xiaoxin
71e3abfa1e make sure mSurfaceLock.unlock can be executed in unlockCanvasAndPost
When the program is run to unlockCanvasAndPost method,
if mSurface.unlockCanvasAndPost throws an exception,
the mSurfaceLock.unlock() will not getting the chance to execute.

If an app executes unlockCanvasAndPost in a catch and does not handle the exception,
it will remain locked for a long time after the next execution of mSurfacelock.lock.

make sure the msurfacelock.unlock is executed after unlockCanvasAndPost

bug:245050059 in partnerissuetracker

Change-Id: Ib849c840c61ac261cfaab0daefa7ae2afdbfcba3
Signed-off-by: xiaoxin <xiaoxin@xiaomi.corp-partner.google.com>
2022-09-05 09:17:17 +00:00
Cole Faust
a1eb8cf128 Merge "Fix array-related errorprone warnings" 2022-08-30 18:03:01 +00:00
Treehugger Robot
3d8681e31d Merge "Exclude large tests from presubmit." 2022-08-29 20:52:36 +00:00
Cole Faust
584140c83a Fix array-related errorprone warnings
The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: Ia6f216cc36ad0a5758f39fd9b34962cd4adf9d8e
2022-08-25 10:57:12 -07:00
Adrian Roos
b773c4dade View OWNERS: include PendingInsetsController.java in the WindowManager rules
Change-Id: I8b22a55ccfe3690e9879fcce221c4488f86a9a83
2022-08-19 07:11:47 +00:00
Lucas Henneman
adbe824324 Exclude large tests from presubmit.
Bug: 222555677
Test: N/A
Merged-In: Ib19a2096a97367b37b3a22033ec2001693f23bff
Change-Id: I9ea72fd69a4771231b2342c50423cb1461d9ea09
2022-08-05 18:19:24 +00:00
Treehugger Robot
ef33f36050 Merge "Improve docs for generated properties in PropertyMapper" am: 46a915f625
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2165102

Change-Id: Ie0900ec085aa552075dc2f147125e0035d02b098
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-28 17:39:32 +00:00
Ember Rose
64a82e5c30 Improve docs for generated properties in PropertyMapper
Change-Id: I1e927013d14731d3be5024bc581ebd664f878eb9
Test: N/A
Bug: 237226979
2022-07-25 21:34:03 +00:00
Caren Chang
afc1b7d01e Merge "Add explanation about the purpose of accessibility heading and use case apps should consider." am: 407d531735
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2151635

Change-Id: If08ab9af3186e37a8e59863ac701d3679e18bd36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 22:29:08 +00:00
Caren Chang
02bbf4b30c Add explanation about the purpose of accessibility heading and use case apps should consider.
Change-Id: I01bdd1fc89d54e62e9ce1f8dc15a58d13c56fabc
Test: N/A, documentation chang
2022-07-18 21:19:44 +00:00
Xin Li
14164fb11a DO NOT MERGE - Merge TP1A.220624.013
Merged-In: I2f3d04546af58edbe7bae2b7d856ab3d87365fdf
Change-Id: Iaf981a42ffa918ec7dc0b86e533c5c8371872271
2022-07-11 21:47:41 -07:00
Wale Ogunwale
6a76e2cb6c Revert "Get rid of double measure"
This reverts commit 4234e6cea8.

Reason for revert: b/231383951

Change-Id: I41cbc5b4c036109cf45463bddb5b5cc12d11f88e
(cherry picked from commit 084bac819a)
Merged-In: I41cbc5b4c036109cf45463bddb5b5cc12d11f88e
2022-06-30 02:24:13 +00:00
Issei Suzuki
a49c0207fa Pass keyguard occluded status in onAnimationCancelled.
Test: No visible changes yet. Pass existing tests.
Bug: 235463625
Change-Id: Iabee71bc76e19f20702f8a2739f565aa915f9b52
Merged-In: Iabee71bc76e19f20702f8a2739f565aa915f9b52
(cherry picked from commit c77d9bda04)
Merged-In: Iabee71bc76e19f20702f8a2739f565aa915f9b52
2022-06-30 02:24:07 +00:00
Vadim Caen
b38e19fdc3 Merge "Prevent callback registration when back flag is disabled" into tm-dev am: 1c6de844ce
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18794217

Change-Id: I8054556537104bb80d940272b367ed9b8ffa520c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-20 21:02:34 +00: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
Vishnu Nair
b8616e8bed Merge "Updated OWNERS file" am: 1f02cb71f6 am: 2fb7421c5e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2128756

Change-Id: I3712dc538e0a665b7641b53c82c798dce9b6bfe6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-17 23:39:53 +00:00
Chavi Weingarten
3768beaf83 Updated OWNERS file
Test: N/A
Change-Id: I413016ac7d4a10c192009d30e3e0f74be986ffbb
2022-06-17 20:07:41 +00:00
Xin Li
195b02b570 Merge "Merge Android 12 QPR 3" 2022-06-16 18:51:54 +00:00
Louis Chang
e2aa1639a7 Merge "Make sure the relayoutWindow is called when Activity restarted" into tm-dev am: 909495e9d6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18886507

Change-Id: Iece28800aa6cb3ad007e155ee594a760e74ae724
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-15 06:18:43 +00:00
Cheng Shi
3ff201a713 Fix the problem that the turn_screen_on Activity does not draw.
A phone call came when the screen was off, displayState may change from Display.STATE_OFF to STATE_ON before registerDisplayListener, which causes ViewRootImpl.mAttachInfo.mDisplayState of InCallActivity to remain Display.STATE_OFF, which causes performDraw to return directly. So we should update ViewRootImpl.mAttachInfo.mDisplayState after registerDisplayListener.

Bug: 235446909

Change-Id: I60b2da453da0ac5c4df6e5a1040defe4bfe726ec
Merged-In: I60b2da453da0ac5c4df6e5a1040defe4bfe726ec
2022-06-15 01:01:28 +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
Cheng Shi
c6c0d0da5c Fix the problem that the turn_screen_on Activity does not draw.
A phone call came when the screen was off, displayState may change from
Display.STATE_OFF to STATE_ON before registerDisplayListener, which
causes ViewRootImpl.mAttachInfo.mDisplayState of InCallActivity to
remain Display.STATE_OFF, which causes performDraw to return directly.
So we should update ViewRootImpl.mAttachInfo.mDisplayState after
registerDisplayListener.

Bug: 235446909
Test: pass existing
Change-Id: I60b2da453da0ac5c4df6e5a1040defe4bfe726ec
2022-06-14 00:37:24 +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
Treehugger Robot
8b6b4752ff Merge "Fix AutofillManager NPE" am: 8032074e61
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2115080

Change-Id: I13b8fb4699966bfc748b087030f8f25d64bec521
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 10:40:17 +00:00
jiajia tang
1c53e50cf3 Fix AutofillManager NPE
Bug: 228529893

Change-Id: I2de34b24752eed089ca5d1e34d216c87dc3bf2c6
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Merged-In: If56d690882e8d4ad0dba1534f127478089c4d04f
2022-06-08 05:13:52 +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
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
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
6dadf45f60 Merge "Fix modulo div by 0 in Choreographer." into tm-dev 2022-06-03 19:03:33 +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
3868362584 Merge "Remove lock when calling Surface.destroy" into tm-dev 2022-06-01 16:36:34 +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
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
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
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
76ba87f909 Merge "Don't clear translation state on temporary detachment." into tm-dev 2022-05-27 17:15:29 +00:00
Mark Punzalan
a695631475 Don't clear translation state on temporary detachment.
Change I97cc418a8 broke translation on apps which use ListView; messages
were re-translated with the animation even while on-screen. A new
message arrival triggers a re-layout which causes the temporary
detachment, which caused translation to be cleared, and the views get
translated again later.

The solution is to NOT clear translation in the case of temporary
detachment. When Views are actually recycled (e.g., by ListView and
RecyclerView), the detachment is permanent/non-temporary.

Bug: 232178488
Test: atest UiTranslationManagerTest
Test: Manual - Verified scrolling and new messages arriving when
translation is enabled. Tested on apps that use ListView and
RecyclerView.

Change-Id: Ibf1be58219c43252e00b06d4c9e27def5bd36fc2
2022-05-26 23:57:13 +00:00
Mark Punzalan
8bbc7f6554 Merge "Translate selectable TextViews by temporarily disabling selectable." into tm-dev 2022-05-26 21:06:34 +00:00
Mark Punzalan
6758b3f7e7 Translate selectable TextViews by temporarily disabling selectable.
The text is not selectable while translated. Making translated text
selectable requires many more changes.

This was tested in Nextdoor in the feed/posts activity. When there is a
"Read more" link in the post, the link doesn't work while translated,
and doesn't behave the same way after translation is paused.

Bug: 202966891
Test: atest CtsTranslationTestCases
Test: Manually - with Nextdoor on feed and chat activities
Change-Id: I6e8f532d427d85ff22df0deb248d8416a15f4821
2022-05-25 20:03:10 +00:00
TYM Tsai
edca30dce8 Merge "Fix inline tooltip position is wrong" into tm-dev 2022-05-25 01:05:17 +00:00
Chavi Weingarten
96f4a2afc2 Merge "Add isClone to InputWindowHandle" into tm-dev 2022-05-24 16:57:32 +00:00
Tiger Huang
521ba43e12 Only update the compat system UI visibility if the source is valid
If two insets source consumers handle the same public type (like
navigation bar and taskbar both provide Type.navigationBars()), one has
a valid source but the other one doesn't, we should only let the one
with the valid source update the compat system UI visibility.

Bug: 232327949
Test: atest WindowInsetsControllerTests\
      #testSystemUiVisibilityCallbackCausedByInsets
Change-Id: I07b35f488c5af273cafaf4a8a41f0a51365038a0
2022-05-25 00:55:26 +08:00
TYM Tsai
3392d187eb Fix inline tooltip position is wrong
The PopupWindow will show up above the anchor with the real rectangle.
If the anchor is doing an animation, it will get a temporary top of the
anchor because the rectangle is conisince changed by the animation. So
attach tooltip after a while for waiting the animation is done.
And when the tooltip overrides the inline suggestion, clicking the
suggestion won't work. Force the y offset above or below the anchor to
fix the problem.

Bug: 223088398
Test: atest android.autofillservice.cts.inline.InlineTooltipTest
Change-Id: I068efc3d20f4486decd2c9e690ebeb2981fb6722
2022-05-24 21:33:54 +08:00
Chet Haase
b99cc5b4c8 Pause animators when app is not visible
Because animators are not tied to the lifecycle of any UI
elements, it is possible for an app to go into the background
and for the animators to continue running. Ideally, the app would
track the lifecycle of the activity/etc and pause or disable the
animators, but it is common for this to not happen, causing the
animators to continue spinning when the app does not need them.
The animators are not causing as much work as for a foreground
activity (since they do not cause any re-rendering), but they cause
work nonetheless by keeping Choreographer awake to continue pulsing
frames.

The ideal fix would be to introduce new API for animators that
tied them to lifecycle concepts (View, Activity, etc). But that kind
of fix would only be available for future versions of the platform,
and does not address existing app code. A workaround for the current
situation is to address the most egregious problems; infinite animators
running on backgrounded apps.

The fix here is exactly that: when an app's visible surface (either an
activity or, for Wallpapers, a WallpaperService) is backgrounded,
a request is sent to pause animators for that surface. When that surface
comes to the foreground, a request is sent to resume those animators.
Since all animators are handled on the same thread for the same process,
in AnimationHandler, we should only ever pause animators when *all*
surfaces for a process are not visible (and resume them when *any*
surface becomes visible). Also, to mitigate any issues with thrashing
animator state for apps which become only transiently backgrounded,
we delay pausing for some time.

Bug: 228598053
Bug: 233391022
Test: new AnimatorLeak CTS test, plus manual testing for activities
    and wallpapers

Change-Id: I8b9f841cc80babb972244c724968a5c085a06b69
Merged-In: I8b9f841cc80babb972244c724968a5c085a06b69
2022-05-23 20:31:19 +00:00
Shawn Lin
0f7cc0128b Replace DisplayManager.getStableDisplaySize with max Display.Mode
The DisplayManager.getStableDisplaySize is not the right way to get the
size we want for screen decorations and display team is going to get rid
of it.

Instead, we use the maximum display size supported by the display as the
base size to define the cutout and rounded corner configs.

Also fixed a bug that DisplayCutoutBaseView didn't update the
shoudDrawCutout config when display change.

Bug: 230227839
Test: 1. On foldable device, fold and unfold the device and check if the
         cutout is correctly drawn.
      2. On device supporting multiple resolutions, switch resolution
         between FHD & QHD and check if the cutout is correctly drawn.
Test: atest LocalDisplayAdapterTest DisplayCutoutTest
           ScreenDecorationsTest RoundedCornersTest
           DisplayCutoutBaseViewTest
Change-Id: I7a602b5abd7d6a21d17eae4f8e99414eaf765fa5
2022-05-21 14:56:30 +00:00