Commit Graph

3768 Commits

Author SHA1 Message Date
Nader Jawad
835ba2baaa Merge "Updated GradientDrawable to expose public APIs to reduce reflection usages" 2019-02-12 17:43:15 +00:00
Nader Jawad
f67cec79a7 Updated GradientDrawable to expose public APIs to
reduce reflection usages

--Marked GradientState parameter as hidden as each field on it is
accessible through GradientDrawable's public API
--Updated setColors API method to enable setting color stop positions
array
--Fixed issue where GradientDrawable with start/center/end colors
configured via xml would crash at runtime if the colors were modified
with a different number of colors. Resolved by providing optional
float array parameter that defaults to null if unset.
--Added public setters to GradientState parameters that were not
previously exposed

Bug: 124051827
Bug: 124051738
Bug: 124050218
Bug: 124050917
Test: Added CTS tests to GradientDrawableTest for new API coverage
Change-Id: I175998c9920d0ecca021fc3cac7d3a3f9e4b61cf
2019-02-11 16:56:37 -08:00
Siyamed Sinir
084e436d33 Merge "Prevent access for Typeface.setDefault" 2019-02-11 18:41:31 +00:00
TreeHugger Robot
1c30b0f889 Merge "Fix ColorStateListDrawable container callback API" 2019-02-09 01:37:37 +00:00
Ashley Rose
7fa0d26a97 Fix ColorStateListDrawable container callback API
Bug: 120866624
Test: atest ColorStateListDrawableTest
Change-Id: Ie2ccec13b7b270d013e6f52d86227e5be1eb776a
2019-02-08 15:26:46 -05:00
Issei Suzuki
a5dbf52d0a Set insets on the virtual display to avoid IME covering the bubble.
Bug: 123544535
Test: Manual test using the test app, and atest DisplayPolicyLayoutTests
Change-Id: If2fceea97f4d702d000d887883c7f131337e9fd0
2019-02-08 14:21:53 +01:00
Rahul Ravikumar
f6f2e32b4e Merge "Add a EdgeEffect#setBlendMode API." 2019-02-07 21:39:19 +00:00
Shuzhen Wang
ebd10b8fcf Merge "Camera: Add HEIC format output" 2019-02-07 19:15:32 +00:00
Siyamed Sinir
3a24ff34ef Prevent access for Typeface.setDefault
Developers can use font in xml and also application global theme in
order to change the default Typeface. android:textViewStyle and its 
attribute android:textAppearance can be used to change typeface and 
other text related properties.

Test: None
Bug: 123769410
Change-Id: I5923da9c7a31a5da0466fd864dd37100d896e2b0
2019-02-06 14:30:19 -08:00
Rahul Ravikumar
7ab5459af9 Add a EdgeEffect#setBlendMode API.
* Fixes hidden api usage b/123769450
* Move from setXferMode() to setBlendMode in Paint.

Fixes: b/123769450

Test: Added CTS Tests.
Change-Id: I1f950e4c14d30dd223cce05835b230c086755089
2019-02-06 14:15:13 -08:00
Qingqing Deng
4a558101cd Add trackingBug to FontFamily Usages.
Bug:123768928
Test: None.
Change-Id: Icfe7c7b48a5736c65cfde6c89af09d3c0b82eabb
2019-02-06 13:32:37 -08:00
Haoyu Zhang
f324849ab0 Merge "Add comments on UnsupportedAppUsage of Typeface.sDefault" 2019-02-06 19:28:40 +00:00
Shuzhen Wang
f655b1c876 Camera: Add HEIC format output
- Add HEIC ImageFormat.
- Add HEIC related camera static metatadata.
- Handle BlobID and BlobSize properly for HEIC format.

Test: Camera CTS
Bug: 79465976
Change-Id: I8606711b036e695e23671c4563364c24aad9ed84
2019-02-06 10:11:20 -08:00
Qingqing Deng
28eb14a807 Deprecate graphics/FontFamily.
Bug: 123768928
Test: atest FontFamilyTest
Test: atest CtsWidgetTestCases:EditTextTest CtsWidgetTestCases:TextViewFadingEdgeTest FrameworksCoreTests:TextViewFallbackLineSpacingTest FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest CtsTextTestCases FrameworksCoreTests:android.text CtsWidgetTestCases:TextViewPrecomputedTextTest
Change-Id: I3fcfa4a75ada9cfe58d090f387fab03a4d807e20
2019-02-05 17:40:38 -08:00
Haoyu Zhang
64457aa115 Add comments on UnsupportedAppUsage of Typeface.sDefault
Added comments and trackingBug for UnsupportedAppUsage annotation of
Typeface.sDefault.
Developers can already use theme to customize font for their app.
But it still has a huge amount of usage.
For that reason we can't put it into black list now, and further
investigate is required for future action.

