Commit Graph

4575 Commits

Author SHA1 Message Date
Wei Sheng Shih
172ea326de Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev 2022-03-02 06:24:50 +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
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
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
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
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
John Reck
2be791c7de Merge "Add setDataSpace SurfaceControl API" 2022-02-08 21:49:24 +00:00
Melvin Moreno
4a441d640f Merge "Fixed documentation typo on TextAlign getter and setter methods - Reported on http://b/216852542" am: 3c48391809 am: 09707846a2 am: b01b828294 am: ef67857929
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1977166

Change-Id: I5af6e86d9912efe78db59b623c77504b7df5a87a
2022-02-08 20:57:24 +00:00
Melvin Moreno
ef67857929 Merge "Fixed documentation typo on TextAlign getter and setter methods - Reported on http://b/216852542" am: 3c48391809 am: 09707846a2 am: b01b828294
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1977166

Change-Id: I1c72983a9e35447f7389c75b65382e29458c4a93
2022-02-08 20:32:51 +00:00
Melvin Moreno
4f24757202 Fixed documentation typo on TextAlign getter and setter methods - Reported on http://b/216852542
Change-Id: I950251451d49f97c8c3ef0539218189d4ff74ab6
2022-02-08 17:45:42 +00:00
chaviw
e12e51892a Add gatherPendingTransactions in BBQ
Instead of applying the pending transactions when a frame wasn't
rendered, we gather the transactions and merge them with the transaction
that will be used to sync. This is to ensure these frames are sent to
the caller that requested the sync so they can ensure it's applied at
the correct time.

Test: Builds and run
Bug: 200284684
Change-Id: I087c67138f31cc93e79df42c29464ab4f7989d52
2022-02-08 11:22:57 -06:00
John Reck
ffa81f86ba Add setDataSpace SurfaceControl API
Also change DataSpace from long to int (HAL & native are both ints)

Bug: 217776226
Fixes: 218320444
Test: make && SurfaceControlTest#testSurfaceTransaction_setDataSpace
Change-Id: Ic2b9ccb1d0ba3c1d049839310b4fef0881a3d2e2
2022-02-08 03:05:30 +00:00
Derek Sollenberger
a04c237023 Merge "Remove isOpaque from RuntimeShader" 2022-02-07 15:12:30 +00:00
Derek Sollenberger
7843e51a80 Remove isOpaque from RuntimeShader
Skia can now detect this performance optimization
automatically so there is no need to increase the
exposure of the public API.

Test: atest CtsUiRenderingTestCases
Bug: 201546136
Change-Id: I5f80259530a08506f54cef59b4b1940e940bfe91
2022-02-04 14:11:15 +00:00
Alan Viverette
ad5658bb16 Nullability annotations for animation and graphics
I inferred nullability annotations in Jetpack based on the guaranteed
behavior of the platform, so now I'm propagating those inferences back
to the platform as annotations.

Test: nullability presubmit checks
Fixes: 206801689
Change-Id: If969bbe8a2263a3dd6cc1497a01354648a8795e9
2022-02-03 17:03:47 -05:00
Seigo Nonaka
6b9b5167e1 Improve BoringLayout#isBoring for PrecomputedText
Bug: 216736786
Test: atest PrecomputedTextTest
Test: perf score becomes 758,071 -> 110,755
Change-Id: I57d3eb9d1e896ed1c847733c4e96ac52dd97d2c4
2022-02-03 15:25:59 +09:00
TreeHugger Robot
6193b1f659 Merge "Expose 1010102 config for bitmap" 2022-01-29 17:51:09 +00:00
Darwin Huang
7bd04e97a2 Fix misspelling in SurfaceTexture#attachToGLContext javadoc
I assume "unusued" was supposed to be "unused"...

Change-Id: Id44a21cca0aadb054e395450ab57b200b5f65a9d
2022-01-28 19:12:08 +00:00
Alec Mouri
1efd0a5df6 Expose 1010102 config for bitmap
Bug: 200307898
Test: CtsGraphicsTestCases
Change-Id: I33153e080292a95c0cc3d6edada8b274f0b06ac7
2022-01-27 22:55:18 +00:00
Seigo Nonaka
097af3f2c9 Merge "Recycle TemporaryBuffer for reducing object count" 2022-01-25 23:07:38 +00:00
Seigo Nonaka
777d2c26b6 Recycle TemporaryBuffer for reducing object count
Bug: 216219602
Test: N/A
Change-Id: I1d0ca1719b2ec807249a47201fe62ccd06cf74e5
2022-01-25 15:29:08 +09:00
James.cf Lin
664a75b407 Add line break word style parameter in the LineBreakConfig
The line break word style(lw) provides the phrase-based breaking opportunities. When the line break word style is set, it will be brought to ICU for calculation.

