that sharing a Drawable across multiple Views/Drawables can lead to
undefined rendering behavior
Bug: 70594326
Test: Re-ran CtsGraphicsTestCases
Change-Id: Ia6923886c809b6d81ead43becd8c725ae79ee999
match the API surface exposed in ColorStateList.
Removed the @hide annotation for the following StateListDrawable APIs:
--getStateCount
--getStateSet
--getStateDrawable
--getStateDrawableIndex
Fixes: 30325322
Test: Re-ran StateListDrawable CTS tests and added tests to verify each
of the newly exposed APIs
Change-Id: If93a017b6cf690fc38381a234bf3bd19d0bfc675
ColorDrawable previously did not implement getColorFilter despite having
a proper setColorFilter implementation. Updated ColorDrawable to support
getColorFilter returning the corresponding ColorFilter configured on
it's paint.
Change-Id: Iabc3cd1b9110f5c3ec25e26a31966e2a43f8fb16
Fixes:78476471
Test: Re-ran CtsGraphicsTest
flag
Updated Bitmap java and native implementation to redirect queries of
mutability to the native implementation provided by Skia. Updated
documentation of Bitmap.createBitmap method to accurately describe
mutability of the Bitmap result based on various inputs.
Removed flag from Bitmap class in favor of querying jni API directly.
Updated Bitmap constructor to no longer utilize mutable parameter
provided by jni call. Created hidden setImmutable method that invokes
corresponding native method to flip the Bitmap's mutability flag.
Fixes: 65560449
Test: Re-ran CTS tests and updated Bitmap tests to verify mutability of
all creation methods
Change-Id: I1b0b9de2fc15369b4e3f83512b866915387ac926
Works around a source of jank when drag resizing in split
screen mode: instead of immediately resizing the (potentially
numerous) invisible secondary stacks, we defer that until
the user lets go of the handle.
Change-Id: I3b9faa83005fa86185d4e51b2849e3a826b7f6a9
Fixes: 78214347
Test: Open a gazillion (resizeable) tasks. Enter split screen. Drag handle, verify there is no jank
Test: atest RectTest
StackView currently expands the clip of the view which is a prohibited
operation in API Level 28. This CL currently allows this specialized
use case to work in this situation until we can update StackView
to not clip to its bounds and then just intersect with this clip
provided by its parent.
Test: CtsWidgetTestCases
Bug: 77642155
Change-Id: Icc003ad3946bb226368ec2030d4707753f4f55e9
Bug: 73088142
Test: Test app at https://buganizer.corp.google.com/issues/73088142#comment6
Test: GridWidgetTest.testItemDecorationAndMarginsAndOpticalBounds
In computeBitmapSize, treat padding as a size in scaleFromDensity. This
results in rounding instead of truncating. This matches the way optical
insets are handled. It also matches the padding we would have gotten if
we had scaled at decode time.
Change-Id: I7d3a83ba824b8dc81187ce9b2d9889d4a87f88ac
Removed PorterDuffColorFilter#setColor and PorterDuffColorFilter#setMode
as the public facing ColorFilter API is immutable. These framework
internal APIs were causing issues with Drawables as updates to state of
the ColorFilter would not be propagated up to the Drawable to cause an
invalidation.
Fixes: 77723600
Test: Ran atest on SystemUITest and CtsGraphicsTest modules
Change-Id: I935c9e35ffa225735b951bb3b1eb753ea5815a84
method to delete the corresponding Xfermode to the wrapped drawable
Added coretest to verify the hidden API properly propagates the Xfermode
to the wrapped drawable
Change-Id: I1f14105b7019b57bfcdd7182bb50ea2465c91ffe
Fixes: 30840201
Test: Ran atest on coretests
recompute GradientDrawable drawing bounds
Updated logic in GradientDrawable#setStrokeInternal to set the
mGradientIsDirty flag to true when the stroke is changed in order to
have ensureValidRect be called and recompute the drawing bounds
configured on mRect. In the event that a stroke width is defined, the
drawing rect must be inset by half the stroke width. Otherwise the
stroke will be drawn at the edges of the boundary and be clipped.
Bug: 70915849
Test: Ran test app provided in bug and confirmed that modifying the
strokeWidth on a pre-existing GradientDrawable matches the behavior of a
brand new GradientDrawable instance used as the background on a view
Change-Id: Icaa53d936589a9b4790f89e894f1d745c6e4fe43
Bug: 76448902
Bug: 70889348
Test: Manual + CtsThemeHostTestCases
(Ica5e7e81848c3880accee922ee6f1cc9e26262ca)
Scaling a nine-patch requires scaling its divs. When the scale factor is
not an integer, we have to round. This gets out of sync with the way the
decoder scaled the image, resulting in stretching or keeping fixed the
wrong portions of the image. Making this worse, when we scale down, we
end up with divs colliding with each other, and we have to arbitrarily
adjust them further so they do not collide.
NinePatchDrawable and the drawing code already know how to handle
drawing from the originally-sized image and do a better job stretching
appropriately, so allow them to do their job.
We already do something similar for Bitmaps created by ImageDecoder on
apps targeting P and above - instead of scaling them up, we allow the
BitmapDrawable's scaling code to handle density differences. We
preserved the old behavior (scale up) on apps targeting pre-P because
those apps may rely on the size of the Bitmap contained in a
BitmapDrawable without accounting for its density (see Bug: 74061412).
But that is not an issue for NinePatchDrawables, which do not allow
peeking at their internal Bitmaps.
Rewrite ImageDecoder.computeDensity. There is no need for it to be
static, since it takes an ImageDecoder as a parameter and reads its
fields, including the new field mIsNinePatch. Set mIsNinePatch in the
constructor to avoid another down call into native. Split up the
conditions that result in returning srcDensity without calling
setTargetSize for clarity.
Remove ImageDecoder constructor from the graylist. It was accidentally
added due to the fact that it is called transitively from public APIs.
Change-Id: I3c5ddd67f3352c991515f30ce1c477c9a608833f
match corresponding documentation to fall back to
setColor(Color.TRANSPARENT) in the event that null is passed as the
ColorStateList parameter
Refactored implementation to directly call setColor(Color.TRANSPARENT)
if setColor(null) is invoked, otherwise configure the solid colors and
the fill Paint color to the ColorStateList and resolved color for the
given state
Bug: 64951083
Test: Compiled, flashed an updated build of master onto taimen and
re-ran tests with updated implementation in GradientDrawableTest
Change-Id: Ia7e9a995fc78e49d601931ca6af81470d90f8439
Because ShapeState#newDrawable passes a reference to the existing
ShapeState instance, modifications to a single ShapeDrawable instance
affect all instances of the ShapeDrawable obtained through
ShapeState
Bug: 74570674
Test: Tested by flashing a local build onto a Taimen and running
the sample application provided in the corresponding bug to verifying
that both usages of OvalShape within the sample app produce the same
visual result
Change-Id: I10a8aac8eb51d551a13f2b6292f0cd84bff84045
Bug: 77507530
Test: No change in behavior, no new tests
Add @Px and @IntRange annotations, and be explicit that setTargetSize
refers to pixels. Add a comment to setTargetSampleSize that is like
calling setTargetSize with particular values, to try to make it clear
how the two are related.
Change-Id: Ie7e9429bc8c548f44d382358c161425f666ba82f
Bug: 76461699
Bug: 76448408
Test: No change in behavior, no new tests
Add class level docs for ImageDecoder, including sample code. Update
wording to be more clear and less wordy. Fix broken attempts at using
sample code.
Incorporate advice at go/android-api-guidelines and
https://developers.google.com/style/api-reference-comments
Change-Id: Iaf1334993f6cd2d3f6e53d3fb70ef9c7a95c9a76
The saveLayer APIs are restored from @removed but will treat input
as ALL_SAVE_FLAGS and generate exceptions on newer API levels.
We internally used these calls in one situation that now use a
different @hide API to support the previous behavior until we
refactor that code.
Partial revert of "Remove deprecated android.graphics.Canvas APIs"
This reverts commit 7b837616ae.
Bug: 77276963
Bug: 73777445
Test: CtsGraphicsTestCases
Change-Id: I7acd4ffd5ac41a58d2be8b48cf50119c2b896708