2611 Commits

Author SHA1 Message Date
Hans Boehm
ad3cc3c63c 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
2016-05-10 15:33:53 -07:00
Neil Fuller
69c2907c63 Merge "Fix @code escapes"
am: b0d92f4717

* commit 'b0d92f4717af4e4736dc80b2a822dae8e5a52587':
  Fix @code escapes
2016-01-15 16:31:40 +00:00
Neil Fuller
9498e8a8d2 Fix @code escapes
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.

Bug: 25757239
(cherry-picked from commit 71fbb81b14958b80fe55738607740c6630e4e9da)

Change-Id: I19dafddc6501be6fee362c396ac5bbdc934ae39d
2016-01-15 16:14:57 +00:00
Doris Liu
65abc0e3d3 Merge "Get animation update timing for AVD" into mnc-dr1.5-dev am: a73abeaf4b
am: 7537aa7596

* commit '7537aa75968d127525ef8fba84f365514ae789a3':
  Get animation update timing for AVD
2016-01-12 01:44:19 +00:00
Doris Liu
fc8e3cb768 Get animation update timing for AVD
The goal for this change is to get the timing for animation update. Since
AnimatorSet does not support update listeners, we have to go with the a different
approach, which sets up a value animator that runs between the start and end of
the AnimatorSet. We can then get the animation update timing from the ValueAnimator.

Bug: 26329675
Change-Id: Ibe7fce81eb6da5e05c87a732c1d3bc904b4e5e6f
(cherry picked from commit I378a0964da8f7090f65f6b56275a302e30668835)
2016-01-12 00:22:53 +00:00
Riley Andrews
132bb1e4b1 Merge "Convert ashmem bitmap thresholds to constants." into mnc-dr-dev am: c8bb39d98d am: 2c740f1dcf
am: 6c1144dc0f

* commit '6c1144dc0f8b2452ca2a204ca471e2d23339d5a3':
  Convert ashmem bitmap thresholds to constants.
2015-11-04 20:37:18 +00:00
Riley Andrews
0394a0c399 Convert ashmem bitmap thresholds to constants.
Bug 25256717

Change-Id: I23e2795ef8798d83bf60dcbd6ff2e7093fcaa9b0
Signed-off-by: Riley Andrews <riandrews@google.com>
2015-11-03 23:52:17 -08:00
Ian Pedowitz
87455c7397 Merge "Limit persistent ashmem backed fds to a minimum of 128kB." into mnc-dr-dev am: 966d6040c6 am: 95fc53b029
am: d6f3e38738

* commit 'd6f3e38738c88821b28b2571d034fc1b189a35de':
  Limit persistent ashmem backed fds to a minimum of 128kB.
2015-11-03 22:21:48 +00:00
Riley Andrews
8cee7c1711 Limit persistent ashmem backed fds to a minimum of 128kB.
Bug 25256717

Change-Id: Ieb356006df0a6545b89de44d3d8fd4b46312b3b8
Signed-off-by: Riley Andrews <riandrews@google.com>
2015-11-03 17:46:15 +00:00
Hans Boehm
1d8152726b am 58c27e3e: am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."
* commit '58c27e3e53ef64072412515792433e570a176f15':
  Reduce risk of memory corruption due to finalization.
2015-09-09 23:44:37 +00:00
Hans Boehm
58c27e3e53 am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."
* commit 'c0ce6c422cfe089e7a8e209ac924e37bed3ca770':
  Reduce risk of memory corruption due to finalization.
2015-09-09 22:41:42 +00:00
Hans Boehm
ffa84e008c Reduce risk of memory corruption due to finalization.
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
2015-09-08 18:27:36 -07:00
Snild Dolkow
a72f59a858 Update mFillPaint color on GradientDrawable inflation
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
2015-09-04 10:08:46 +02:00
Jorim Jaggi
b7303a36ba Disable RT animations for header ripple
Bug: 22208997
Change-Id: I10a890d4f8f70c7c786940ffdb86cf4d21bdaf05
2015-08-21 15:21:12 -07:00
Alan Viverette
f0d69b9e33 Translate ripple mask to account for drawable bounds
Bug: 23354529
Change-Id: Iaa4fde6b37645492cf902f141f975bdef8e7e14e
2015-08-20 16:27:21 -04:00
Alan Viverette
bac9769146 Ensure ripple mask is drawn at correct position
Bug: 22911708
Change-Id: Icdbe1f8a66d5e35eb25aa973c94f5870896cc1f8
2015-08-11 14:25:45 -04:00
John Reck
01a0af31d7 Yell loudly about undefined behind in Bitmap, but work anyway
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
2015-08-03 20:57:22 +00:00
ztenghui
35289f12d6 Scaling (Animated)VectorDrawable inside ImageView
Before, the VectorDrawable is behaving like BitmapDrawable inside a ImageView,
and it can be blurry due to scaling.
Now apply the scaling information to the cached bitmap, then the size of bitmap
will match the ImageView's screen size. Therefore, no blurry any more.

