Commit Graph

4718 Commits

Author SHA1 Message Date
Michael Hoisie
f5733b0bda Remove unused native method Font$Builder.nGetReleaseNativeFont
The nGetReleaseNativeFont native method has been moved to the enclosing
Font class. JNI registration also does not occur for
Font$Builder.nGetReleaseNativeFont.

Test: m -j framework
Bug: 230032992
Change-Id: Ic987812cabe57c5c964b3cb8036cd7e297c11c36
2022-04-22 00:17:43 +00:00
Tim Murray
47032a2095 Icon: make Icon's Bitmaps immutable
Because Bitmap mutability is propagated across Parcel and Binder, the
following problem can happen when sending an Icon containing a Bitmap
as part of a Notification:

1. App creates Icon with a mutable Bitmap (1 alloc)
2. App sends Icon to system_server, often creating ashmem Bitmap (2 allocs)
3. system_server converts ashmem Bitmap back to heap Bitmap (3 allocs)
4. system_server sends heap Bitmap to each NotificationListener individually,
converting the heap Bitmap to ashmem each time (3+N allocs)
5. NotificationListener converts ashmem Bitmap to heap Bitmap (3+2N allocs)

This is inefficient. This is especially bad because the API to update
a Notification involves sending a full Notification object, including
Icons, repeatedly, and some apps do that several times per second.

Instead, ensure that all Bitmaps transmitted as part of Icons are
immutable. Instead, we get:

1. App creates Icon, which may copy to immutable Bitamp (1 or 2 allocs)
2. App sends Icon to system_server over ashmem (still 1 or 2 allocs)
3. system_server uses received ashmem Bitmap directly (still 1 or 2 allocs)
4. system_server sends same ashmem Bitmap to NotificationListeners (1 or 2)
5. Each NotificationListener uses the same ashmem Bitmap (1 or 2)

This solves the per-NotificationListener amplification, but it does
not solve sending what is likely the same Bitmap N times per second
when apps update Notifications. That will require either app changes
or Notification API changes to avoid bytewise comparisons for all
Bitmaps.

Test: boot, notifications work, memory in maps/gearhead remains good
Bug: 227920378

Change-Id: If92835f647a76da599f358c7c02888e3e2f59235
2022-04-21 18:54:53 +00:00
Robert Carr
7e53d0e9f5 ViewRootImpl/SurfaceView: Listen for queue stalls
Native machinery now reports queue stalls from native layer
up to java layer, which can more appropriately handle errors.
The first case we handle is the case of "stuck fences", generally
indicating GPU hangs. In this case we trigger a bespoke ANR rather
than waiting for an ANR in dequeueBuffers later. dequeueBuffers
ANR could have any number of causes, and this large cluster
is difficult to debug.

Bug: 216160569
Test: Existing tests pass
Change-Id: I7b4429ce96d0bbfa1b74534ddf2b447facb22d10
2022-04-15 15:13:04 -07:00
Chavi Weingarten
e3cc958b53 Merge changes from topic "presubmit-am-699bcbdaa9a54be3a56de1e065ef795a" into tm-mainline-prod am: 3f096a943a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17693701

Change-Id: I6a4b314d3495da4dd6ac319859f0e3387902c5bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-13 00:57:14 +00:00
chaviw
845d5ad06e Default to true for updateDestinationFrame in BBQ
In most cases, we do want the destination frame to be updated by BBQ.
The exception is SV due to multiple threads involved in property
changes. Change the default updateDestinationFrame to true and let SV
set it to false for their scenario.

Test: Apps with NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW work
Fixes: 228008717
Change-Id: I90ae6f0797633aa963c540a94f1cbaea9e498f23
2022-04-11 14:35:01 -05:00
Chavi Weingarten
62e3f326fa Merge "Add call to disable RT Animations" into tm-dev am: c1f9e4c0b9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17264107

Change-Id: Ideeb0b457b0b9311bba472f41787d7a45912a981
2022-03-24 01:23:12 +00:00
Chavi Weingarten
0f9cba9546 Merge "Add forceDrawNextFrame function for HardwareRenderer" into tm-dev am: 3e3c3ab2da
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17263076

Change-Id: Iaf253798ddd4a0d752a4138aeff906ee8adb8a74
2022-03-24 00:54:04 +00:00
Chavi Weingarten
c1f9e4c0b9 Merge "Add call to disable RT Animations" into tm-dev 2022-03-23 23:23:35 +00:00
chaviw
adba0b1861 Add forceDrawNextFrame function for HardwareRenderer
The forceDraw flag in HardwareRenderer will ensure a frame is drawn when
requested even if it would end up drawing multiple frames in a single
vsync.