Bug: 183780874
Test: atest minikin_tests; atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest
Change-Id: Idd851497e46c1fca87ff590230d93f8bb5c9afae
2022-01-22 12:27:51 +08:00
James Lin
43a4bbe145 Merge "Add setLineBreakConfig API" 2022-01-19 00:31:43 +00:00
Seigo Nonaka
94904647a4 Add setLineBreakConfig API
Add new API to allow applications to specify the line break word style. The line break style is one of the locale extension. When the line break style is set, it will be brought to ICU for calculation.

Bug: 183780874
Test: atest minikin_tests; atest TextViewTest; atest MeasuredTextTest; atest PrecomputedTextTest
Change-Id: Ia9cdb5b83e346f96ae22abbb1bcce05c43207bba
2022-01-15 14:28:40 +08:00
Derek Sollenberger
4d3df820d8 Add filtering and directSampling features for BitmapShader
This adds filterMode directly to BitmapShader's public API
which allows users to override the global flag on the paint
or for BitmapShaders used in a RuntimeShader this provides
some explicit control over how the hardware will sample.

Addtionally BitmapShader adds an internal directSampling API
that is exposed only for RuntimeShader via the setInputBuffer
API. Previously, if you want to sample the unaltered contents
of a bitmap you must ensure that the bitmaps contents have the
same format (premul, colorspace, etc) of the destination. This
API enables you to do so without knowledge of the destination
format. This is necessary for use cases where the bitmap content
is data like a normal map or lighting values.

Bug: 189102731
Bug: 201546136
Test: atest CtsGraphicsTestCases:BitmapShaderTest
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Change-Id: I8e9eaa8fae1d3ff45ab8c98b3878bb9da24dac47
2022-01-14 16:23:59 +00:00
TreeHugger Robot
7f635e3d3b Merge "Implement fallback line spacing for BoringLayout" 2022-01-12 23:14:26 +00:00
Derek Sollenberger
11a249be90 Merge "Reland "Enforce that RuntimeShader is only hardware accelerated"" 2022-01-12 19:01:12 +00:00
Seigo Nonaka
78c774defb Implement fallback line spacing for BoringLayout
The fallback line spacing is a feature of extending the line height
when the fallback font has taller glyph. This was implemented to
StaticLayout in Android P but not yet implemented in BoringLayout.

This CL enables this feature to the BoringLayout as well.

Not to break existing apps, change this behavior only if the
targetSdk version is T or later.

This is a 2nd attempt of Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44
The root cause of SystemUI crash was wrong API usage. (start, end) was
passed instead of (start, count).

Bug: 210923482
Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Test: atest SystemUITests
Change-Id: I9137607b0120934f7ad2a12c0f0b8aaa52915831
2022-01-12 00:00:53 -08:00
Christos Gkekas
63cae6de60 Merge "Fix documentation of Outline#setRect(int, int, int, int)" am: 2a3830faab am: 5cb92ff104 am: 4e95f53863 am: 3f33f3d178
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1904030

Change-Id: Ia2717533e269fb44bf9977d87afa5d09a58c3a91
2022-01-11 12:52:27 +00:00
Christos Gkekas
3f33f3d178 Merge "Fix documentation of Outline#setRect(int, int, int, int)" am: 2a3830faab am: 5cb92ff104 am: 4e95f53863
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1904030

Change-Id: Ifed9baa2297d1d3ed492c7f8f79c7d15c6f1d843
2022-01-11 12:37:49 +00:00
Christos Gkekas
2a3830faab Merge "Fix documentation of Outline#setRect(int, int, int, int)" 2022-01-11 11:54:51 +00:00
Christos Gkekas
3524740735 Fix documentation of Outline#setRect(int, int, int, int)
Change-Id: I15a5e2fe07aea78a5fa72f472011ecda63abf813
2022-01-10 18:37:11 +00:00
Derek Sollenberger
2474c831d7 Reland "Enforce that RuntimeShader is only hardware accelerated"
Throw an illegal argument exception any time a Paint with
a RuntimeShader is attempted to be drawn into a software
canvas. Also mark that a Picture that uses a RuntimeShader is
properly marked as requiring hardware acceleration.
These tests check that the use of RuntimeShaders trigger

Bug: 189102731
Bug: 201546136
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Test: atest CtsGraphicsTestCases:RippleDrawableTest
Change-Id: I663e2bc06a3b475f0bb256ce6a9c00c6432ffa42
2022-01-10 18:00:19 +00:00
Derek Sollenberger
e26e8c7ba9 Update RuntimeShader users to new setUniform APIs
Remove the deprecated setUniform APIs and replace
with the newly public setFloatUniform APIs

