Commit Graph

4121 Commits

Author SHA1 Message Date
Vishnu Nair
cf143d4408 Add BlastBufferQueue adapter in SurfaceView
Add support for submitting buffers in SurfaceView via BLAST using
BlastBufferQueue adapter.

Introduce a new config wm_use_blast_adapter_sv, that is disabled by
default to enable the adapter.

When enabled, the blast SC is created as a child of the main
SurfaceView SC and the main SC is set as a container layer. This layer
will continue to handle position, visibility and transforms while the
blast SC will handle buffer updates via the adapter.

Test: atest SurfaceViewBufferTests
Test: go/wm-smoke w/ & w/o adb shell adb shell settings set global use_blast_adapter_sv 1
Bug: b/168504870, b/168917217

Change-Id: I826eef39e03ea339df54400be0709eaba6c88797
2020-09-24 21:45:18 +00:00
Seigo Nonaka
1ed4f6441f Add necessary APIs for supporting glyph level drawing
This CL adds following APIs

Font#cloneWithSettings
  This API provides a faster Font instance creation for different
  variation settings.

Font#getBounds
  This API provides glyph advance and bounding box information.

Font#getMetrics
  This API provides font metrics that will be used for deciding line
  height and/or baseline.

Bug: 168136332
Test: atest FontTest
Test: TreeHugger

Change-Id: I335557ce47ea0ca8e012c2a48b804c00bb348392
2020-09-23 13:01:38 -07:00
TreeHugger Robot
f03c5aa5f6 Merge "Added support for edge treatment parameters for BlurShader" 2020-09-23 00:37:40 +00:00
TreeHugger Robot
4bd5f7407a Merge "Expose ParcelableColorSpace" 2020-09-22 18:38:17 +00:00
Nader Jawad
6c2296137e Added support for edge treatment parameters for BlurShader
Added configurable parameters for edge treatment for
BlurShader to determine how edge pixels are to be
computed as part of the blur kernel. This provides
the option to sample the edge pixels of the source
for larger windows as well as using transparent
(default behavior)

Fixes: 167714368
Test: Added CTS tests to verify results of edge treatment parameters
Change-Id: I3880ff4aa2e2a4eba831a0aa6d2ec77b07e84813
2020-09-21 20:52:35 -07:00
John Reck
f7e38f301c Expose ParcelableColorSpace
Bug: 148412652
Test: ParcelableColorSpaceTest CTS
Change-Id: I3749fe903b2644b8a0d1e44893ee38a0b0a4e0a1
2020-09-17 16:22:36 -07:00
Ady Abraham
41b5d5a764 Merge "Shared timeline plumbing" 2020-09-17 21:16:25 +00:00
Steven Thomas
6fabb5aa17 Shared timeline plumbing
Add plumbing to get shared timeline data from Surface Flinger to HWUI
and back.

Bug: 162890382
Bug: 162888881
Bug: 162890407

Test: manual using ALOG messages in SF
Change-Id: I85c5eb56d2fa933889518854e7b79b1e65e29af3
2020-09-16 22:58:39 -07:00
Emilian Peev
0173af0189 Add RAW_DEPTH10 image format
Add support for 10bit opaque and private RAW_DEPTH10 image format
which is similar to RAW_DEPTH.

Bug: 167250258
Test: Manual using camera application.
Change-Id: Ib2ee11570429d7a9a53e9dd6bc2042a1f5eaa760
2020-09-14 23:34:49 +00:00
Leon Scroggins
de50855fed Merge "ImageDecoder: Use AssetFileDescriptor's length" 2020-09-14 14:40:43 +00:00
Leon Scroggins III
c3fda89b05 ImageDecoder: Use AssetFileDescriptor's length
Bug: 166069819
Test: ImageDecoderTest (cts)

The contained asset may only be a subset of the AssetFileDescriptor.
SkWebpCodec reads the entire stream into a contiguous block of memory.
(This is because libwebp does not provide a streaming API for creating
its demuxer.) If the AssetFileDescriptor contains data after the webp
file, this wastes memory. In some cases, there may be a *lot* of data
after the webp file, so this can use too much memory, particularly on
low memory devices.

Change-Id: I8d8e520f43a7ef0d7e4534ef165d8c7e4d2a0b55
2020-09-11 16:58:51 -04:00
Leon Scroggins III
d608691c29 Update maxTargetSdk for createAshmemBitmap
Bug: 150395371
Test: make

