Commit Graph

3375 Commits

Author SHA1 Message Date
Leon Scroggins
67190cf8eb Merge "Deprecate Movie.java" 2018-02-20 21:08:14 +00:00
TreeHugger Robot
75c515effa Merge "Implement AnimatedImageDrawable.getColorFilter" 2018-02-20 17:04:14 +00:00
Leon Scroggins III
fe2ab67894 Deprecate Movie.java
Bug: 27847286
Test: none

Now that we have a framework replacement, deprecate this little-used
class.

Change-Id: Iedec214c7eb729ccb77d2b4818971393938b2295
2018-02-20 11:38:11 -05:00
John Reck
96fccbe20a Yet more alpha tweaks for Ripples
Change-Id: If714a90d847882e04863723e1849e12a8f987fac
Fixes: 72173993
Test: API demos controls tests, clicked stuff, mouse & kbd used.
2018-02-16 13:18:30 -08:00
Leon Scroggins
299b0e4b4e Merge "Reland "Call ImageDecoder directly in ResourcesImpl"" 2018-02-16 11:25:23 +00:00
Leon Scroggins III
513031d15b Reland "Call ImageDecoder directly in ResourcesImpl"
This reverts commit 0f05b4895d.

Bug: 73083791
Test: CTS (I08618dcd7707e5857ed8f8f01fd78b4129cd5804)

Change-Id: I8a95725c8453d94f406c2c14d2c3555dc1c2901f
2018-02-15 21:48:55 +00:00
Leon Scroggins III
2f1b06b58f Reland "Use ImageDecoder for NinePatchDrawable and BitmapDrawable"
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
2018-02-15 14:14:25 -05:00
Seigo Nonaka
f0b0a10de5 Merge "Revert "Reorganize MeasuredText API"" 2018-02-15 03:56:04 +00:00
Seigo Nonaka
4e90fa262d Revert "Reorganize MeasuredText API"
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
2018-02-14 17:03:16 +00:00
TreeHugger Robot
72698e6f39 Merge "Revert "Use ImageDecoder for NinePatchDrawable and BitmapDrawable"" 2018-02-13 20:13:04 +00:00
Seigo Nonaka
7fd36d19e3 Reorganize MeasuredText API
This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- PrecomputedText is no longer a Spanned.
- 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)

Here is a performance scores: (median, walleye-userdebug, N=20)

StaticLayout creation time (w/o patch -> w/ patch)
 PrecomputedText Balanced Hyphenation  :    743,615 ->    737,145: (-0.9%)
 PrecomputedText Balanced NoHyphenation:    551,544 ->    542,715: (-1.6%)
 PrecomputedText Greedy Hyphenation    :    500,343 ->    499,601: (-0.1%)
 PrecomputedText Greedy NoHyphenation  :    497,987 ->    492,587: (-1.1%)
 RandomText Balanced Hyphenation       : 19,100,592 -> 19,135,289: (+0.2%)
 RandomText Balanced NoHyphenation     :  8,015,088 ->  7,954,260: (-0.8%)
 RandomText Greedy Hyphenation         :  7,950,915 ->  7,877,424: (-0.9%)
 RandomText Greedy NoHyphenation       :  7,939,337 ->  7,863,471: (-1.0%)

PrecomputedText creation time (w/o patch -> w/ patch)
 NoStyled Hyphenation                  : 18,935,638 -> 18,925,422: (-0.1%)
 NoStyled Hyphenation WidthOnly        : 18,469,726 -> 18,978,413: (+2.8%)
 NoStyled NoHyphenation                :  7,940,792 ->  7,919,127: (-0.3%)
 NoStyled NoHyphenation WidthOnly      :  7,463,230 ->  7,922,643: (+6.2%)
 Styled Hyphenation                    : 14,822,501 -> 14,809,017: (-0.1%)
 Styled Hyphenation WidthOnly          : 13,891,770 -> 14,656,617: (+5.5%)
 Styled NoHyphenation                  : 14,511,134 -> 14,301,503: (-1.4%)
 Styled NoHyphenation WidthOnly        : 13,495,345 -> 14,264,314: (+5.7%)

