ShapeDrawable.inflateTag() handles the 'padding' tag with the standard
attributes android:left, etc. The attribute values for these standard
attributes should be dimension specifications, e.g. '4dp'.
ShapeDrawable.inflateTag() was wrongly parsing the attribute values as plain
integers.
NinePatch.mPaint may be null and most methods in this class handle
that case properly. However, the constructor which derives a new
NinePatch from an existing instance assumes that mPaint is non-null.
This results in an unexpected NullPointerException, for example when
attempting to call NinePatchDrawable.mutate() on an instance that was
created from a resource.
Small unrelated fix in same file: Remove unused private mRect member.
Merge commit '05ebcb5172679a6c196cbf23d7174c04dd9f6ae0'
* commit '05ebcb5172679a6c196cbf23d7174c04dd9f6ae0':
Update spinner's drawables. Clean up resources, pave the way for new animation.
DrawableContainerState.mDrawables is an array which may be only partially
filled, as can be seen in the constructor and the addChild() method.
DrawableContainer.mutate() wrongly assumed that the array does not contain
null references.
The mColors member can be null, as can be seen in
GradientDrawable.setSolidColor() or the plain constructor. In that case, an NPE
will be thrown on attempts to derive a new GradientDrawable from the instance
using the private constructor GradientDrawable(GradientDrawable).
The problem also occurs when inflating a GradientDrawable from XML without
defining the start, center and end colors and then calling mutate() on the
instance.
The function is used to rebuild any caches associated with the bitmap.
In the case of purgeable bitmaps, this call ensures that the pixels
are decoded for drawing, and therefore prefetching techniques
implemented by callers can be leveraged.
Merge commit '2b1aed1021fb472de83c4c0143f2c4452244a0af'
* commit '2b1aed1021fb472de83c4c0143f2c4452244a0af':
Fix Canvas.finalize() for the case where the constructor throws an exception
before the native canvas instance was created.
If the canvas constructors throw an exception (because the bitmap passed in is
immutable or already recycled), the constructor terminates early without
allocating the native canvas instance. For the most part, that's okay, since
the Canvas instance will never be returned to the application. However, the GC
will still call finalize() on the half-initialized Canvas.
The native methods for Canvas all assume that the canvas pointer passed down is
not null.
* Introduced ApplicationScale (may not be good name. CompatibilityScale? CanvasScale? Pls let me know if you have better idea)
* Changes to RootView / SurfaceView
- Makes the app believe it's running in the supported density/resolution.
- Makes the window manager believe it's running at the right density/resolution.
* Added methods to Rect/Event for scaling up/down.
Known issues:
* certain kind of images (such as nine patch for buttons) seesm to be loaded not by app, thus does not take the scale into account,
which, in turn, is causing layout issue.
* ZoomButton in MapView is rendered in wrong place
* Transparent region on Surface is not correct
* Specifying different densities in one process is not working.
BUG=1770627
Automated import of CL 147976
BitmapFactory::Options now let you specify if the resulting bitmap can be
"purgeable". If so, then its decoded pixels may be purged when not actively
being drawn, freeing up that RAM. When such a bitmap is drawn, it will
automatically be re-decoded on demand. This is done by having the bitmap
keep a reference/copy of the encoded data.
Where it is a reference or a copy is controlled by the "shareable" flag in
Options. If this is true, the implementation *may* just reference the encode
data (e.g. a file descriptor) rathern than making a complete copy of it.
Currently, purgeable is not supported for generic inputstreams, but is
enabled for byte-array, file-descriptor, and assets, though for impl
reasons only file-descripts are currently enabled for "shareable", but that
may change in the future.
There are three major classes of changes here:
- Avoid writing lines where their values are often empty, false, or some other typical thing.
- Use partial writes to the PrintWriter to avoid creating temporary strings.
- Use StringBuilder where we need to generate real String objects (and where possible cache the result).