Follow-on to I359187a5c70b5e241c7f5879d50fde2a7449c818. Apps built
against R should have @UnsupportedAppUsage access to createAshmemBitmap,
since asShared does not exist yet. But apps built against S should use
the new API.

Note that the R branches have *no* maxTargetSdk set for this method.
This was added in S before it was possible to set R as maxTargetSdk.

Change-Id: If2313809084bc70613214b562847ae3a792df259
2020-08-21 17:42:37 +00:00
Nader Jawad
322cb9c4e8 Added BlurShader API
Created BlurShader framework API along with
native implementation as an implementation of
the Shader wrapper that maps to either
SkShader or SkImageFilter

Bug: 143468037
Test: Added CTS test to verify BlurShader

Change-Id: I05fcf7ba79e9d552f8b0738f7382f7826cd94e21
2020-08-19 13:49:50 -07:00
Nader Jawad
fc42a99ea5 Create wrapper around Shader native implementation
Created Shader classes to wrap existing shader classes
in the framework in order to handle creation of either an
SkShader or SkImageFilter.
Updated native Paint implementation to optionally configure
the currently configured SkShader or SkImageFilter

Bug: 143468037
Test: re-ran CtsGraphicsTestCases and CtsUiRenderingTestCases
Change-Id: I7663b92766c912ab3866cf4e39b268f6dcf5d8e2
2020-08-14 19:46:05 -07:00
John Reck
f42ff762f2 Allow controlling the SDR white point
Test: this
Change-Id: I9ee059afd73ca0850e41072c068c9effe8362382
2020-08-06 17:32:10 -07:00
John Reck
b36bfddb1e Wire-up colorMode="hdr"
Fow now it uses a fixed white point of 150nits
TBD if this is disabled or adjusted

Test: Demo app
Change-Id: Iac13597b3d7633fdef3feaf7ec1da0c27c87904c
2020-07-30 08:54:03 -07:00
Leon Scroggins
71008157a7 Merge "Update graphics language to comply with Android’s inclusive language guidance" am: da4dc882af am: a97e560c61 am: 53ee2070ed am: fada7acad0 am: c6c49d9b92
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1370379

Change-Id: I11bb4e724b9b1736c04220f61de4116109b97edd
2020-07-23 14:44:20 +00:00
Leon Scroggins
53ee2070ed Merge "Update graphics language to comply with Android’s inclusive language guidance" am: da4dc882af am: a97e560c61
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1370379

Change-Id: I5d853a84c0fe1550d86d0f948f76e532af42e073
2020-07-23 13:56:41 +00:00
Leon Scroggins III
f663182d52 Update graphics language to comply with Android’s inclusive language guidance
Bug: 161896447
Test: make

See https://source.android.com/setup/contribute/respectful-code for reference

Change-Id: I57b81fb5fd2177fbf96f9cc900097f7da1955fca
2020-07-22 13:00:12 -04:00
Leon Scroggins III
69b95fa2a5 Make Paint/Shader/ColorFilter#getNativeInstance conditionally thread-safe
Bug: 159246162
Bug: 154358781
Test: PaintNativeInstanceTest.kt

Although the android.graphics package makes no promises regarding
thread-safety, it is not obvious to clients how they might call
getNativeInstance from multiple threads. If one thread sets up a Paint,
and then two threads use it, this sets up a race condition for setting
up the native SkPaint. This seems to have been observed in internal
apps. Put accesses and modifications to these native objects inside
a synchronized block, so that we don't end up with a situation where
two instances of mCleaner attempt to dereference the same native object.

Add tests in PaintNativeInstanceTest.kt

Change-Id: I10fa0958ea216bfbc79667c6217dd6570b3eb110
2020-07-16 09:25:33 -04:00
John Reck
aa4c982294 Remove legacy callDrawGlFunction2 from HWUI
Bug: 151439970
Test: CtsUiRenderingTestCases passes

Change-Id: I1c29df17bb6e8b078467edf73cb3547db6948cdd
2020-06-26 13:49:05 -07:00
Makoto Onuki
42bec243c0 Remove unnecessarily @System/TestApi annotations
We can't expose APIs if the enclosing class is hidden, so these
annotations are redundant. We need to remove them so that we can enable the
check.

