4699 Commits

Author SHA1 Message Date
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
Chet Haase
33c1ea73e8 Enable path clipping for View outlines
Clipping Views to Outlines has existed for several releases,
as has providing a Path for shaping Oulines. However, using
a Path-shaped Outline to clip a View against was specifically
disabled internally, due to historical functionality limitations
(prior to enabling Skia for HWUI rendering) as well as performance
concerns.

On current (even relatively low-end) hardware, path clipping is now
sufficiently performant that we are enabling this functionality.
This functionality will be used by AndroidX APIs that enable easier
shaping via paths.

Bug: 201807515
Test: Manual testing including hwui performance tests and CTS
OutlineTest

Change-Id: Ic61d9393cb72c6ad3517954177e5037a383a0c4d
2021-12-14 21:43:05 +00:00
Vishnu Nair
fce5b2bece SurfaceView: Synchronize initial destframe change from BBQ
Fixes a case where the SurfaceView is stuck with a wrong
scale.

Destination frame scales the buffer to the SurfaceView
fixed size. Currently the initial destination frame is
applied when the first buffer is acquired by BBQ. The
transaction is sent via the BBQ apply token.

Meanwhile if the client updates the SurfaceView fixed
size, the SurfaceView will apply the transaction via
the SCC apply token.

This can cause destframe changes to be applied out of
order causing the app to be stuck with the wrong
scale.

Bug: 195443440
Test: atest BLASTBufferQueueTest
Test: repro steps from bug

Change-Id: Ibf53a0efdebb87291d081e48633c373a98d347b1
Merged-In: Ibf53a0efdebb87291d081e48633c373a98d347b1
2021-12-14 19:34:02 +00:00
Vishnu Nair
db018e12e1 Merge "SurfaceView: Synchronize initial destframe change from BBQ" 2021-12-08 16:55:16 +00:00
Vishnu Nair
87d71d6d3f SurfaceView: Synchronize initial destframe change from BBQ
Fixes a case where the SurfaceView is stuck with a wrong
scale.

Destination frame scales the buffer to the SurfaceView
fixed size. Currently the initial destination frame is
applied when the first buffer is acquired by BBQ. The
transaction is sent via the BBQ apply token.

Meanwhile if the client updates the SurfaceView fixed
size, the SurfaceView will apply the transaction via
the SCC apply token.

This can cause destframe changes to be applied out of
order causing the app to be stuck with the wrong
scale.

Bug: 195443440
Test: atest BLASTBufferQueueTest
Test: repro steps from bug

Change-Id: Ibf53a0efdebb87291d081e48633c373a98d347b1
2021-12-07 17:31:51 -08:00
Sally Qi
a54976ec22 Merge "Add DataSpace API to convert between ADataSpace and ColorSpace" 2021-12-02 19:02:12 +00:00
Chavi Weingarten
354d65eec7 Merge "Synchronize SV buffers with main window when config changes" 2021-12-01 17:20:44 +00:00
chaviw
1602deb674 Synchronize SV buffers with main window when config changes
When the main window gets a configuration change, the new buffer for the
SV will get applied in the same transaction as the main window. This
will allow apps to implement seamless rotation without a frame or more
of black where the SV was resized, but the buffer was not yet updated.

This also includes an optimization where if only SV change occurs, but
there was no request from WMS to report drawing, VRI can apply the
transaction immediately without reporting to WMS.

Test: SV with seamless rotation enabled
Bug: 200284684
Change-Id: I5569d815eef92acf3bf9d7f753bd5ab94a332cfe
2021-12-01 17:17:55 +00:00
Seigo Nonaka
4b3f04314a Merge "Remove link to the deprecated API" 2021-11-30 04:17:39 +00:00
Aaron Labiaga
4b7663bff7 Fix erroneous comment end tag for xml in ripple code sample.
Change-Id: I4f932676d121125cb02c60769af4c245f3cccd03
Bug: b/168605104
2021-11-29 19:06:46 +00:00
chaviw
e97e296c81 Rework blast sync callback model
The previous code waited for a frame complete callback from hwui before
notifying WMS that a draw had occurred. However, frame complete callback
was not guaranteed to get called since it only invokes a callback if a
draw actually occured. VRI really needs a signal that RT has completed,
since it just needs to know that a draw was possible so it can notify
WMS that the RT completed its pass.

Instead, rename frameCompleteCallback to frameCommitCallback since that
API is exposed to a public API when a frame was actually drawn.
Create a new callback, frameCompleteCallback, that is invoked when the
draw has completed, regardless if a frame was actually drawn.

When the frameCompleteCallback is invoked, VRI can check to see if a new
frame actually drew. VRI can call into BBQ to see if the frame acquired
matches the frame that was attempted to draw. If so, VRI can wait on a
transaction callback. If not, it can allow VRI to continue. In either case,
it will notify WMS that the draw has finished.