Bug: 123769446
Test: atest TypefaceTest
Change-Id: I238c4dfbbf4a4df6a0c477d36560a28cf4dc081b
2019-02-05 14:14:43 -08:00
Haoyu Zhang
c0f9d5a262 Add trackNum to UnsupportedAppUsage annotation of createFromFamiliesWithDefault
We won't change anything of the reflection access of creatFromFamiliesWithDefault.
So we only add the bug number for tracking purpose.
And the TODO is removed because the corresponding ticket is marked as fix.

Bug: 123768395
Test: atest TypefaceTest
Change-Id: I802392859fb611ea558d0c06fc0bd77f5a38c439
2019-02-05 01:58:30 +00:00
TreeHugger Robot
a9f577b5c6 Merge "Added maxSdk annotation to mNinePatchChunk field on Bitmap" 2019-02-04 23:21:55 +00:00
Nader Jawad
d5d17e5148 Added maxSdk annotation to mNinePatchChunk field on Bitmap
Hidden API usage in Bitmap->mNinePatchChunk. Annotated the field
with the max sdk annotation as there is a public getNinePatchChunk
method on Bitmap.

Bug: 123769491
Test: N/A
Change-Id: I59cee2b8af238e5656b1366c044600f6feaa95ab
2019-02-04 13:18:49 -08:00
TreeHugger Robot
6f55e56e29 Merge "Make Drawable#createFrom* support incomplete images" 2019-02-02 01:28:48 +00:00
Peiyong Lin
dd4b22e66c Merge "[Color] Make setColorMode togglable." 2019-02-01 23:20:30 +00:00
Leon Scroggins III
c0fa2b9570 Make Drawable#createFrom* support incomplete images
Bug: 120786924
Test: I18463379d8e3d354ffafd006abd79c0a7918b500

Prior to P, createFrom* supported incomplete images, but this
regressed in P with the switch to ImageDecoder, which does not succeed
on incomplete images by default. Add a PartialImageListener, so that
incomplete images succeed.

Change-Id: Icb57d5857e1dcf6a347bb198f49284ac1975b54b
2019-02-01 21:31:07 +00:00
Kevin DuBois
a28aa5e6ec Merge "Pipe through color sampling to BrightnessChangeEvent" 2019-02-01 17:42:00 +00:00
Peiyong Lin
a94f3221da [Color] Make setColorMode togglable.
Previously setColorMode must be called before view is set, and has no effect
after that. The state of WCG on Android when this patch was written, was that
most hardware out there can not handle mixed color spaces composition well
which results in GPU composition. And this situation will remain true for a
long time.

Despite photography applications want to have WCG, it's a power cost especially
during video playback. In order to mitigate this fact and the desire to move
the ecosystem forward in WCG, we make setColorMode togglable such that in the
next app vsync, when color mode is changed we issue a surface update which
results in the old EGLSurface or VkSurface being destroyed and new EGLSurface
or VkSurface being created with the target color space being set. As a result,
applications can now togglable WCG on/off.

BUG: 120288123
Test: Build, flash and boot. Verify with SurfaceFlinger dumpsys on demo app.
Change-Id: I09bf8c380a01f4dde364873d37b248cedc6ccfd3
2019-01-31 21:34:50 -08:00
TreeHugger Robot
8116124801 Merge "Remove Shader#copy()" 2019-01-31 16:41:50 +00:00
Kenny Guy
908108aa4b Pipe through color sampling to BrightnessChangeEvent
Change brightness tracker to enable / disable color
sampling on screen on / off.
Add value channel to BrightnessChangeEvent if available.

Bug: 112756444
Test: atest BrightnessTrackerTest
Test: atest android.display.cts.BrightnessTest
Test: manual checked pixel3 which supports this and pixel2 which doesn't

Change-Id: I94384752235d891cee975b01f933c0bc0b4572a9
2019-01-31 16:33:06 +00:00
Peiyong Lin
a0baea28b7 Merge "Replace createHardwareBitmap with wrapHardwareBuffer." 2019-01-31 15:37:56 +00:00
TreeHugger Robot
1bd8c8bb4f Merge "Use ColorLongs in Linear-, Radial-, and Sweep-Gradient" 2019-01-31 04:44:38 +00:00
Peiyong Lin
9d4274005e Replace createHardwareBitmap with wrapHardwareBuffer.
The bitmap.createHardwareBitmap doesn't take a ColorSpace as input, as a result
the returned bitmap is always in SRGB color space. Given that we want to remove
the assumption of SRGB color space, we replace the usage of
createHardwareBitmap with wrapHardwareBuffer which takes an extra argument
ColorSpace. As a result, we will be able to also fix SurfaceControl and various
other places that use screenshot in follow up patches.

