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
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
* changes:
Added the reply draft as an extra to the content intent
Launching notification settings correctly inline
Launching Notification animations inline
Bug: 63908092
Test: I85979ae3d8c6a6dae6e4299dc3be291e12024290
Implement Animatable2, adding listeners for starting and ending the
animation.
Add setLoopCount for changing the loop count.
Add the ability to inflate from XML, by using the name of the class or
"animated-image", which mimics "nine-patch", "bitmap" etc.
Move internal variables to a State class so that they can be transferred
to a default constructed AnimatedImageDrawable.
Change-Id: Ice8149e7de55f7ffb4b4ba9dd9c856582fc42bc9
Using the new control mechanism introduced in order
to coordinate notification launches and smoothly
transform the notification into the launching window.
Bug: 69168591
Test: add notification, launch it
Change-Id: Ib2d671c65f276ec596a2f07edf64d65bf27a2882
Suppress a warning for constructor-chaining not using all parameters.
Bug: 72451126
Test: m javac-check RUN_ERROR_PRONE=true
Change-Id: Ie47dec119ec578b79d866d9c5041bb7b68eac146
Bug: 63908092
Test: HwAccelerationTests
Do not start the animation at creation time
When starting, first update the time, so it doesn't think we skipped a
bunch of frames if we're resuming.
Continue storing the SkPicture when stopped, so that we can continue to
show the same frame, without a jump.
Change-Id: I5ac77f2561fc9f42f8f69ebfbee21fe647cfc75a
Bug: 72381918
Test: Covered by existing tests
This CL seems to have broken the theme tests. In addition, it changes
the behavior of a couple of cases of passing InputStreams to the
framework. Previously, the framework used BitmapFactory, which did not
close the InputStreams, but ImageDecoder does.
Planning to reland along with the fix for closing in ag/3497523 and the
fix for the theme tests.
This reverts commit 66c6d78908.
Change-Id: I4ac6d0f2e1e2bb0925ae71c141bfe8a0d37e6a16
The current implementation schedules the next frame of the images
to be decoded after the current frame completes but potentially
schedules tasks that will result in a no-op execution if a new
frame is not yet needed.
Test: HwAccelerationTest
Change-Id: I0510cb5a1b801abd651327e924deb586af0306d6
ImageDecoder is a new way to decode Bitmaps (or Drawables) that
streamlines common use cases of BitmapFactory.
Bug: 63909536
Bug: 63908092
Test: I0f36ce34c968fd7fae4d8edebabea3a421859615
Ib2877276da8464b5f3eef0bbb848de202c90e97e
I8d1672180d8325ae1caf44f0bbf41036b94e6253
I405ebc86f7b6b019e0f040f1d4afe2e9d4354e5d
Iaeb7c27bafb351932f0fabe59461ef50b1e2424a
Change-Id: Iee236ac73e0bc37ef6903a8150c0d2c84e5cf906
Many themes appear to have forgotten to set
the alphas value on the color state list they
pass to RippleDrawable. The previous implementation
always divided the alpha by 2 which resulted in
the accidentally opaque color being 50% opacity instead.
To match that behavior without adding back the
unusual divide by 2 we simply cap the alpha to 128.
Similarly we surpress the hover & focus events if
a press is already in progress, which prevents a funky
background flicker on views with FOCUSABLE_AUTO that
gain focus part way through a click event.
Also fixes a bug where rapid tapping resulted in the
hardware animation appearing to not play as it had
a start value of 0 instead of paint.getAlpha()
Software animation already has this correct behavior,
so no changes needed for the fallback path.
Bug: 72173993
Test: tested hangouts, pin entry
Change-Id: I7110779234422e82cdd5d737aa00c1280b13760c
If required due to density mismatches the ImageDecoder will not
upscale the image at decode time, but instead will decode at the
bitmaps default size and upscale at draw time. This can be a
significant memory savings for low-dpi assets being used on a high-dpi
device.
However, if the provided asset has a higher dpi level than the bitmaps
default density then we will match BitmapFactories behavior and downscale
the bitmap to match the default density.
Bug: 63909536
Test: CtsGraphicsTestCases
Change-Id: I189306b7a3b706bed32bb267970ade27a57c0e7f