StaticLayout draw time (w/o patch -> w/ patch)
 PrecomputedText NoStyled              :    663,974 ->    661,610: (-0.4%)
 PrecomputedText NoStyled WithoutCache :    648,294 ->    648,766: (+0.1%)
 PrecomputedText Styled                :    879,322 ->    852,770: (-3.0%)
 PrecomputedText Styled WithoutCache   :  1,084,570 ->  1,110,147: (+2.4%)
 RandomText NoStyled                   :    565,682 ->    555,435: (-1.8%)
 RandomText NoStyled WithoutCache      :  9,070,533 ->  9,064,825: (-0.1%)
 RandomText Styled                     :  2,955,202 ->  2,962,008: (+0.2%)
 RandomText Styled WithoutCache        : 12,242,325 -> 12,228,573: (-0.1%)

Bug: 67504091
Bug: 73091756
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
    CtsWidgetTestCases:TextViewFadingEdgeTest \
    FrameworksCoreTests:TextViewFallbackLineSpacingTest \
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
    CtsTextTestCases
Change-Id: I7db9e2ca4db68a16648cfb8fcf63555f501304c2
2018-02-12 20:50:41 -08:00
Leon Scroggins III
ac9c8f7c1e Revert "Use ImageDecoder for NinePatchDrawable and BitmapDrawable"
Test: CTS tests

This reverts commit 5aec67ca1b.

Reason for revert: b/73166619

Bug: 73166619
Change-Id: Ic8b2a83abf5567119c8b6af1ec00445a5a6a9cc2
2018-02-12 12:36:49 -05:00
Siyamed Sinir
7cc9c01db7 Merge "Fix imports in text related graphics classes" 2018-02-09 22:47:41 +00:00
Siyamed Sinir
46dd24a710 Fix imports in text related graphics classes
Test: atest CanvasTest
Test: atest TypefaceTest
Test: atest PaintTest

Change-Id: I0d022e39a68be1b22d3036e928eaec1929789261
2018-02-09 12:35:22 -08:00
TreeHugger Robot
25d7f46aa9 Merge "Revert "Call ImageDecoder directly in ResourcesImpl"" 2018-02-09 03:47:26 +00:00
TreeHugger Robot
88f284a3d3 Merge "Change Resources.getDrawable nullability" 2018-02-09 01:30:23 +00:00
Stan Iliev
7717e22c85 Draw text with a hairline stroke as if it is fill style
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
2018-02-08 23:04:47 +00:00
Leon Scroggins
0f05b4895d Revert "Call ImageDecoder directly in ResourcesImpl"
This reverts commit 40c59fdef0.

Reason for revert: b/73083791

Change-Id: I044e534be07c5fd18c99dcc65a14b72eaf1fecd5
2018-02-08 21:14:32 +00:00
Chris Craik
ceb2693621 Change Resources.getDrawable nullability
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
2018-02-08 13:11:38 -08:00
TreeHugger Robot
ed78ab7ec9 Merge "Clamp ripple starting x/y further" 2018-02-08 19:37:35 +00:00
Leon Scroggins III
8ed124d57e Implement AnimatedImageDrawable.getColorFilter
Test: CTS: Ie9766f24164d6b035944b1fe82c2d285482ad1d2