This is to help blast sync when we want to synchronize the
buffer. We want to make sure we are guaranteed a callback since we don't
want to wait for retries, especially in the case when trying to synchronize
multiple buffers.

There was already a global flag to handle this, but would use the flag
for all draws. This new function is set per draw so once a frame is
drawn it's unset. The global flag was only used for tests so updated the
test to set the flag before every draw and deleted the global property.

Test: Underlying code was in place. This is just piping a new setter. No
usages yet.
Test: TestSceneRunner
Bug: 200284684

Change-Id: Ie1c9950cabb7331cfed1721564a51a1a15cd1624
2022-03-22 18:08:38 -05:00
chaviw
01053d4350 Add call to disable RT Animations
HWUI already supports disabling RT animations, but there was no correct
way to call it from the application. Adding a call to enable or disable
RT animations on the RenderThread so RT animations can be disabled
during a blast sync.

Test: Builds
Bug: 200284684
Change-Id: Ia1ae3498c38b84b4975f08d37bc764f0c690ed9f
2022-03-22 15:41:24 -05:00
Allen Su
508818fc58 Merge "Text Wrapping automation" 2022-03-22 05:44:23 +00:00
allenwtsu
f70429088a Text Wrapping automation
Bug: 220836284
Test: atest StaticLayoutTest
Change-Id: I2aead872b0b472b3c625e075348e46da768ff3be
2022-03-22 11:16:57 +08:00
Jay Aliomer
973fc119c5 Merge "Fix faint ripple" into tm-dev 2022-03-21 17:03:41 +00:00
Jay Aliomer
475648ae02 Fix faint ripple
Fixes: 224547325
Test: manual
Change-Id: I9c1da7a5065dca9620ebc1f3d88d5525f0d3527c
2022-03-18 01:32:15 -04:00
Jeremy Meyer
88000ab26e Merge "Have Typeface pass a cookie of -1 to search through all assets" into tm-dev 2022-03-16 20:44:06 +00:00
Jeremy Meyer
a07474c452 Have Typeface pass a cookie of -1 to search through all assets
Without this, when font are overlayed it will fail because it is looking
in the wrong place to load the font

Bug: 151770185
Test: Manual, example app that has a font that is overlayed
Change-Id: I64c5a436b7250cfd0a75f5de36c64f07a20d523a
2022-03-15 23:52:15 +00:00
Garfield Tan
bce590e356 Merge "Add argument checks in setScale and setCrop" into tm-dev 2022-03-15 20:53:04 +00:00
TreeHugger Robot
e8acb4a612 Merge "Update the text wrapping API." into tm-dev 2022-03-14 23:09:41 +00:00
Jay Aliomer
579e07b4dc Ripple mask shader not drawing properly
Test: using a test app
Fixes: 200069735
Fixes: 188112758
Fixes: 198177042
Fixes: 189485964
Change-Id: Ibc08e9945b1a57483beb93fa428be1ab0a5da9bb
2022-03-10 13:24:00 -05:00
James.cf Lin
396c789426 Update the text wrapping API.
1) Update the LineBreakConfig class to be immutable.
2) Do not return null in the PrecomputedText.Params#getLineBreaiConfig API

Bug: 216638444
Test: atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest; atest TextViewPrecomputedTextTest; atest StaticLayoutLineBreakingVariantsTest
Merged-In: I93bcb6ebc35344e34e9bb8a24df375aa7b3a8d81
Merged-In: I07766137ff6639c7d4acaad07dbcf11a2841cdb0
Change-Id: I07766137ff6639c7d4acaad07dbcf11a2841cdb0
2022-03-10 09:58:40 +00:00
Garfield Tan
a9d72c8ac3 Add argument checks in setScale and setCrop
They are now public API, so they should perform the same checks as in
respective calls with ASurfaceTransaction.

Bug: 210837722
Test: atest SurfaceControlTest
Change-Id: I1f17f8402dc116a419189f31faf351ffa967ecda
2022-03-08 17:01:59 -08:00
TreeHugger Robot
3237439170 Merge "Add class level JavaDocs for RuntimeShader." into tm-dev am: d0359461d2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17015736

Change-Id: I2c56377f60afc6df8a2b06e2fce3f028bd34d187
2022-03-08 01:49:00 +00:00
Derek Sollenberger
1d229b0890 Add class level JavaDocs for RuntimeShader.
Bug: 213869522
Test: N/A
Change-Id: I66e52575023839f70fa05048e4c08a4c6fc5faeb
2022-03-07 23:26:34 +00:00
Chavi Weingarten
8b58626267 Merge "Changed setSyncTransaction to syncNextTransaction with callback logic." into tm-dev am: 53f62e57cf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16988100

