2845 Commits

Author SHA1 Message Date
Teng-Hui Zhu
ab1cbc2c53 Mutate the drawable if a valid state change happen
In another word, create another cached bitmap, when the current VectorDrawable
will look differently when state changed.

Bug: 29870392
Bug: 29854240

Change-Id: I7a5ef91091e547a930368286defc7ab96aeb9471
(cherry picked from commit 4f1acfb5f507798daaff2ff0da47d2b15607ded4)
2016-06-30 23:11:48 +00:00
Alan Viverette
f66bdf9b57 Merge "Disable constant state sharing for VectorDrawable" into nyc-dev 2016-06-29 16:54:29 +00:00
Alan Viverette
1882ce941b Disable constant state sharing for VectorDrawable
Bug: 29854240
Change-Id: Icc58d04ad6f471d05b085a9089893e4f7205eb7d
2016-06-29 11:32:13 -04:00
Alan Viverette
6d823891bb Only block invalidation in DrawableContainer initialization
Blocking (un)scheduling breaks AnimationDrawable's internal consistency.

Bug: 29309316
Change-Id: I59c79a4a9a92b599cd94bd941ae78ac25b874add
2016-06-17 13:08:42 -04:00
Doris Liu
028029730b Copy native tree's property when mutate vector drawable
When mutating vector drawables, we need to not only copy over
the VD tree structure, but also the properties of the VD tree,
such as alpha.

Bug: 28974071
Change-Id: I265e7e3cb92455b876cae248bcb9811230cb34f9
2016-05-27 10:54:55 -07:00
Alan Viverette
2b561f1c35 Prevent callbacks during DrawableContainer child initialization
Bug: 28900939
Change-Id: I9c6c8af1665c2dc0bfa8bc8fc773c81e14f6aab1
2016-05-26 16:49:29 -04:00
Alan Viverette
09deff1bd9 Prevent LayerDrawable bounds updates from being re-entrant
Collect child invalidations during layer bounds change, then dispatch a
single invalidation if any children requested invalidation. This prevents
re-entrance from, for example, a LayerDrawable.updateLayerBounds() call
invoking setBounds() on a child, which necessarily calls invalidateSelf()
and immediately propagates up to ImageView.invalidateDrawable(), which
then calls configureBounds() and puts us back in updateLayerBounds().

Bug: 28636072
Change-Id: I36c9eefc18904d493292d51b37e4b05cfddcf794
2016-05-24 15:14:38 -04:00
Yohei Yukawa
23cbe85610 Move LocaleList to avoid layering violation.
Since LocaleList needs to depend on android.os.Parcelable, we cannot let
that class belong to "android.util" package, which causes layering
violation.

Bug: 28819696
Change-Id: Ia8de2ee9df3dd0a42b1fe84574439519b680fe18
2016-05-17 16:42:58 -07:00
Hans Boehm
0d65743fea Clear more native pointers in finalizers
This hopefully handles the remaining finalizers in frameworks/base
that didn't guard against calls from other finalizers after being
finalized.

The goal here is to reduce the possible corruption causes we have
to think about by a few.

If any of theses are either very frequently used, or use large
Java (as opposed to native) objects, we should probably convert them
to NativeAllocationRegistry instead. But that's more work.

Bug: 18178237
Change-Id: I79bc0e8fa20af8f340418a6226022e0294d77f02
(cherry picked from commit ad3cc3c63c6d0f637d2ece3935b5b01b19473299)
2016-05-16 13:45:21 -07:00
Teng-Hui Zhu
a8d671a144 Update and add attributes to the JavaDoc for VectorDrawable
fix:28678266

Change-Id: Ife23937feb6ccbd043bd435ffcb20a79a8861edf
2016-05-11 14:31:45 -07:00
Richard Uhler
8e96faae78 Merge "Hold a ClassLoader reference in NativeAllocationRegistry." into nyc-dev 2016-05-09 15:50:30 +00:00
Alan Viverette
a24c9b4791 Always mutate child when added to drawable container
Bug: 28456908
Change-Id: I3e7bea85e056882a331aecf7e225134161e685e6
2016-05-06 16:01:56 -04:00
Richard Uhler
0ebdbb4a84 Hold a ClassLoader reference in NativeAllocationRegistry.
So that the native library isn't unloaded before we have a chance to
call the freeFunction.

Bug: 28406866
Change-Id: I889f1ccd91bba70e31fb8d09c0ec6d471fc35841
2016-05-03 13:06:22 -07:00
Doris Liu
6543533f29 Merge "Count native allocation for VD against Java heap" into nyc-dev 2016-05-03 16:41:20 +00:00
Doris Liu
f8d131cc8d Count native allocation for VD against Java heap
There are two parts to VD's native allocation:
1) VD's internal data structure (i.e. groups, paths, etc that make
   up of the VD tree). This structure can change, when a VD is used
   to load a different drawable resource.