BUG: 120904891
Test: CtsUiRenderingTestCases
Change-Id: I57fc0c85d68df43b0e69f9a1ebac00d2ba39554d
2019-01-30 15:22:54 -08:00
TreeHugger Robot
028b73d3c0 Merge "Expose new color long Graphics APIs as public APIs." 2019-01-30 22:04:02 +00:00
Leon Scroggins III
85a13eee5e Remove Shader#copy()
Test: make

This is a hidden, protected API that is not called anywhere on the
system. Remove it.

Change-Id: I6d908945826be6f0cf19278d3d3d8d653faf8ebe
2019-01-30 16:01:36 -05:00
Leon Scroggins III
b0aecc22d3 Use ColorLongs in Linear-, Radial-, and Sweep-Gradient
Bug: 122844033
Test: Id1809aef84eca0ccc61bafc2476ad52ed78d5f22

Add APIs that mirror the existing creation APIs, but use @ColorLongs
instead of @ColorInts. Note that call-sites that used a null array (but
not a variable "int[]" pointing to a null array) are now ambiguous. It
is unlikely that there are any such call-sites, though, since they would
throw NullPointerException.

Consolidate constructors. Those that take two color endpoints now create
two-member long-arrays and call the more general constructor, saving
lots of code. The additional cost of small arrays is not as much as it
used to be, in the early days of Android, when this class was written.

In *Gradient#copy, there is no longer any need to clone the colors
array, since the mColorLongs was created by the Gradient. Similarly,
there never was any need to clone mPositions, which was always a clone
of the user-supplied array anyway.

Clean up Shader.cpp:
 - Throw and return if the pointer is null before dereferencing it.
 - Simplify and put together matrix-related code.

Change-Id: Ib71c5e85b2a398959bf687bce33980d3429bcbc3
2019-01-30 16:01:31 -05:00
Derek Sollenberger
a141563dc2 Expose new color long Graphics APIs as public APIs.
Test: existing CtsGraphicsTestCases and CtsUiRenderingTestCases
Bug: 120904891
Change-Id: I1d760a9a4681bd3e01132fe1b9213e5a17eb9c3d
2019-01-30 13:10:11 -05:00
Leon Scroggins III
bee5e20495 Add Canvas#drawColor(@ColorLong)
Bug: 120904891
Test: I857b8c1c9346285b2f6e4670c501c9d0d4053a0e

Change-Id: If08e8b805a4bba1a526efcd3cb05d4cd19f82eff
2019-01-30 10:10:04 -05:00
Leon Scroggins III
870053d44b Add Bitmap#getColor
Bug: 120904891
Test: I61ba938cdbea5154187c3a075c84436f2db81174

getColor returns a Color object in the ColorSpace of the Bitmap.
The underlying SkBitmap may contain values that are outside the
numerical range of the ColorSpace, so clamp them to fit.

Change-Id: I4174b75a83f18d6e165dbd2c724708276e80af21
2019-01-29 08:42:58 -05:00
Derek Sollenberger
7671e41efa Merge "Add Bitmap.setColorSpace()" 2019-01-29 01:58:58 +00:00
TreeHugger Robot
3ffd2c30ac Merge "Suppress IllegalArgumentException on API 28 or before" 2019-01-28 23:14:47 +00:00
Derek Sollenberger
202084c9b8 Add Bitmap.setColorSpace()
Bug: 120904891
Test: CtsGraphicsTestCases
Change-Id: I30be2cd77d810210ad87b281e6bb5587863982c3
2019-01-28 17:25:29 -05:00
TreeHugger Robot
5e55e809a7 Merge "Camera: Add support for dynamic depth image format" 2019-01-28 22:21:46 +00:00
Daniel Solomon
7d7a498788 Hide new ColorSpace APIs
A previous change added two new public ColorSpace APIs. These APIs are
being used only by ColorDisplayService for specific purposes, so for now
make them hidden.

Bug 116516917

Change-Id: Ib644d356a84d4122173ea4cafbac88bd63b1afcd
2019-01-25 15:43:10 -08:00
Seigo Nonaka
d01a515f55 Suppress IllegalArgumentException on API 28 or before
The suppression was added to FontsContract by
I7fba3e4d21fc895dfee4300db7d7e3000095ff92 but not in
Resources.getFont.
This CL adds suppression for Resources.getFont too.