Change-Id: Ifdde57c9a8dd37be46dae07ed37629c8a94fcc49
2022-03-03 22:21:08 +00:00
Chavi Weingarten
53f62e57cf Merge "Changed setSyncTransaction to syncNextTransaction with callback logic." into tm-dev 2022-03-03 22:14:41 +00:00
Seigo Nonaka
e26eb8ce33 Add legacy emoji font file for compatibility
Bug: 222362958
Test: Manually verified Flutter Gallary shows emoji.
Test: atest CtsTextTestCases CtsGraphicsTestCases
Test: atest FontListParserTest

Change-Id: If5b5ddfb6d0d46cfb8d27cf66843ae95d4b50e03
2022-03-03 18:56:25 +00:00
Seigo Nonaka
0bc60e70da Add legacy emoji font file for compatibility
Bug: 222362958
Test: Manually verified Flutter Gallary shows emoji.
Test: atest CtsTextTestCases CtsGraphicsTestCases
Test: atest FontListParserTest

Change-Id: If5b5ddfb6d0d46cfb8d27cf66843ae95d4b50e03
2022-03-02 19:20:40 -08:00
Tianhao Yao
5ecd6d37de Changed setSyncTransaction to syncNextTransaction with callback logic.
Modified SurfaceView and ViewRootImpl to provide callbacks when syncing
a transaction instead of sending transactions. This will ensure a clear
ownership of the transaction object since it will be provided in the
callback when BBQ adds a buffer into the transaction. Modified JNI to
add compatibility for native functions.

Test: Manual testing from go/wm-smoke.
Test: BLASTBufferQueueTest
Bug: 210714235.
Change-Id: I1f872d6b2846b0d64d5b33b8866d0b2ec7126c8c
2022-03-02 09:55:46 -06:00
Wei Sheng Shih
97b4e59f97 Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev am: 172ea326de
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16972645

Change-Id: I87d2307ff74ba7d27f0c8d27270eb27b33c21f61
2022-03-02 06:39:33 +00:00
Wei Sheng Shih
172ea326de Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev 2022-03-02 06:24:50 +00:00
Vishnu Nair
f620de36e9 SurfaceView: Avoid destination frame updates on multiple threads 1/2 am: cb7a16280a am: 0813a53363
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16942380

Change-Id: I185b6cec2c70408e6f5e9614c6d8a211dfc29f98
2022-02-25 19:18:31 +00:00
wilsonshih
5e0c72a2c5 Estimate animation duration for AVD and AnimationDrawable
For Android S, we use the API windowSplashScreenAnimationDuration to
know the duration of the animatable icon would be, however, developers
can be confused to thought that this API is used to declare the
duration of splash screen.
To get the real duration of the animatable icon, if it is an AVD or
AnimationDrawable, try to get the animation duration from it.

Test: atest StartingSurfaceDrawerTests SplashscreenTests
Bug: 211707095

Change-Id: Ia3f8c5cd50bab164360e07d9ced87ff7f4321e96
2022-02-25 11:17:31 +08:00
Vishnu Nair
0813a53363 SurfaceView: Avoid destination frame updates on multiple threads 1/2 am: cb7a16280a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16942380

Change-Id: I3b5ece86d4c96f1513f22e18f11bcc65e56e9cb8
2022-02-24 23:42:08 +00:00
Vishnu Nair
7da5f02dc9 Merge changes from topics "cherrypick-sv-changes-8cq54jfvx9", "sv-changes-tm-dev" into tm-dev
* changes:
  SurfaceView: Synchronize all surface view changes with VRI draw
  SurfaceView: Avoid destination frame updates on multiple threads 1/2
2022-02-24 23:18:22 +00:00
Sally Qi
fee2980ddf Merge "Add conversion between @NamedDataSpace and ColorSpace.Named enums" into tm-dev 2022-02-22 17:41:40 +00:00
James Lin
2d26f03f3a Merge "Update the text wrapping API." 2022-02-19 01:31:52 +00:00
Vishnu Nair
cb7a16280a SurfaceView: Avoid destination frame updates on multiple threads 1/2
The caller such as SurfaceView can optionally apply destination
frame changes if they wish to synchronize buffer scale with other
scales in the hierarchy. This is hard to synchronize if the buffer
scale changes, since in fixed scaling mode we want the destination
frame to be applied when a buffer of the new size is queued.

This approach is brittle because SurfaceView does not have control
over the buffer production and the app can get into a scenario
where there is scaled incorrectly.