b/18185626

Change-Id: I979cef3b5178a9bd37ee6cc776df3361ca47c803
2015-07-17 11:16:41 -07:00
Julia Reynolds
c7fd3462a2 Retrieve resources for apps, even if not installed for current user.
Bug: 21448052
Change-Id: Id5db428a6faca4a905684088c47e070752ac2899
2015-07-14 09:24:22 -04:00
John Reck
b7ba1220a3 Teach ImageView to recycle internal drawables
Bug: 22289362

It's pretty common for ImageView#setBitmap to be called
repeatedly. Avoid re-creating the BitmapDrawable in this scenario
as that has high object churn of semi-expensive objects like
Paint.

Change-Id: Ib77719cd0366d02c1a42f774850bf3b9caa9c288
2015-07-09 17:40:41 -07:00
ztenghui
93666e8691 Merge "Resize the VectorDrawable according to the virtual Dpi" into mnc-dev 2015-06-24 23:32:18 +00:00
ztenghui
95080637db Resize the VectorDrawable according to the virtual Dpi
b/21928507

Change-Id: I9e596192a0fdf13fc91481f990a345c3b267f225
2015-06-24 15:09:09 -07:00
Alan Viverette
06ff2af68a Update local state when creating LayerDrawable from constant state
Also clears DrawableContainer's futures list when it's no longer needed,
correctly sets deep copy of state set in StateListDrawable, makes some
private methods into package-protected to avoid thunk, and propagates
state to StateListDrawable's super class so that getState() has correct
information.

Bug: 21840003
Change-Id: I0d4232807f280d663c03b4a80e4aab8626806440
2015-06-24 14:42:44 -07:00
Dan Sandler
346872d538 Merge "Allow an icon to carry a tint with it, wherever it goes." into mnc-dev 2015-06-24 02:10:25 +00:00
Daniel Sandler
25a5f30128 Merge "Use ashmem backed bitmaps for passing around notifications" into mnc-dev 2015-06-24 02:09:58 +00:00
Alan Viverette
81e7dbddf1 Remove isDither(), deprecate setDither()
Bug: 22013358
Change-Id: I37b11a94edc431a88522c6c056b76b045daa61d6
2015-06-23 14:30:40 -07:00
Jorim Jaggi
a0d58ae574 Use ashmem backed bitmaps for passing around notifications
Avoids many copies during IPC and duplicate Java heap consumption in
system_server, SystemUI, etc.

Bug: 18386420
Change-Id: Id5ac9406062d472f7848009d65f12131f5f4dac9
2015-06-23 19:55:41 +00:00
Dan Sandler
24f11b1871 Allow an icon to carry a tint with it, wherever it goes.
Bug: 21031774
Change-Id: I2d06c7288e0c0a06bf6ff147dfbfdea5a46fd288
2015-06-23 02:21:55 -04:00
Chris Craik
484b114846 Merge "Clean up drawable filter/dither docs" into mnc-dev 2015-06-23 00:07:18 +00:00
Derek Sollenberger
b2aea9dcbd Merge "Enable Picture w/ HW Accelerated Canvas." into mnc-dev 2015-06-22 15:38:11 +00:00
Derek Sollenberger
e109940d81 Enable Picture w/ HW Accelerated Canvas.
Bug: 20688645
Change-Id: I664f37d6dbb3e61b17206c82ebcc63f988cefc65
2015-06-22 13:18:29 +00:00
Chris Craik
c79df8e831 Clean up drawable filter/dither docs
bug:21342040

Change-Id: I6592bfa504516852967d82a7e7929b1aef6bff02
2015-06-19 18:01:44 -07:00
Alan Viverette
690a16c350 Invalidate the cached ripple drawable mask if mask layer changes
Bug: 21955350
Change-Id: I2e610a5a0af39668b7e9447cfd7d48d35e11d299
2015-06-19 13:42:39 -07:00
Doris Liu
a6c51149c5 Fix a typo in Drawable's javadoc
Change-Id: Ic168b250defb30512cb35a836118fe2bdf1b2e78
2015-06-18 15:28:27 -07:00
Dan Sandler
50ec9b1bd9 Merge "Patch up certain kinds of broken notifications." into mnc-dev 2015-06-18 20:26:49 +00:00
Dan Sandler
4e78706f43 Patch up certain kinds of broken notifications.
Notifications in which the icon resource ID is changed after
Builder.build() is called (even, and particularly, as the
last step in the current implementation of
setLatestEventInfo()) were not having their icons properly
parceled. In these cases we now attempt to catch this at
parcel time and construct the necessary Icon object.