Exempt-From-Owner-Approval:Cherry-pick from goog/master
Bug: 159121253
Test: treehugger (i.e. this shouldn't trigger "API has changed" error.)
Merged-in: Ie1841a670bdf6c6f4b25a1fc5deed8ec2d18cda2
Change-Id: Ie1841a670bdf6c6f4b25a1fc5deed8ec2d18cda2
2020-06-24 18:02:10 +00:00
Makoto Onuki
4290301e85 Remove unnecessarily @System/TestApi annotations
We can't expose APIs if the enclosing class is hidden, so these
annotations are redundant. We need to remove them so that we can enable the
check.

Bug: 159121253
Test: treehugger (i.e. this shouldn't trigger "API has changed" error.)
Change-Id: Ie1841a670bdf6c6f4b25a1fc5deed8ec2d18cda2
2020-06-23 10:51:50 -07:00
Leon Scroggins III
53b03c0f44 Clean up ColorSpace.java
Bug: 156282935
Test: I3ce1bbd4285443a4e481a0a1e9267feafbe49d44
Test: DisplayWhiteBalanceTintControllerTest

Remove cctToIlluminantdXyz, which was @hide, but unused.

Make the @hide constructor package-protected so it can be called by
ParcelableColorSpace, but not from outside the package.

Make cctToXyz and chromaticAdaptation public. These are used by
other parts of the system and may be useful to other clients. Make the
public version of chromaticAdaptation throw IllegalArgumentExceptions
for passing arrays with the wrong number of arguments.

Make mul3x3(float[], float[]) private and copy it over to
DisplayWhiteBalanceTintController. There is nothing ColorSpace-specific
about this code.

Remove Renderer and related. They were originally used to generate the
documentation pages, but they are no longer needed. Remove
ColorSpaceRenderTest, which tested it.

Change-Id: I9094046c8e5e72be0ac208d4d242e6f0b274f386
2020-06-05 16:11:45 -04:00
Leon Scroggins III
87d429262b Move TextureLayer into android.graphics
Bug: 155905258
Test: make and boot

It is tightly integrated with android.graphics.HardwareRenderer, and
this follows on I30d34055b6870dc1039f190a88f4a747cee17300, which moved
the native component into android_graphics_TextureLayer.cpp, and
Ifa044281a3c36cbc1b413175711e9b172cda640f, which registers its JNI along
with other graphics classes.

Make TextureLayer AutoCloseable, replacing destroy() with close(). Add
annotations where appropriate.

Change-Id: I1b146ff02a20751246636144c88fe6f8eec43514
2020-06-02 14:20:05 -04:00
TreeHugger Robot
214e6f6c88 Merge "Remove @hide from Matrix" 2020-05-29 19:49:31 +00:00
TreeHugger Robot
e80aeb784c Merge "Fix small issue in PdfDocument docs" into rvc-dev am: bde97baff3 am: c2b1fa5590 am: 6b1b6b2ee6 am: f9684be0be
Change-Id: Ifec289322c4837d9a0c60b6cfbeca53fc53d265b
2020-05-27 20:05:02 +00:00
Philip P. Moltmann
8bbf9bae6f Fix small issue in PdfDocument docs
Test: Doc fix only
Fixes: 157396387
Change-Id: If1c7a875d8915f53726b832f51cb59fa1f12ae31
2020-05-26 16:29:43 -07:00
Leon Scroggins
f2ed00dad6 Merge "Restore MAX_BITMAP_SIZE" 2020-05-20 13:45:58 +00:00
Andrew Solovay
856012adf0 Merge "docs: Removing spurious heading from Javadoc comment" into rvc-dev am: 4acc0902c6 am: 25b96a777a am: 008793e49c am: 077f28bd30
Change-Id: Iaa9a0b284b71d4072b072aefb66d0bd75a52f474
2020-05-20 01:28:38 +00:00
Andrew Solovay
b9001d1b8a docs: Removing spurious heading from Javadoc comment
There's an H3 at the top of the PorterDuff.Mode javadoc comment,
and that breaks the TOC in various ways. We don't need that
heading so I'm removing it.

Test: make ds-docs-java
Exempt-from-owner-approval: Docs-only change
Change-Id: I6d5f98b5103a77a7d0245a438b6961c4a21fb059
Bug: 311897143
2020-05-20 00:13:07 +00:00
Leon Scroggins III
aa31944d5d Restore MAX_BITMAP_SIZE
Test: make

This partially reverts 7648ccaa3b
(I141d6d79520871df1a3c2a9267ec872a8314ffdb). Restore RecordingCanvas'
MAX_BITMAP_SIZE and throwIfCannotDraw. Although it's possible to draw a
bigger Bitmap, it is likely a bug on the part of the app developer and
will likely lead to other (potentially hard to diagnose) problems due to
using so much memory.

Make the restored version of MAX_BITMAP_SIZE private, so that it won't
be accessed outside the module.

Change-Id: Ia82c9f05b0b01960915a34e06e046447ab38854e
2020-05-19 17:23:05 +00:00
Leon Scroggins III
3b8b654519 Remove @hide from Matrix
Bug: 152983829
Test: make
Test: I77ec845b5503df6f90deb6a2176836d9aacb74d1

Make IDENTITY_MATRIX a public API. It had @UnsupportedAppUsage, and it
is a useful thing to have.

Replace printShortString with dump, to match Point#dump (added in
I5e25dbbe47b3c690d7d763a0082beb8d8a9c86d3) and others. Make this public
as well.

Remove @UnsupportedAppUsage from native_instance, which appears to be a
false positive (no usage found on the dashboard). Also make it private,
forcing other classes to call ni().

Document why ni() needs to be @hide (usage by classes outside the
package but inside the module). Also add a FIXME that PdfRenderer should
*not* be calling it, since we plan for it to be outside the module.

Make toShortString(StringBuilder) private. Switch its only external
client to the public version. (While I see a few public
"toShortString()" methods in the public API, I do not see any that take
a StringBuilder parameter.)

Fix a typo.

Change-Id: I356fb6729764f1777830fc3a91216e869bf6de16
2020-05-18 13:56:09 -04:00
Leon Scroggins
f2043a0027 Merge "Cleanup/document Shaders for UI rendering module" 2020-05-18 14:56:23 +00:00
Leon Scroggins
dde48febd6 Merge "Remove @hide from android.graphics.Color" 2020-05-18 14:14:54 +00:00
Leon Scroggins III
fa2e92020f Cleanup/document Shaders for UI rendering module
Bug: 156636925
Test: make

Remove UnsupportedAppUsage false-positives from Shader and BitmapShader.

Change public/package-protected methods that should only be called by
subclasses to protected and mark them @hide.

Document why other @hide methods must be @hide.

Remove unnecessary if statement in BitmapShader constructor.

Change-Id: If3e87c45cbbab1df180387dd6ccfda1ec2ecb153
2020-05-15 15:00:54 -04:00
Leon Scroggins III
1a05b72cc4 Remove @hide from android.graphics.Color
Bug: 156505010
Test: HtmlTest
Test: I060478a4e46f4ed153007d42cb5b7c5eae04de27

Remove Color#getHtmlColor, which was marked as @hide. Its only caller
was outside the in-progress UI rendering module, so it would no longer
be able to access it after the move.

Make the calling code call either the already-public Color#parseColor or
the (@hide, which is okay from android.text) XmlUtils.convertValueToInt
directly to achieve the same effect as before.

Change-Id: I8fde97bb866689849ba49932c6d7ca10bbd618c5
2020-05-14 16:31:22 -04:00
Leon Scroggins
bda69cf1b1 Merge "Make Camera#native_instance private" 2020-05-14 19:58:13 +00:00
Alec Mouri
21a405894e Merge "Initialize DeviceInfo earlier." 2020-05-13 19:15:22 +00:00
Alec Mouri
978a2cc477 Initialize DeviceInfo earlier.
DMS should be queried before RenderProxy is first created. Otherwise
JankTracker will be initialized with bad offset information, which
breaks the dequeue time forgiveness checks and causes apps to report
longer rendering times than they should.

Also, fix the default for the presentation deadline - the default should
align with SF's offset to be 0

Bug: 155490805
Test: builds, boots, verified that offsets are plumbed at the right
time.
Test: quickstep benchmark shows improved jank numbers

Change-Id: I51538a02969eb312df40cad5df48619433056de9
2020-05-13 11:12:30 -07:00
Leon Scroggins III
e1e6a5bf61 Make Camera#native_instance private
Bug: 156272375
Test: make

No other class needs this. Also remove UnsupportedAppUsage. The
dashboard shows no usage.

Change-Id: I69fce40fa079380e59b0be8367bc7c9ab44ae76d
2020-05-13 09:43:27 -04:00
Leon Scroggins III
e9b2cc829e Update ImageDecoder docs regarding Files
Bug: 139186570
Test: make docs

As part of enforcing Scoped Storage for the next Android release, we're
encouraging app developers to steer away from using raw file path access
and, instead, use FileDescriptor or Uri to access files.

Update createSource(File)'s docs to suggest why they might want to use a
different method.

Update the top level example to use createSource(ContentResolver, Uri)
instead of createSource(File).

Change-Id: Icbccdb5183edd0b6a052ec905f999f02ac4e61d3
(cherry picked from commit 4056974583)
Merged-In: Icbccdb5183edd0b6a052ec905f999f02ac4e61d3
2020-05-12 14:09:56 +00:00
Leon Scroggins
e20a7f6a62 Merge "Update ImageDecoder docs regarding Files" 2020-05-12 14:08:36 +00:00
Leon Scroggins III
4056974583 Update ImageDecoder docs regarding Files
Bug: 139186570
Test: make docs

As part of enforcing Scoped Storage for the next Android release, we're
encouraging app developers to steer away from using raw file path access
and, instead, use FileDescriptor or Uri to access files.

Update createSource(File)'s docs to suggest why they might want to use a
different method.

Update the top level example to use createSource(ContentResolver, Uri)
instead of createSource(File).

Change-Id: Icbccdb5183edd0b6a052ec905f999f02ac4e61d3
2020-05-11 16:52:37 -04:00
Leon Scroggins III
7648ccaa3b Remove instances of @hide from RecordingCanvas
Bug: 155905258
Test: make

Remove MAX_BITMAP_SIZE. It was based on a limitation of the old
renderer. Remove override of throwIfCannotDraw, which was only there for
comparing the size of a Bitmap against MAX_BITMAP_SIZE and throwing if
it was too big.

Remove MAX_BITMAP_SIZE from WallpaperManagerService, which was a copy of
the one in RecordingCanvas, and only there due to it.

Mark obtain, recycle, and finishRecording as being used by the package.

Change-Id: I141d6d79520871df1a3c2a9267ec872a8314ffdb
2020-05-08 11:23:15 -04:00
Leon Scroggins
0c24d0a5b3 Merge "Make BitmapDrawable#setBitmap public" 2020-05-07 21:11:42 +00:00
Leon Scroggins
d50178eae6 Merge "Switch Java calls to enableZ and disableZ; remove isRecordingFor" 2020-05-07 18:07:22 +00:00
Leon Scroggins
f0cee43934 Merge "Make Canvas#drawPatch public" 2020-05-06 20:33:55 +00:00
Leon Scroggins III
bea80a7725 Make BitmapDrawable#setBitmap public
Bug: 154628299
Test: I20d4f94a145474394bc660368d9ddd1897001f4a

This allows displaying a new Bitmap without paying the cost of creation
and GC of the BitmapDrawable.

Non-SDK-API usage is low, but this is useful. Previously it was @hide
and used by the system. Once BitmapDrawable is in a mainline module,
the system can no longer access @hide methods.

Change-Id: I6a24b3c5870b0ee7d171aab86257896261b4b8c7
2020-05-06 14:28:12 +00:00
Leon Scroggins III
0f53e10c07 Switch Java calls to enableZ and disableZ; remove isRecordingFor
Bug: 155422223
Test: make

insertInOrderBarrier and insertReorderBarrier are @hide and deprecated.
Remove them and update all callers to enableZ and disableZ, which are
already public.

Update native code to refer to enableZ instead of insertReorderBarrier.

In addition, remove @hide Canvas#isRecordingFor. This method was
originally used to prevent a single RenderNode from being in two display
lists. This is now supported, so there's no reason to avoid it. The one
caller used it to determine whether to reorder drawing its child Views
(which, as the comment says, makes sense to determine based on whether
the Canvas isHardwareAccelerated) and whether to call
insertReorderBarrier/insertInOrderBarrier (now enableZ/disableZ). In the
latter case, there is no need for a conditional, since enableZ/disableZ
only work on a hardware Canvas.

Change-Id: Ib216a19d6aeff40b2e23532bacd62d1795c2ab27
2020-05-06 09:38:39 -04:00