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
Bug: 120904891
Test: I162451ebf807f3a8a44679e5c10406468c922500
- Add Bitmap#eraseColor(@ColorLong). This allows erasing in ColorSpaces
besides SRGB. New API is hidden pending API-council approval. It is
@TestApi so it can be used by the new tests.
- Rewrite Bitmap#erase(@ColorInt)'s internals. The ColorInt should be
treated as an SRGB color. The old code (deep in SkPixmap::erase)
treated the color as being in the SkColorSpace of the SkBitmap.
- Update getNativeColorSpace to return immediately when it throws.
Existing callers should never throw anyway, since they do their own
checks (and throws) in Java before reaching this method. But relying
on this method to properly return simplifies the new callers.
Change-Id: I1b736934ce1b8294c827bb61c2a363207569da4f
This change adds Display Auto White Balance to ColorDisplayService.
Given panel chromaticity data, a nominal white point, and a desired
correlated color temperature (CCT), this logic generates and applies a
matrix transform to shift the nominal white point to match the desired
CCT.
Bug 116516917
Change-Id: I07e341881a020a130944217fff372003edac0a8c
Test: Ide74c2e98d4aadba8bb0a24d132f161dbe64f4db
Previously, BT709 was believed to be SRGB, resulting in errors when we
tried to convert between them. Make isSrgb test several values passed to
OETF and EOTF to verify that it is very close to SRGB. This results in
BT709 no longer being considered SRGB, fixing the conversion.
Update the documentation to reflect the new behavior.
Now that isSrgb is more restrictive, a gamma of 2.2 is no longer
considered to be SRGB, which requires a change to a CTS test.
Change-Id: I7bf8d5e3af2f91e38ca0b0d5d906713a125dd484
Test: I1759437bf620868706be0aadce2250ac9194ca7d
The intent is that an index that does not match a Named ColorSpace will
throw an IllegalArgumentException, so make that true for
Named.values().length, which does not correspond to one.
Also, update the Exception message to make it clear that the last index
is exclusive.
Change-Id: I015b7ee6274873cc329653473ead04b08f1cd55f
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.
Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.
For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.
Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.
Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.
Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.
For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.
Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.
Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
Implement controlWindowInsetsAnimation
Based on the leashes we have on the client, and the insets the
client has requested, we are able to move the surfaces around
such that the resulting insets will match what the client
requested.
Bug: 118118435
Change-Id: I0616e53455a6544aaf374c1b0eb10e258aced21d
Instead of allocating a separate renderTarget and switching
between them on each draw the new implementation follows the same
pattern that the old HWUI renderer used. The area of the layer is
now copied to a buffer on the GPU, the area is then cleared, rendered
as normal, and finally the texture is redrawn using dst_over blending.
This results in no render target switches and is considerably faster
on some hardware.
Test: CtsGraphicsTestCases, CtsUiRenderingTestCases
Bug: 119222339
Change-Id: I716aac1fc31e4c7a171373d37dee82034c01cf18
Before this change, creating a DrawableWrapper (through a custom class
that extends it) using the public constructor will not set the drawable
callback properly and DrawableWrapper will not update when the
underlying Drawable is invalidated.
Test: CTS test added
Bug: 120835632
Change-Id: I3545db76e032c0bd074846e0fa64c5cf01e2941c
The text direction can not be fully determined in detached state.
To improve even in that case, compute PrecomputedText from existing
PrecomputedText with new direction.
Here is the performance difference. According to the perf test result,
up to 80% of computation can be recycled from existing PrecomputedText.
android.text.StaticLayoutPerfTest (u sec):
PrecomputedText Greedy NoHyphenation : 371 -> 371: ( +0, +0.0%)
PrecomputedText Greedy NoHyphenation DirDifferent: 6,923 -> 1,437: (-5486, -79.2%)
RandomText Greedy NoHyphenation : 6,633 -> 6,627: ( -6, -0.1%)
On the other hand, this CL increase the memory usage of the
PrecomputedText up to 10%. Here is an reference memory usage.
android.text.PrecomputedTextMemoryUsageTest (bytes):
MemoryUsage
Arabic Hyphenation : 17,135 -> 18,116: ( +981, +5.7%)
Arabic NoHyphenation : 17,135 -> 18,116: ( +981, +5.7%)
CJK Hyphenation : 29,000 -> 31,584: (+2584, +8.9%)
CJK NoHyphenation : 29,000 -> 31,584: (+2584, +8.9%)
Latin Hyphenation : 16,526 -> 17,185: ( +659, +4.0%)
Latin NoHyphenation : 14,200 -> 14,784: ( +584, +4.1%)
Bug: 119312268
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: minikin_tests
Change-Id: Ia02c201afac5d7d1c086a45f15696f39a6b2a76c
Created new BlendMode enum that maps to XferModes with additional
supported native values that map to SkBlendMode constants
Created new BlendModeColorFilter
Deprecated PorterDuffColorMode and PorterDuffColorFilter in
favor of BlendMode and BlendModeColorFilter.
Updated Paint API to use setBlendMode and deprecated setXfermode
Bug: 119671925
Bug: 112166079
Bug: 73224934
Test: Added CTS tests for BlendMode and BlendModeColorFilter
Change-Id: Idd50e2f0b81975c5ecf6f1c0edd4eb68198d9131
Add a ColorSpace API that computes the chromaticity coordinates of a CIE
series D illuminant from the specified correlated color temperature.
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug 116516917
Change-Id: I6c9f2a23ed548556d5fbdcc22ed5a094a76bb8e4
and parameters provided by the Theme leading to array size
mismatch exceptions being thrown.
GradientDrawable#updateGradientDrawableGradient is invoked multiple
times during xml inflation, once with the attributes provided in the xml
and another with attributes provided in the Theme. However, if
parameters come from both the xml resources and the theme, when
theme attributes are applied it can partially squash previously applied
values.
In the case of gradients this can lead to a previously initialized
positions array with floating point offsets for color positions
being applied but not overriden with theme attributes that only include
a portion of the attribute values leading to exceptions being thrown
as the colors and positions arrays are not of the same size
Bug: 112122447
Test: Created test of xml inflation of GradientDrawables both with and
without theme attributes
Change-Id: Ie4183e2304677d30b6faef1cdc5c1be27ef9edd4
This CL starts a journey to discover a brave new inset world. The
path to get us there may be rocky, but it's going to be rocky.
One of the main pledges of the new API is that an app can retrieve
what is causing a certain inset easily. For that, we need to
dispatch metadata who is causing what inset, such that we can query
it from the client side.
Furthermore, the client will be able to manipulate insets directly,
but also listen to animation changes. We don't want to go through
window manager for that, thus, there needs to be a local codepath
from (global window state -> WindowInsets).
Because we have these two requirements, we dispatch the relevant
global window state for insets, represented by InsetsState, and
dispatch it to the client. On the client side we take the frame
and the InsetsState and generate WindowInsets out of it.
Bug: 118118435
Test: InsetsSourceTest, InsetsStateTest, InsetsSourceProviderTest,
InsetsStateControllerTest
Change-Id: I2bfe9dda376512916261823fc2ee35cbedeb6731
mFamilies was added for itemize API but it won't happen in this
release, so removing unused member from Typeface.
Bug: 120177351
Test: TreeHugger
Change-Id: Iee0e381b28aa42daba1621084ce5a9d1a8753cd5
This API is needed to port PrecomputedText in support library.
Bug: 112327179
Test: atest CtsWidgetTestCases
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Change-Id: Ib3aa4cc9e486bdcf6e4cbbfa75c0d2cf6960e982
Added maxTargetSdk version for Android P for access of mBitmap field
through reflection. The bitmap field is configured by application usages
only already so there is no need for apps to query the Bitmap from the
Canvas and should do so directly. Getters on Canvas is generally seen
as an anti-pattern.
Bug: 117521088
Test: none
Change-Id: Ie2318248f7682fd4e0a46121bc6e9f5c1546dcfb
Modify Drawable public API to no longer mark isProjected
as hidden. This makes the Drawable API consistent with the public
RenderNode API and enables androidx to move away from accessing
this method through reflection
Bug: 120159096 117521142
Test: none
Change-Id: Icdd778bf3d8842eb2d69e5872f704c7e96f915fa