But wait! Parceling does not require a Context. So we don't
actually know which package to load the resource from.
Therefore we now allow an Icon to be constructed with an
empty ("") package name, which allows us to complete this
parceling task despite the fact that a Notification does not
know its own package name. (In case you attempt to load a
drawable for such an Icon, loadDrawable will spot the ""
package and instead substitute the Context from its
parameters to try to load the resource.)

As it happens, even though the Notification does not know
its own package name, BaseStatusBar does, because it was
provided at NM.notify() time and is therefore included in
the StatusBarNotification structure. So we can actually
patch up the Icon (if it is TYPE_RESOURCE) and be sure to
get the icon loaded out of the correct package.

While we've got the hood open, this change fixes a couple of
related problems:

  • Foreground service notifications synthetically
    constructed for naughty icon==0 notifications (which we
    are still allowing...FOR NOW) were losing the
    FLAG_FOREGROUND_SERVICE flag (because we're
    re-build()-ing them from scratch rather than rewriting
    the provided Notification object). Now we set the flag
    and hang onto the new notification for next time
    setForeground() is called.

  • We now allow media notifications to avoid getting bumped
    to the top of the notification list if they're
    PRIORITY_MIN. You might want to do that, I guess?

Bug: 21333763
Change-Id: Ia5d1f1acb594c7677bcc75ee3d624da4ffca671f
2015-06-18 15:12:44 -04:00
Alan Viverette
67b5a68088 Merge "Resolve start/end insets in LayerDrawable.getIntrinsicWidth()" into mnc-dev 2015-06-17 21:31:06 +00:00
Alan Viverette
536652fe91 Resolve start/end insets in LayerDrawable.getIntrinsicWidth()
Bug: 21849185
Change-Id: If9b392d863e808d83a5d90bcc32df6cb9194cbdf
2015-06-17 14:09:53 -07:00
Alan Viverette
373954a1fd Refactor Drawable.getDither() to isDither()
Bug: 21342040
Change-Id: I801970c2a25289d670636ad5387ddf244fb48225
2015-06-17 13:59:31 -07:00
Alan Viverette
63a39ffe48 Ensure first load for bitmap and nine-patch gets correct density
Remove unnecessary lines setting target density on bitmap and nine patch,
since we'll do this later in inflate().

Bug: 21774853
Change-Id: I5ea316bee81f82192ce20f2f1bee0e62c6ec8ccb
2015-06-16 15:04:45 -07:00
Chet Haase
c03fa1ee54 Merge "Add isFilterBitmap() overrides where appropriate" into mnc-dev 2015-06-15 15:45:57 +00:00
Chet Haase
ea1363910b Add isFilterBitmap() overrides where appropriate
Issue #21825791 add isFilterBitmap() override to appropriate Drawable subclasses

Change-Id: I5cbd72c034be79b0aa53815c7a5a8ea499e6e02d
2015-06-15 08:43:27 -07:00
Chet Haase
96a443b58d Clarify Drawable.getOpacity() docs
Docs for translucent-vs-transparent-vs-opaque were confusing, especially since
the definition for those constants in PixelFormat are not the same as how they're
actually used in Drawable. This fix simply adds clarifying text to the method
comment for getOpacity().

Issue #21158891  Better document Drawable#getOpacity

Change-Id: I94725592f85e5d7874e3a3ac1c5bab969163fbf0
2015-06-12 17:21:31 +01:00
Keisuke Kuroyanagi
4039f6570c Merge "Improve boundary check for for Paint#DrawTextRun." into mnc-dev 2015-06-11 22:44:55 +00:00
Chris Craik
1b83edc616 Merge "Workaround shader crash" into mnc-dev 2015-06-11 20:29:05 +00:00
Keisuke Kuroyanagi
f2122ef549 Improve boundary check for for Paint#DrawTextRun.
Change-Id: I01027ebb9133240cc1c750824a41dd9fca484c1f
2015-06-11 20:46:53 +09:00
Chris Craik
b786bbdd11 Workaround shader crash
bug:21706035

Change-Id: Ia1cd4824c742b2d6fc0feb2861ccfde0b6ac2189
2015-06-10 16:58:50 -07:00
Alan Viverette
99ca2a8470 Account for hotspot bounds in RippleDrawable projection check
Bug: 21502154
Change-Id: Iedf4bd07f10ec13070a68870304ab651c1f15c68
2015-06-08 16:10:27 -07:00
Alan Viverette
371b582c49 Merge "Implement getColorFilter() on VectorDrawable" into mnc-dev 2015-06-06 00:26:04 +00:00
Alan Viverette
a741711900 Implement getColorFilter() on VectorDrawable
Bug: 21580708
Change-Id: Id64bebeb5c39906ed34775e8ccc39f666966bad9
2015-06-05 17:20:11 -07:00