Bug: 122262093
Test: locally verified
Change-Id: I15159dadc7e3694be5d90435a7a24cd626086656
2019-01-24 17:03:01 -08:00
Derek Sollenberger
48340af06e Merge "Don't assume all FP16 bitmaps are linearly encoded." 2019-01-24 16:32:31 +00:00
Derek Sollenberger
6e35e63740 Don't assume all FP16 bitmaps are linearly encoded.
The bitmap.create() function that does not take a colorspace does
not enforce that the bitmap is linearly encoded and as such it is
possible for us to end up with FP16 bitmaps that are sRGB encoded.

Given that we want to remove that restriction (see b/120870651)
we update getColorSpace to report the actual colorSpace of the
underlying bitmap. This pulls a thread that causes a chain of
updates to various classes to ensure proper handling of the native
colorspace.

Bug: 120904891
Test: CtsUiRenderingTestCases
Change-Id: I27780aa603138b0e48f9320c2837bc53e22cdf95
2019-01-23 16:31:52 -05:00
John Reck
5cca8f250c Add continuous SKP capture test api
Bug: 122856066
Test: PictureCaptureDemo
Change-Id: Iaf3a4bc1c8a2c18c7dff635c5f1cf726b331f8bf
2019-01-22 13:13:06 -08:00
Leon Scroggins III
94ba100c50 Convert @ColorLongs in native code
Bug: 120904891
Bug: 122844033
Bug: 122514935
Test: CtsGraphicsTestCases

Only convert rgba. ColorSpace should be converted in Java, so we can
just pass the native pointer and handle potential Exceptions before
going into native code.

Requires a change to external/skia [1] to make SkHalfToFloat SK_API.

[1] https://skia-review.googlesource.com/c/skia/+/185140

Change-Id: I0b42c17159b290868a6bed7b90da096995504c4d
2019-01-18 16:19:53 -05:00
Leon Scroggins III
0e443d1633 ColorSpaces have native SkColorSpaces
Bug: 120904891
Bug: 122844033
Bug: 122514935
Test: CtsGraphicsTestCases

Create an SkColorSpace when creating an android.graphics.ColorSpace.Rgb.
This allows simplifying getNativeColorSpace, so that each time we need
it, we do not need to call back up into Java or reconstruct the
SkColorSpace.

Funnel all ColorSpace.Rgb constructors into one, so we can set a final
mNativePtr in the base constructor. Update TransferParameters to also be
final.

Use the same TransferParameters as SRGB in EXTENDED_SRGB and DISPLAY_P3.

When passing a BitmapFactory.Options to native, call getNativeInstance()
(which may throw an Exception) and pass the result to native.

Move native ColorSpace code into its own file.

Make Paint methods @CriticalNative again, now that they do not need the
JNIEnv.

Remove unused decodeBitmap.

Change-Id: I60adbb060b87ab6f92559f1217bfefc0b9ea72e1
2019-01-18 16:19:48 -05:00
Leon Scroggins III
6ee411010e Add Paint#get(ShadowLayer)ColorLong
Bug: 120904891
Test: I6de01bd94fade605643af590f8d6909f09a5831e

Store Paint's colors (both the ShadowLayerColor, and the previously
uncached color that is stored in the native SkPaint) as @ColorLongs.
When setting or retrieving the int version, convert. This allows
returning the long value that was manually set, so that we return the
color in the ColorSpace that was requested.

Since the color is already stored in Java, remove nGetAlpha, and return
the alpha from the ColorLong. When setting alpha, update the cached
value, too.

Make setShadowLayer(..., @ColorInt) and setColor(@ColorInt) call the
@ColorLong versions, so they can share single JNI entry points.

Change-Id: Ifc559893dd4db2629c59b6e53f0b2166d43e6049
2019-01-16 14:26:20 -05:00
Leon Scroggins III
8bbcd3477c Add Paint#setShadowLayer(..., @ColorLong)
Bug: 120904891
Test: I38537394bf314668cc38349c34b9492164cb0c92

Change-Id: Id1c294a2a79087cfaaf4a25fa4888f706fdb8124
2019-01-15 15:37:36 -05:00
Leon Scroggins III
aefa03dd9e Add Paint#setColor(@ColorLong)
Bug: 120904891
Test: Iba796744a9cc3652a6bc1881a9b229403ffaed31
Change-Id: Ib03212b27bc330e61b876a4be3d45c34ed551540
2019-01-15 15:37:36 -05:00
Daniel Solomon
edb5e1a1b8 Merge "Add Display Auto White Balance to ColorDisplayService" 2019-01-15 19:29:16 +00:00
TreeHugger Robot
77571c7f31 Merge "Add Bitmap#eraseColor(@ColorLong) + helpers" 2019-01-15 18:50:21 +00:00