Only store stateful CSLs; otherwise, just use the default (e.g. the
only available) color.
Bug: 25074102
Change-Id: I050c89841d4c6bf22473a66c713a845b0358dc94
We never use this field as a rectangle, we only depend on its left-top
corner. Using a frame is only confusing about the purpose of this field.
Change-Id: I5d6e6321db4fa3203bb7e0f1975ae6ddd1ec09bb
Removes unnecessary invalidateSelf() from VD.onStateChange(). This is
handled by the view hosting the drawable.
Bug: 22984152
Change-Id: Idf11a0ffef392cb1d8452aa3f5f836b35027a756
Many classes in graphics/java and elsewhere deallocate native memory
in a finalizer on the assumption that instance methods can no longer
be called once the finalizer has been called. This is incorrect if
the object can be used, possibly indirectly, from another finalizer,
possibly one in the application.
This is the initial installment of a patch to cause such post-finalization
uses to at least see a null pointer rather than causing memory corruption
by accessing deallocated native memory. This should make it possible to
identify and fix such finalization ordering issues.
There are more graphics classes that need this treatment, and probably
many more in other subsystems.
This solution is < 100% effective if finalizers can be invoked
concurrently. We currently promise that they aren't.
(In my opinion, the real cause here is a language spec bug. But that ship
has sailed.)
Bug: 18178237
Change-Id: I844cf1e0fbb190407389c4f8e8f072752cca6198
When a GradientDrawable is loaded from scratch, initializeWithState()
is called with mColors == null. This sets mFillPaint's color to
0x00000000 -- transparent. mColors is then properly set in inflate(),
but mFillPaint is not updated there. It will be updated eventually
through a mutate() or ensureValidRect() call, but that's sometimes too
late.
In our case, a wrapping StateListDrawable called getOpacity(), and
since it caches the result, it never got updated.
This doesn't cause any problems on preloaded GradientDrawables, since
the new GradientDrawable created when fetching a preload will call
initializeWithState() in its constructor, fixing the GradientState.
Change-Id: Ic8caa7c6a7c1d4dae5ff31ae943831bd2e014f79
When AnimationDrawable becomes VISIBLE again, the current behavior is to
start the Drawable from the first frame if it's not running. For one shot
AnimationDrawable, it should start once and stay on the last frame.
Bug: 23725157
Change-Id: I5f3095aa00b07fefe7f992851d4190f268c266b2
This allows us to run fine-grained level animations.
Backwards compatibility:
Another CL will add DrawableCompat.setLevel(float) to forward calls to
the existing integer-based method. For callbacks, developers can override
onLevelChanged(int) and use DrawableCompat.getLevelFloat() to obtain the
floating-point level. Overriding onLevelChanged(float) will only work on
current API.
Bug: 23566299
Change-Id: I431fe6f3679c8f23f9cf3c2bb1f92a4059ee68e3
This keeps the existing single-locale APIs working (and adds
parameter annotations to them), while adding an API for setting and
getting the whole locale list. At the moment, the implementation
ignores the actual data in the locale list except for its primary
locale.
Also add a method to LocaleList to return the system's default locale
list. (Currently a one-member list just containing the system
default locale.)
Change-Id: Icea9d164ddae51f50dd71e18b5d91c96f233b8b8
Cleans up collection typing and encapsulation. VObject encapsulates
inflation, theme application, and drawing. VFullPath is responsible
for rendering nodes to a Path.
Change-Id: Ic760576d8000c4844ec3cab1b4bbcecb4fa1b760
Luminance is the measure used by W3C to compute contrast ratios, so
we should be preferring that for "brightness" comparisons.
Bug: 22815971
Change-Id: I84a971d3cc6b12acebe8e455c0c0440c1c8bce06
Bug: 22214367
Previous releases would let the getters on a recycle()'d bitmap to still
work despite being firmly in undefined behavior per the documentation
on Bitmap#recycle().
As there are apps relying on this, yell very loudly about this behavior
in the log and give them a bit of time to fix it
Change-Id: I857be7e74cb217877973d9c6f03eb761d12fd056