Change-Id: I7f2cb0da918ae67c7a5906a478012fa25678294c
2018-02-08 11:37:31 -05:00
John Reck
92aef5d9fe Clamp ripple starting x/y further
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
2018-02-07 14:36:02 -08:00
Stan Iliev
d192911e95 Turn off AA while notification expanding animation is running
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
2018-02-07 19:27:52 +00:00
Leon Scroggins
349f1487fe Merge "Deprecate createFromResourceStream with BitmapFactory.Options" 2018-02-07 13:02:31 +00:00
TreeHugger Robot
bc38a217b9 Merge "Call ImageDecoder directly in ResourcesImpl" 2018-02-06 18:34:40 +00:00
Leon Scroggins III
40c59fdef0 Call ImageDecoder directly in ResourcesImpl
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
2018-02-06 10:21:36 -05:00
Siyamed Sinir
dbeee4e4aa Update Typeface.createFromFile/Asset
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
2018-02-05 16:42:23 -08:00
TreeHugger Robot
7a4d3d9d02 Merge "Lazily create AnimatedImageDrawable's runnable" 2018-02-05 18:23:18 +00:00
Leon Scroggins III
120960e466 Lazily create AnimatedImageDrawable's runnable
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
2018-02-05 11:48:55 -05:00
TreeHugger Robot
fdd755df14 Merge "Use ImageDecoder in ImageView.getDrawableFromUri" 2018-02-02 19:51:41 +00:00
Stan Iliev
5aec67ca1b Use ImageDecoder for NinePatchDrawable and BitmapDrawable
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
2018-02-02 10:26:57 -05:00
John Reck
81f6fa1858 Merge "Support recording HW Bitmaps in Picture" 2018-02-02 00:25:54 +00:00
TreeHugger Robot
5d446ec5b9 Merge "Stop supporting broken font fallback" 2018-02-01 22:44:30 +00:00
Chris Craik
716f38177e Support recording HW Bitmaps in Picture
Bug: 34881007
Test: bit CtsGraphicsTestCases:*
Test: bit CtsUiRenderingTestCases:.testclasses.HardwareBitmapTests

Change-Id: Ic751c356682ea3db17a1b031ec46106a1a2ab918
2018-02-01 10:35:42 -08:00
Leon Scroggins III
5de17526b2 Deprecate createFromResourceStream with BitmapFactory.Options
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
2018-01-31 19:34:58 -05:00
Leon Scroggins III
beaf5d919f Fixes for animationEnd in AnimatedImageDrawable
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
2018-01-31 19:26:28 -05:00
Leon Scroggins III
046a99ebbb Use ImageDecoder in ImageView.getDrawableFromUri
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
2018-01-31 15:43:49 -05:00
Seigo Nonaka
fcd2af9ca8 Stop supporting broken font fallback
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
2018-01-31 15:14:47 +00:00
TreeHugger Robot
df2491a454 Merge "Make AnimatedImageDrawable.start reset" 2018-01-31 01:16:21 +00:00
TreeHugger Robot
8307014768 Merge "Use a separate thread to decode AnimatedImageDrawable" 2018-01-30 18:43:06 +00:00
Leon Scroggins III
1996dbb19c Make AnimatedImageDrawable.start reset
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
2018-01-29 21:08:56 -05:00
Leon Scroggins III
5b7f426ff0 Use a separate thread to decode AnimatedImageDrawable
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
2018-01-29 21:08:18 -05:00
Leon Scroggins
fdb54e3a0d Merge "Do not close InputStream from InputStreamSource" 2018-01-29 11:24:40 +00:00
Leon Scroggins III
0b49f5725c Do not close InputStream from InputStreamSource
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
2018-01-29 01:49:13 +00:00
Leon Scroggins
c4533b7085 Merge "Expose AnimatedImageDrawable" 2018-01-26 11:16:04 +00:00
Selim Cinek
d41477f494 Merge changes from topic "notification_launch"
* changes:
  Added the reply draft as an extra to the content intent
  Launching notification settings correctly inline
  Launching Notification animations inline
2018-01-25 16:05:15 +00:00
TreeHugger Robot
6834ec8e54 Merge "Fix start/pause behavior for AnimatedImageDrawable" 2018-01-25 05:41:21 +00:00
Andreas Gampe
9548a1b04e Merge "BitmapDrawable: Suppress errorprone warning" am: 25e50ccccb am: 822e828971
am: 9c6acbd248

Change-Id: I4846f6b91fadbbd650e925c70215dea4d4459278
2018-01-25 03:04:07 +00:00
Andreas Gampe
9c6acbd248 Merge "BitmapDrawable: Suppress errorprone warning" am: 25e50ccccb
am: 822e828971

Change-Id: I0481e40c91e5848fc7ab551a794269d9379cbcc9
2018-01-25 02:48:37 +00:00
Leon Scroggins III
127d31a684 Expose AnimatedImageDrawable
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
2018-01-24 19:20:18 -05:00