2) Two bitmap caches, not both of which will necessarily be allocated
   The size of the bitmap cache depends on canvas matrix and drawable
   bounds, and therefore can often change.

We need to count the native allocation from the above against Java heap.

Bug: 26269056
Change-Id: If833aedcf7f3efe00ea73a41ddccb1b48066ffd8
2016-05-02 15:34:40 -07:00
John Reck
a1c06675dd Merge "Video source test & bugfix" into nyc-dev 2016-04-29 14:49:13 +00:00
John Reck
f3a51d652f Video source test & bugfix
Bug: 28428970

Test for video sources and fix a bug where
we should throw an IAE for surfaces that are invalid
at request time.

Change-Id: I891a2b1568f583300433c7aca6de36d2e2621c63
2016-04-28 10:11:36 -07:00
Philip P. Moltmann
3d0d141710 Add a security warning to PdfRenderer doc.
Change-Id: Ia714d312665179366adae8e1923e4b9c339ebb59
2016-04-27 15:03:22 -07:00
John Reck
7f209d37f1 Merge "API tweaks to PixelCopy and make it public" into nyc-dev 2016-04-27 14:36:53 +00:00
John Reck
e94cbc76d5 API tweaks to PixelCopy and make it public
Bug: 27708453
Change-Id: I81667ce42f9ca1c1a13e1e61299927900845fc84
2016-04-26 15:41:43 -07:00
Sergei Vasilinetc
c015719954 Merge "DisplayListCanvas: throw exception at attempt to draw bitmap with size > 100MB" into nyc-dev 2016-04-26 21:39:43 +00:00
Alan Viverette
6f9626a1c2 Check for null drawable during LayerDrawable.jumpToCurrentState()
Child drawables specified as theme attributes may not have been
initialized yet.

Bug: 28371482
Change-Id: I8452a7c5b8f74368c58ba3373336bf7d650af7a3
2016-04-25 11:28:17 -04:00
sergeyv
3d8298e1a8 DisplayListCanvas: throw exception at attempt to draw bitmap with size > 100MB
bug:26943116
Change-Id: If72c9f21ca2d8eb660ea2db4a42c8199f8d02472
2016-04-21 14:48:04 -07:00
Doris Liu
967d93440c Merge "Pause infinite AVD when the drawable is not visible" into nyc-dev 2016-04-19 22:14:13 +00:00
Doris Liu
d049837397 Pause infinite AVD when the drawable is not visible
And resume when it becomes visible again

Bug: 27441375
Change-Id: Ic5140a30f5726df252ca63be9e14c495cbd76466
2016-04-18 18:48:43 -07:00
Winson Chung
de16f96c7e Merge "Take app screenshots in 565." into nyc-dev 2016-04-15 00:56:20 +00:00
Winson
a5fdde9d15 Take app screenshots in 565.
- Or to be specific, SurfaceFlinger can’t easily take 565 screenshots,
  so convert them when creating the ashmem bitmap.

Bug: 28151300
Change-Id: Ic7586659a41cc19c322136f77a1c52ef68c22707
2016-04-14 16:03:44 -07:00
Alan Viverette
112f0aa28e Basic documentation for custom drawables
Bug: 23621364
Change-Id: Ia292433ebd40d4c85ff6974def3d1f4b26926b52
2016-04-14 11:22:44 -04:00
Alan Viverette
0c34026088 Merge "Update docs for Drawable.setLayoutDirection() return value" into nyc-dev 2016-04-13 23:07:05 +00:00
Alan Viverette
2089575686 Merge "Clean up Drawable annotations" into nyc-dev 2016-04-13 15:22:04 +00:00
Alan Viverette
b8cbb806fc Clean up Drawable annotations
No functional changes.

Bug: 23621364
Change-Id: Ia5ac34eb8464ee40afd7052f34b42bb6153260bf
2016-04-13 10:14:06 -04:00
Siyamed Sinir
2519996e4e Merge "Cache Typeface.createFromAsset objects." into nyc-dev 2016-04-12 23:38:23 +00:00
Doris Liu
1ee2dd2f5f Merge "Check whether VD tree is still valid before calling native setter" into nyc-dev 2016-04-12 19:50:39 +00:00
Doris Liu
cdedc9a80d Check whether VD tree is still valid before calling native setter
VD tree is ref-counted in both Java and native. VD's child nodes are
entirely owned by the native tree, as VD nodes in native should outlive
its Java counterparts, with one exception: when there's an infinite UI
animator running on VD, the animator may have weak reference to a few
child nodes. In the case of hidden animator running infinitely, the child
nodes would keep getting the animation pulse while the rest of the tree
would have been destroyed. To prevent the setters triggered by animation
from calling into native, we need to check whether the tree is still
valid before going down into JNI.