Bug: 189102731
Bug: 201546136
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Change-Id: I627d5d7617b2a838a5d0c049f6fa1c2a5763e11f
2022-01-07 17:29:30 +00:00
Derek Sollenberger
7c60f92104 Merge "Add RuntimeShader API to RenderEffect" 2022-01-04 14:03:42 +00:00
TreeHugger Robot
806e4df853 Merge "BBQ: Recreate BBQ when SurfaceControl changes 2/2" 2021-12-30 00:16:14 +00:00
Vishnu Nair
daa281da18 BBQ: Recreate BBQ when SurfaceControl changes 2/2
Alternative approach to fab15e55446080bdcfc05ba315e8ef914b0a6f65 which
was racy because the disconnect callback is called without the
BQ lock and the client can continue to modify the BQ state after
disconnecting from the queue.

This approach resets the BQ and BBQ states when the SurfaceControl is
updated. This solves one concrete problem of not relying on the old
SurfaceControl to be destroyed in order to release the currently presented
buffer back to BQ.

In addition this change resets the sync state in BBQ with the rationale
the system does not want to sync on buffers presented on an older
SurfaceControl.

Bug: 197269223
Test: atest BLASTBufferQueueTest
Test: labtest ag/16407859 cf-foldable * 3 (b/197269223#comment40)
Change-Id: I137d3284c4e9216963f9c672f192afd334501ee5
2021-12-29 00:47:40 +00:00
chaviw
b680371f77 Send syncStatus and return FrameCommitCallback in FrameCallback
FrameCallback sends back the syncStatus and allows the caller to return
a FrameCommitCallback. This is so the caller can evaluate the results of
the sync and determine if it wants to continue waiting for a commit
callback. In cases, where the sync has failed, there will never be a
commit callback so the caller can avoid waiting.

This is partically helpful for VRI because it wants to sync with a frame
that will draw, but also doesn't want to get stuck indefinitely waiting
on the callback. VRI can check the syncStatus and only handle blast sync
and/or reportDraw when its determined that a draw will happen.

This allows VRI to remove frameCompleteCallback since it can now wait
until a buffer has drawn instead of when the vsync has completed. This makes
sure it waits on FrameDropped since that result indicates HWUI will draw on
the next vsync

Test: BlastSync
Bug: 200284684
Change-Id: Ic6e2f08ea21ac8a1634a3389c927fcb68ede3f7b
2021-12-28 11:27:23 -06:00
Chet Haase
29d27008a7 Merge "Enable path clipping for View outlines" 2021-12-22 17:38:30 +00:00
Shubham Dubey
f95fdd9472 Revert "Enforce that RuntimeShader is only hardware accelerated"
Revert "Add tests to ensure hardware only for RuntimeShader API"

Revert submission 16475336-RuntimeShader_softwareOnly

Reason for revert: Breaking tests as system is dying
Error: Software rendering doesn't support RuntimeShader
Bug: b/211066630

Reverted Changes:
Id0ee4d1f0:Enforce that RuntimeShader is only hardware accele...
Ib4c2e54bd:Add tests to ensure hardware only for RuntimeShade...

Change-Id: Id7bbf2609a06c1cd69f6a457dab44f9478d95742
2021-12-17 05:43:49 +00:00
Derek Sollenberger
56c0798391 Add RuntimeShader API to RenderEffect
Bug: 201546136
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Change-Id: I96ad4fcfc0486f340653878519efcc4a793191a2
2021-12-17 02:44:46 +00:00
Derek Sollenberger
c93d29cfab Enforce that RuntimeShader is only hardware accelerated
Throw an illegal argument exception any time a Paint with
a RuntimeShader is attempted to be drawn into a software
canvas. Also mark that a Picture that uses a RuntimeShader is
properly marked as requiring hardware acceleration.
These tests check that the use of RuntimeShaders trigger

Bug: 189102731
Bug: 201546136
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Change-Id: Id0ee4d1f05e2975031121298b45f925ee74f6818
2021-12-16 19:36:46 +00:00
Derek Sollenberger
e09fbeed9a Expose android.graphics.RuntimeShader API
In addition to exposing the API to the SDK this CL expands the
number and type of APIs available to modify the uniforms. For
uniforms that resolve to the primitive types of 'float' or 'int'
there are five different entry points for each whose purpose is
twofold. First, these entry points map directly to the GLSL
types (e.g. float, vec2, vec3, vec4, float[]) that these uniforms
are bound to.  Second, for animations these uniforms can be updated
every frame and avoid unnecessary java array allocations was also
motivation for using this pattern instead of varargs.

Bug: 189102731
Test: atest CtsUiRenderingTestCases:RuntimeShaderTests
Change-Id: I4870acd7656095c9d413e708a3150c10134e8afd
2021-12-16 13:33:31 +00:00