Bug: 73529437
Test: I7907f5dd7eb8d4ab72b8e9ddcbcbfc7aa8cb05ae
Support AutoMirroring, from inflation and setting manually.
Ensure that AnimatedImageDrawable always has a State object, even if
it has no mNativePtr. If it has no mNativePtr, throw an Exception when
trying to use it.
Require that inflation have a valid src, unless it is waiting on a theme
(like BitmapDrawable).
Change-Id: I5b22cdbf4b57862d6ccc5750a677168287860f9f
Bug: 27847286
Test: none
Now that we have a framework replacement, deprecate this little-used
class.
Change-Id: Iedec214c7eb729ccb77d2b4818971393938b2295
This is 2nd attempt of I7db9e2ca4db68a16648cfb8fcf63555f501304c2
This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
(It can not be used for TextView)
Bug: 67504091
Bug: 72861572
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
CtsWidgetTestCases:TextViewFadingEdgeTest \
FrameworksCoreTests:TextViewFallbackLineSpacingTest \
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
CtsTextTestCases
Change-Id: Ie73bce52c6c673cda58973ddad04627a7cf2e5e9
This reverts commit ac9c8f7c1e.
Bug: 73083791
Bug: 73364985
Don't scale NinePatchDrawable if bitmap has no density (including fix
for 73364985).
Fixed bugs around density and input streams.
Update PointerIcon to account for the fact that BitmapDrawable no longer
scales its Bitmap up at decode time. PointerIcon now handles the
scaling. This is necessary because PointerIcon never draws its Bitmap.
Instead, native code uses the Bitmap's internal SkBitmap without
accounting for density.
Test: Ran CTS:
- CtsUiRenderingTestCases
- CtsGraphicsTestCases
- I2d3976061d164ab4d58209db1320917f272a1958
- CtsViewTestCases
- ThemeHostTests
Change-Id: I3e0c11195622d65f084ce79dad887504630177ca
The last change needs more discussion and found some edge cases. Revert and make small step-by-step changes.
Bug: 73091756
This reverts commit 7fd36d19e3.
Change-Id: I89ff52a70cf6a5d6c553afa20f83719e1f9eb726
Dew to a side effect of HWUI opengl pipeline, the hairline stroke
is not respected, but it is drawn as a fill style. Implement the
same behaviour for skiagl pipeline with SDK API 27 and older.
On SDK released with Android P, the hairline stroke is respected.
Bug: 72494357
Test: Ran duolingo app
Change-Id: I48bdcf3ddec4bf65b5e93e01c5002177c4e3da90
Resources.getDrawable() was annotated @Nullable because there was one
very particular path where Bitmap decoding would fail and trigger a null
return.
As part of the switch to ImageDecoder, that path was changed to now throw
an IOException, which will result as a NotFoundException to the caller of
getDrawable.
This CL annotates that path as @NonNull to reduce pain of dealing with
@Nullable method that was very unlikely to be null in practice.
Also fixes many other missing nullability annotations, and relabel
many @Nullable paths that would never return null in practice as
@NonNull.
Bug: 69543526
Test: ResourcesTest
Change-Id: Ib01eca970c5c9969998ce5b265b120aa7048b41a
Ensure that the start x/y is clamped to accomidate
the animations' starting radius as well
Bug: 72173993
Test: Clicked on controls in API demos
Change-Id: I2a56a240a9cd0f77bdc458930d1a844611ea7148
Turn off AA from GriadientDrawable, while drawing with SRC
transfer mode. This CL speeds up drawing by avoiding intermediate
texture buffer in skia.
Bug:72804165
Test: Measured performance with systrace on opening a notifiation.
Change-Id: Icc69de90d81e8b1c4492f97722f72e7440d9acac
Test: Existing tests
Add a new (hidden) ImageDecoder.Source that accepts an AssetInputStream.
This allows us to create an AnimatedImageDrawable without fear of the
client closing the stream.
Call it from ResourcesImpl instead of Drawable.createFromResourceStream.
Change-Id: I07e00ca60c97538335a6310e830b73211fd8e7bb
This CL updates Typeface.createFromFile and Typeface.createFromAsset so
that they would use the Typeface.Builder. To keep the behavior similar
to previous behavior, the existence of the given font file is checked,
and an exception is thrown if the file does not exist.
Test: atest FrameworksCoreTests:TypefaceTest
Test: atest android.graphics.cts.TypefaceTest
Test: atest CtsGraphicsTestCases:PaintTest
Bug: 72834540
Change-Id: Ibe9907440130ca91369b16c6cbac503f4a34e301
Test: manual
This is only necessary for the software case. No need to create it for
the more typical case of drawing in hardware.
Change-Id: I0f041d59445f874160eeea5b13a54fd89fa26df8
Don't scale NinePatchDrawable if bitmap has no density.
Fixed bugs around density and input streams.
Update PointerIcon to account for the fact that BitmapDrawable no longer
scales its Bitmap up at decode time. PointerIcon now handles the
scaling. This is necessary because PointerIcon never draws its Bitmap.
Instead, native code uses the Bitmap's internal SkBitmap without
accounting for density.
Test: Ran CTS:
- CtsUiRenderingTestCases
- CtsGraphicsTestCases
- CtsViewTestCases
Change-Id: I030b4bb89c66b0102ccea2d85f5271197558d14e
Bug: 34881007
Test: bit CtsGraphicsTestCases:*
Test: bit CtsUiRenderingTestCases:.testclasses.HardwareBitmapTests
Change-Id: Ic751c356682ea3db17a1b031ec46106a1a2ab918
Bug: 63909536
Test: none
This version is never used internally with a non-null Options object.
The Options object prevents us from taking advantage of the new
ImageDecoder.
Change-Id: I867f482249a0a6f4b37220b597ef38abf0684360
Bug: 63908092
Test: Manual
If the animation is running on the render thread, post a message (in
JNI) to call the listener.
Use a weak reference in the native listener so that it does not create
a cycle.
Don't add a listener if it's already in the list. Remove the native
listener when the Java listeners are all removed.
Call onAnimationEnd when the animation is stopped manually.
Change-Id: I5dc070089fb1cf399ac3316292592f614f2738f0
Bug: 63909536
Test: Existing CTS tests
ImageDecoder will bypass the InputStream if possible, allowing it to be
more efficient. In addition, it handles density scaling differently;
instead of using more RAM to scale the image up, it results in scaling
at draw time.
Change-Id: Ied7c0865a736f9ef0de367299264e18ccc3e0b92
The supporting broken font is over engineering and it works the same as
default font fallback in most cases.
Removing fallback logic and return default fallback.
Test: bit CtsTextTestCases:*
Test: bit CtsGraphicsTestCases:*
Test: ./gradlew appcompat-v7:connectedDebugAndroidTest
Test: ./gradlew support-compat:connectedDebugAndroidTest
Bug: 65024629
Change-Id: Ib3fc0d638c6aee904cdf865082f8d5ae7d31ba48
Bug: b/63908092
Test: Manual: Ie18811ba29a1db163aca08472b04ae185e9344f0
If the animation has already started and stopped (via stop()), restart
the animatino on a call to start().
Change-Id: I0a14a1e643f32469fe5519949ee8ef046107e9a8
Bug: 63908092
Test: Manual: Ie18811ba29a1db163aca08472b04ae185e9344f0
Depends on https://skia-review.googlesource.com/#/c/skia/+/101544. That
change removes the Skia class's time checks, and leaving it up to the
client to keep track of the time. In this case, the client wants to keep
track of the time because it only wants to update while it is being
drawn. If it goes off screen (for example), it will just resume where it
left off when it returns on screen. This allows for smooth animations.
If an AnimatedImageDrawable is being drawn to a SkiaRecordingCanvas,
decode on the new (lazily-created) AnimatedImageThread.
When running, always decode one frame ahead on the AnimatedImageThread
so that it will be ready when it is time to display.
During prepareTree, update the time and check whether there is a new
frame ready to draw or the next frame needs to be decoded. In either
case, return true. The next frame to be decoded will be triggered by
onDraw.
Change-Id: If447976e9df417060a950f658dbca9cf7980dd02
Test: I28f82285c0341aff7192eb0157e0de4b97cda577
This is called by public methods that pass along an InputStream. As
such, it is possible that the client was planning to continue reading
from the InputStream, so do not close it.
Change-Id: Iaa53c44d578c1311315616c8fd931bed40290a92