Bug: 28104172
Change-Id: Ie9d4bf3898c0c23e620a4747624d24b8ab779743
2016-04-12 11:13:10 -07:00
Alan Viverette
78e561ce54 Update docs for Drawable.setLayoutDirection() return value
Bug: 27107547
Change-Id: I98dd706e6dfb07e7b5ec9c257cf5bea6aea2bbfc
2016-04-12 14:03:22 -04:00
Siyamed Sinir
5849500a19 Cache Typeface.createFromAsset objects.
Caches Typeface objects returned from Typeface.createFromAsset function,
Objects are cached in an LruCache with a max size of 16.

Bug: 27251075
Change-Id: I6baae4211a0d0d26422945bf1557b364cfe84b2b
2016-04-11 17:23:46 -07:00
John Reck
10dd0585c1 Framework-side of SurfaceView#getBitmap
Bug: 27708453

Change-Id: Ie6fd7eca522d3e6549d8af587c975fd7e6053649
2016-04-11 16:00:22 -07:00
Raph Levien
296bf8c55a Avoid copying of font table data, provide raw font bytes
Minikin is changing its approach to table access to use HarfBuzz to
access the tables, based on raw font data, rather than calling the
MinikinFont::GetTable() virtual method. This patch provides raw access
to the font data to make this work.

There's a bit of plumbing to make sure fonts get a pointer to the raw
data as well.

Bug: 27860101
Change-Id: I638e18cf363644bf22fbc9fb9b3358a9e731087f
2016-04-08 08:29:32 -07:00
Chris Craik
a7f775db93 Merge "Fix how outlines are sent to rendernode" into nyc-dev 2016-04-04 22:08:32 +00:00
Doris Liu
1d8e194661 Make AVD thread safe
This CL introduces staging properties to VectorDrawable, which holds
properties coming from UI thread. When staging properties are changed,
they are marked dirty, and the staging properties then get pushed to
RenderThread at sync point. In cases where no staging property has
been changed, at sync point we sync the render thread properties back
to staging properties to reflect the latest render thread animation
value change.

Also, update Vector Drawable bitmap only when it's dirty

Bug: 27343970
Bug: 27385912
Bug: 27263667
Bug: 27927674
Bug: 27774383

Change-Id: Ia864f5400a53a08dbfb284fae581fb1aac4fff87
2016-04-04 14:40:17 -07:00
Chris Craik
136d1af1cc Fix how outlines are sent to rendernode
bug:27918183

Fixes an issue where all convex outlines were pushed as empty rects to
RenderNode.

Also adds outline/reveal clip property logging, so such issues are
easier to debug in the future.

Change-Id: Ic4a996ecd09a8ef84cdf8b963bdb4853c7f6d180
2016-04-04 13:40:39 -07:00
Ben Wagner
008c6c5490 Fix shift precedence in FontListParser.
BUG=27707457

Change-Id: I7ea7a5fa67ec540401454136427b37562a4eef30
2016-03-29 23:13:49 +00:00
Siyamed Sinir
0925f40372 Update get/setFontFeatureSettings JavaDoc
Add CSS font-feature-settings URL to get/setFontFeatureSettings method
JavaDoc in both TextView and Paint.

Bug: 27857640
Change-Id: I8c20068801032407d493e4f4a15b89dcf35949d2
2016-03-28 16:14:46 -07:00
Tenghui Zhu
f35e7dc773 Merge "Update the Drawable.inflate() documentation" into nyc-dev 2016-03-28 16:30:57 +00:00
Teng-Hui Zhu
4eab3850ec Update the Drawable.inflate() documentation
Change-Id: I1f8a4e40fae43ad75550d3dffbccd831b063be03
2016-03-25 09:44:31 -07:00
Philip P. Moltmann
527bcac4d7 Merge "Fix javadoc for Icon.loadDrawableAsync(Context, OnDrawableLoadedListener, Handler)." into nyc-dev 2016-03-25 16:17:03 +00:00
Derek Sollenberger
4ee3b6216d Merge "Enforce API preconditions in Java instead of deferring to Skia." into nyc-dev 2016-03-24 15:05:14 +00:00
Sergei Vasilinetc
ab852f2972 Merge "Add offset() to Path's fast-case mode" into nyc-dev 2016-03-24 05:02:02 +00:00
Sergei Vasilinetc
5d83f69fcd Merge "Fix NinePatch insets scaling" into nyc-dev 2016-03-24 01:22:08 +00:00
sergeyv
ecbcdd384c Add offset() to Path's fast-case mode
bug:22510833
Change-Id: I417ed13ff450aa7f6c72370b4c5de8e8a53a0235
2016-03-23 16:45:55 -07:00