Fix this by configuring BBQ to always apply destination frame
changes or always defer to the caller. If the scaling mode is freeze,
then BBQ will set a flag to ignore the destination frame. This
allows us to synchronize destination frame changes with scale
applied by a parent and avoid unwanted scaling if the scaling
mode changes to freeze.

Test: atest SurfaceViewTest
Test: go/wm-smoke
Bug: 217973491
Change-Id: I5226c304bae9dde890306f8528dfeabf6b015a32
2022-02-19 00:08:04 +00:00
Sally Qi
f44f883540 Add conversion between @NamedDataSpace and ColorSpace.Named enums
- Add getDataSpace/getFromDataSpace in ColorSpace class

Bug: 220016464
Test: android.graphics.cts.ColorSpaceTest
Change-Id: Ic909c57045ffb6462a7f6b4768e515924715d09a
2022-02-18 22:02:51 +00:00
Sally Qi
045dad4d0e Merge "Add conversion between @NamedDataSpace and ColorSpace.Named enums" 2022-02-18 22:00:58 +00:00
John Reck
2cf5c84530 Add P010 constant for HardwareBuffer
Also fix a typo in ImageFormat's docs

Fixes: 218928677
Test: make
Change-Id: Icc5d32afac113e639a81a11c86bee1698ef12861
(cherry picked from commit 000c374e2b)
2022-02-18 21:59:27 +00:00
Sally Qi
97726de905 Add conversion between @NamedDataSpace and ColorSpace.Named enums
- Add getDataSpace/getFromDataSpace in ColorSpace class

Bug: 220016464
Test: android.graphics.cts.ColorSpaceTest
Change-Id: Ic909c57045ffb6462a7f6b4768e515924715d09a
2022-02-18 09:54:47 -08:00
James.cf Lin
4ae65dff9f Update the text wrapping API.
1) Update the LineBreakConfig class to be immutable.
2) Do not return null in the PrecomputedText.Params#getLineBreaiConfig API

Bug: 216638444
Test: atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest; atest TextViewPrecomputedTextTest; atest StaticLayoutLineBreakingVariantsTest
Change-Id: I07766137ff6639c7d4acaad07dbcf11a2841cdb0
2022-02-18 11:45:15 +08:00
TreeHugger Robot
6f14f3cd5b Merge "Add P010 constant for HardwareBuffer" 2022-02-18 02:19:43 +00:00
John Reck
000c374e2b Add P010 constant for HardwareBuffer
Also fix a typo in ImageFormat's docs

Fixes: 218928677
Test: make
Change-Id: Icc5d32afac113e639a81a11c86bee1698ef12861
2022-02-17 17:43:36 -05:00
Seigo Nonaka
9babbc0c59 Merge "Improve BoringLayout#isBoring for PrecomputedText" 2022-02-16 01:20:03 +00:00
Leon Scroggins III
73e0689d8a getDisplayDecorationSupport: return more detailed info
Call the updated native version of getDisplayDecorationSupport (added in
I961051c0a660b596039ac04b546040764ee20d34), and convert the NDK struct
into a Java class. Depend on the graphics AIDLs, which now have Java
backends. A future CL will update SysUI to call the new API.

Add a PixelFormat for R_8 to correspond to the native version. This will
allow SysUI to use COLOR_MODE_A8 when the HAL reports R_8.

If64fd6924960f592b7a211371bc2ca6536ae34f7 demonstrates using this.

Bug: 216644902
Test: manual
Change-Id: I0e34c6d6e369fda0a96231ab38c3bd5f3bfe3e06
2022-02-09 17:30:29 -05:00
Darwin Huang
e0e508a733 Merge "Fix misspelling in SurfaceTexture#attachToGLContext javadoc" am: 234748cd64 am: 90e9921817 am: 8661f99909 am: 529a12681e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1965260

Change-Id: I6f79ceb6c9310297d7d9900bab20678a7d136e2b
2022-02-09 17:27:47 +00:00
Darwin Huang
529a12681e Merge "Fix misspelling in SurfaceTexture#attachToGLContext javadoc" am: 234748cd64 am: 90e9921817 am: 8661f99909
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1965260

Change-Id: Ic63a1cc63ecfcee8c610ac7ce3595c4d51e326a9
2022-02-09 17:10:07 +00:00
Darwin Huang
234748cd64 Merge "Fix misspelling in SurfaceTexture#attachToGLContext javadoc" 2022-02-09 16:17:27 +00:00
Chavi Weingarten
3d421ecf42 Merge "Add gatherPendingTransactions in BBQ" 2022-02-09 15:41:48 +00:00