Test: Split over and over
Bug: 195262673
Bug: 193634619
Change-Id: I24dd19ab2746be3fc33e597761abf8c5249f8b5b
Merged-In: I24dd19ab2746be3fc33e597761abf8c5249f8b5b
2021-11-24 23:38:34 +00:00
Sunny Goyal
43a1f4b48d Updating AdaptiveIconDrawable to support themed icons
Bug: 201718966
Test: CTS updated
Change-Id: Ibb7e106ae11babe533d0787c6245557ebcc02d32
2021-11-24 19:41:59 +00:00
Seigo Nonaka
aec3a3fde5 Remove link to the deprecated API
Bug: 207041621
Test: N/A
Change-Id: Ideb732f3694645612df1b7b885ef0a8ef3fa19c8
2021-11-23 13:07:37 -08:00
TreeHugger Robot
6423d01b01 Merge "Implement fast hyphenation algorithm" 2021-11-19 01:32:34 +00:00
Xin Li
10d9972786 Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I13199bc39e9445929195f3d15579cbffe94e92b0
Change-Id: I35fa3c6c2abf679c51033f1395a08d511ed8739f
2021-11-18 17:00:37 +00:00
Sally Qi
ac97f99b41 Add DataSpace API to convert between ADataSpace and ColorSpace
Also implement getDataSpace functions in SurfaceTexture and Image field
to help with upstream HDR work.

Bug: 201539996
Bug: 201535454
Test: android.hardware.camera2.cts.ImageWriterTest, android.hardware.cts.DataSpaceTest pass
Change-Id: I17fa43c1ba60e6f59da1910cebcef0dab993ce3b
2021-11-12 13:33:53 -08:00
Seigo Nonaka
0f761404af Implement fast hyphenation algorithm
RandomText Balanced Hyphenation ON
	min: 2,312,291
	mean: 2,320,574
	median: 2,320,112

RandomText Balanced Hyphenation ON(Fast)
	min: 985,850
	mean: 990,922
	median: 986,586

RandomText Balanced Hyphenation OFF
	min: 909,060
	median: 923,585
	mean: 930,052

Bug: 201096525
Test: TreeHugger and minikin_tests
Change-Id: Ide2d73acb3de85e91018e524c89df2c949235a4e
2021-11-10 23:19:43 -08:00
chaviw
989aa9b726 Rename nextTransaction to syncTransaction
The variable nextTransaction is abigious and doesn't represent its
purpose. Rename to syncTransaction

Test: Builds
Bug: 200285149
Change-Id: I55c3efe02aee17a610034bb5eb011e98e7747d7c
2021-11-10 18:17:41 -06:00
Robert Carr
bda55e3262 DO NOT MERGE: ViewRoot/BBQ: Cleanup flushShadowQueue
It's already a noop, we just never cleaned up the
frameworks/base side.

Bug: 200285149
Test: Existing tests pass
Change-Id: I7d79404f93a9386b16fb9770bbd7290dfb236cc0
2021-11-03 17:54:11 +00:00
Brett Chabot
3f8b9fe50b Backport 'Add ability to disable GL draws'.
This feature is intended for use in headless test environments,
where disabling drawing has minimal compatibility impact and can
save significant resource usage when running UI tests.

This feature is controlled via a new system property
'debug.hwui.drawing_enabled', and a HardwareRenderer API that can
override the property value on a per-process basis.

Bug: 201691826
Test: boot emulator
Merged-In: I93c21e680382e03342f235dbf58bd7a5c8a6f767
Change-Id: I391c841e3a0cdcfcc6c7910a316a4dd5e970547d
2021-10-26 21:16:16 +00:00
chaviw
6f2b3f5dcc Remove setTransactionCompleteCallback
There are no longer an uses for BBQ.setTransactionCompleteCallback so
remove from code.

Test: Builds
Bug: 200285149
Change-Id: I1eea54ac53b4f8514ea11116e6839a39acf51e68
2021-10-14 12:17:19 -05:00
Chet Haase
d51503009f Merge "Updated Outline.offset() docs to clarify behavior" 2021-10-05 20:05:53 +00:00
Chet Haase
6ad394ac04 Updated Outline.offset() docs to clarify behavior
Bug: 202063656
Test: N/A, but added CTS sub-test for untested behavior
Change-Id: I86dc415879b23b92b9283c822094d4b811cd796f
2021-10-05 17:37:35 +00:00
John Reck
712eae053c Support dump gfxinfo reset for process' without a Window
Bug: 199791928
Test: manual
Change-Id: I995d236c2c9d60194f72275a3da1c82340f77898
2021-10-01 15:51:48 -04:00
TreeHugger Robot
e1cf17c292 Merge "ImageFormat: Fix YCBCR_P010 bitsPerPixel" into sc-qpr1-dev am: 70add31774 am: fc5e4c3d43 am: 3fda08d35f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15899485

Change-Id: I7555ca1b7b2135e21b27b08c8f9c5166b06c80fc
2021-09-24 18:38:53 +00:00
Shuzhen Wang
3e4720b3b4 ImageFormat: Fix YCBCR_P010 bitsPerPixel
For P010 format, Each pixel has Y and subsampled CbCr. So:
bitPerPixel = 1.5 * bitPerPixelY
bitPerPixelY = 16 bits

Bug: 200949749
Test: Camera CTS
Change-Id: I7964d64c25961dbef634ac1ef82898147ec57111
2021-09-23 22:25:09 +00:00
TreeHugger Robot
d7cbe3d827 Merge "In SkSL, replace 'sample' with '.eval'" 2021-09-08 18:15:20 +00:00
Chavi Weingarten
da143d4a41 Merge "Call applyPendingTransactions when frame didn't draw" 2021-09-08 15:50:25 +00:00
chaviw
a9997a38fe Remove flushShadowQueue
flushShadowQueue no longer does anything in BBQ so remove from Java and
JNI code.

Test: Builds
Fixes: 199204968
Change-Id: I4df67a23732ba4ffaca42390b29d3f81cadd6457
2021-09-07 17:53:31 -05:00