Commit Graph

4110 Commits

Author SHA1 Message Date
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
Leon Scroggins
ce084899fe Merge "Clean up NinePatch(Drawable) for mainline module" 2020-05-05 18:33:50 +00:00
Leon Scroggins
1078c5c051 Merge "Remove/document @hidden APIs in Canvas" 2020-05-05 14:09:52 +00:00
Leon Scroggins III
a26721a7ea Clean up NinePatch(Drawable) for mainline module
Bug: 155661807
Test: make

Document/remove @hide/@UnsupportedAppUsage from NinePatch(Drawable)
- Remove the unused copy constructor
- Remove @UnsupportedAppUsage from InsetStruct. No usage was shown on
  the dashboard; it was likely added by mistake due to its being called
  from JNI
- Document that the other @hide methods are needed for access from
  outside the package, but still within the module.

Change-Id: Ia27a5eda63a0115da54225f7ac18b3d2a55ab01f
2020-05-04 20:58:24 +00:00
Leon Scroggins III
491ed067dd Make Canvas#drawPatch public
Bug: 155422223
Bug: 155661807
Test: NinePatchTest#testDraw
Test: NinePatchDrawableTest#testDraw

As part of the move to a mainline module, code outside the module cannot
access @hidden APIs on Canvas. Although no code outside the module calls
these methods, there is a Canvas subclass that overrides it - NopCanvas,
which overrides it to do nothing. This is useful, and cannot be achieved
another way. (If NopCanvas did not override drawPatch, it would crash
when attempting to draw a NinePatchDrawable.)

In addition, this method is already public on RecordingCanvas. (This is
likely an accident; it contains no documentation for the method.)

Lastly, it is somewhat arbitrary that the way to draw a NinePatch
directly was to call NinePatch#draw. This is the reverse of how Canvas
drawing generally works. The newly public method matches the typical
pattern (Canvas#draw<Something>(Something, Paint)) and is already called
by NinePatch#draw.

Change-Id: I16d7dc7391e3ad5777fdd7023472545c6104af69
2020-05-04 20:54:58 +00:00
Leon Scroggins III
cf0806108d Remove/document @hidden APIs in Canvas
Bug: 155422223
Test: make

For Canvas to be in a mainline module, it cannot be have @hidden APIs
accessed from outside the module. Remove @hide where simple:

- document why Canvas(long) is needed to be public + @hide
  - remove its UnsupportedAppUsage, which was a false positive
- remove EdgeType.nativeInt (which was @hide) - no longer used
- make VertexMode.nativeInt package protected

Change-Id: I508758889c586f336c2963e1b61d01dc3dc58be7
2020-05-04 20:54:02 +00:00
Leon Scroggins III
7c784b8b16 Remove Canvas#getGL
Bug: 155422223
Test: make

This method is @UnsupportedAppUsage but low usage. It is @hide but
unused internally. Remove it so Canvas can move to a mainline module.

Change-Id: Ida6710d3640c1c6ce03eb4f5634dd4e8df581d1d
2020-05-04 18:02:45 +00:00
Leon Scroggins
fdc7ce1e72 Merge "Move Canvas compatibility settings into Compatibility class" 2020-05-04 18:01:42 +00:00
Leon Scroggins III
9a49427384 Move Canvas compatibility settings into Compatibility class
Bug: 155422223
Test: make

Follow on to Ie7172fb93364a1e04ab844b8fa64887bf9d8b005. Remove @hidden
APIs on Canvas - instead call setCompatibilityVersion from the
Compatibility class already in the Java package. This is a step towards
moving Canvas into a mainline module. Note that this means these are set
when the application is bound, rather than when the first View is
created.

Change-Id: I3f73d77ba7351a6cb653dd550210698c6482e1bb
2020-05-04 18:00:25 +00:00
TreeHugger Robot
1766e14e10 Merge "Make Drawable#hasFocusStateSpecified public" 2020-05-04 16:53:18 +00:00
Andrew Sapperstein
8fe35e5f21 Fix broken @see tags in public documentation.
These were previously being suppressed by doclava but with this change,
all failures are fixed and the suppression logic has been removed.

To fix the issues, there were a few possible changes made:
- broken reference to a public API (such as incorrect parameters): fixed
- unnecessary @link inside an @see tag: fixed
- @see referring to an @hide or @SystemApi: reference removed
- broken references to inner class constructors
 - worked around by fully qualifying the constructor

Bug: 6963924
Test: make doc-comment-check-docs
Exempt-From-Owner-Approval: cherry-picked from master
Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
Merged-In: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
(cherry picked from commit e0624c7a40)
2020-05-01 18:25:32 +00:00
Andrew Sapperstein
1f6e22cbd8 Fix broken @see tags in public documentation.
These were previously being suppressed by doclava but with this change,
all failures are fixed and the suppression logic has been removed.

To fix the issues, there were a few possible changes made:
- broken reference to a public API (such as incorrect parameters): fixed
- unnecessary @link inside an @see tag: fixed
- @see referring to an @hide or @SystemApi: reference removed
- broken references to inner class constructors
 - worked around by fully qualifying the constructor

Bug: 6963924
Test: make doc-comment-check-docs
Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
Merged-In: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
2020-05-01 00:42:22 +00:00