1200 Commits

Author SHA1 Message Date
Wei-Ta Chen
1f507be1c1 am a2048056: am 2498b4b8: Merge "Fix 3510563: memory leak in BitmapRegionDecoder." into honeycomb-mr1
* commit 'a204805627eddeac0a1777c69ce62d31d339d4cd':
  Fix 3510563: memory leak in BitmapRegionDecoder.
2011-03-09 16:27:25 -08:00
Wei-Ta Chen
2498b4b8c6 Merge "Fix 3510563: memory leak in BitmapRegionDecoder." into honeycomb-mr1 2011-03-09 16:21:53 -08:00
Eric Laurent
18632db49a am 2dc78477: am cc34967f: Merge "Fix issue 3439872: video chat and bluetooth SCO" into honeycomb-mr1
* commit '2dc78477364bd4accb9a603baaafca9a5523dcec':
  Fix issue 3439872: video chat and bluetooth SCO
2011-03-09 11:00:22 -08:00
Carl Shapiro
9b8c5f6143 Merge "Remove unused JNI global references." 2011-03-08 19:49:47 -08:00
Eric Laurent
421ddc014b Fix issue 3439872: video chat and bluetooth SCO
This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
2011-03-08 16:33:15 -08:00
Chih-Chung Chang
b1a04d5456 Fix 3510563: memory leak in BitmapRegionDecoder.
Change-Id: If639d5974204f18fdfd119b9fc7a762977c66f26
2011-03-08 18:47:23 +08:00
Romain Guy
f7098ce95d am d00353fe: am bc8a8e8c: Merge "Add support for partial invalidates in WebView Bug #3461349" into honeycomb-mr1
* commit 'd00353fe3191571a6773ef2d11921cfcff260bc4':
  Add support for partial invalidates in WebView Bug #3461349
2011-03-07 22:45:52 -08:00
Romain Guy
5f4b02064d am f018560c: am 25b81110: Merge "Fix EGL JNI bugs Bug #3461349" into honeycomb-mr1
* commit 'f018560cb57e47c3e4bc542e4c596c4d3be3d4c4':
  Fix EGL JNI bugs Bug #3461349
2011-03-07 18:16:05 -08:00
Romain Guy
cabfcc1364 Add support for partial invalidates in WebView
Bug #3461349

This change also fixes two bugs that prevented partial invalidates
from working with other views. Both bugs were in our EGL implementation:
they were preventing the caller from comparing the current context/surface
with another context/surface. This was causing HardwareRenderer to always
redraw the entire screen.

Change-Id: I33e096b304d4a0b7e6c8f92930f71d2ece9bebf5
2011-03-07 18:09:03 -08:00
Romain Guy
9b7146db6d Fix EGL JNI bugs
Bug #3461349

Before this change, eglGetCurrent*() could not be used to compare
contexts, displays and surfaces at the Dalvik level.

Change-Id: I442037dae37bc357b64810ab10c779b5754e9153
2011-03-07 18:05:04 -08:00
Carl Shapiro
17cc33a357 Remove unused JNI global references.
Change-Id: Ie4886ab66538e293832c3bc3d6023e34304a2d21
2011-03-05 20:53:16 -08:00
Mike Cleron
7e0907ce3e am 646528c6: am 54bb9869: Merge "Don\'t fail unlinking death recipients on dead binders" into honeycomb-mr1
* commit '646528c6cff69433d58d01728ada12fd2a50cf84':
  Don't fail unlinking death recipients on dead binders
2011-03-04 18:02:41 -08:00
Christopher Tate
79dd31f73d Don't fail unlinking death recipients on dead binders
It's legal to call unlinkToDeath() *after* receiving binderDied(),
as long as the recipient being unlinked was in fact linked
previously.  Don't throw an exception in this case.  (The
exception was going unhandled in the system process, bringing
down the runtime.  That's bad.)

The change here is a bit subtle.  In the new implementation, the
lifetime of a JavaDeathRecipient -- the fundamental bridge between
IBinder objects and the Dalvik/JNI world -- is tied to the
lifetime of the Dalvik-side BinderProxy object it's associated
with.  That means it's inappropriate for the JavaDeathRecipient
to disappear [for purposes of being referenced from the Dalvik
side] just because the IBinder has sent out its obituaries, and
instead the JavaDeathRecipient objects are kept around until
the Dalvik-side client code actually drops its reference to the
BinderProxy.

This boils down to a one-line change:  we no longer unpin the
JavaDeathRecipients and free them immediately in response to
binderDied().

The rest of the CL is #ifdefed-out debugging that is invaluable
when bugs crop up.

Bug 3513703

Change-Id: I743fa49669c9252f71dcabfd8dcf42ed729b70a5
2011-03-04 17:45:00 -08:00
Leon Scroggins
13492c848f Add ifdef to prevent header being added multiple times.
Change-Id: I92bb0667bea98e43fca20dceb4fff20e446c03cf
2011-03-04 13:54:35 -05:00
Carl Shapiro
332abc3055 Merge "Fix a compare of JNI references to use IsSameObject." 2011-03-03 17:17:43 -08:00
Carl Shapiro
375aa0b09b Fix a compare of JNI references to use IsSameObject.
Change-Id: I9932761271034ff5031730874daf7c147b6b008a
2011-03-03 17:00:38 -08:00
Carl Shapiro
d54952b451 Merge "Establish a global reference before saving a class into a global." 2011-03-03 14:44:50 -08:00
Carl Shapiro
c1318babb4 Establish a global reference before saving a class into a global.
A local reference is obtained to the string class for the purpose of
using it later in another routine to create string object arrays.
However, the local reference is invalid by the time it is next used.
Making the string class reference a global reference eliminates the
problem.

Change-Id: I8a04642e0ed3060f2fff2cb63996559f004aacff
2011-03-03 14:22:28 -08:00
Carl Shapiro
6c3fd82107 Merge "Eliminate an assignment of a local reference to a global variable." 2011-03-03 14:13:09 -08:00
Carl Shapiro
b16f769277 Eliminate an assignment of a local reference to a global variable.
Change-Id: I8850685698d228658387afe6145e42ade0458e74
2011-03-03 14:04:59 -08:00
Fabrice Di Meglio
1eb1293732 Merge "Add TextLayout Cache" 2011-03-03 12:21:15 -08:00
Leon Scroggins
b80cb0c5d4 Merge "Move NinePatchPeeker into its own file." 2011-03-03 09:13:22 -08:00
Leon Scroggins
a06d86ab81 Move NinePatchPeeker into its own file.
This way it can be used by other clients that want to draw
ninepatches.  Ultimately the goal is to allow ninepatch
drawing from native code for WebView.  Bug:3009375

Change-Id: Id13cef17ed7655a07e9f055586b686cf1e4af392
2011-03-03 11:40:39 -05:00
Jeff Brown
56194ebec6 Wake screen from external HID peripherals.
Added some plumbing to enable the policy to intercept motion
events when the screen is off to handle wakeup if needed.

Added a basic concept of an external device to limit the scope
of the wakeup policy to external devices only.  The wakeup policy
for internal devices should be based on explicit rules such as
policy flags in key layout files.

Moved isTouchEvent to native.

Ensure the dispatcher sends the right event type to userActivity
for non-touch pointer events like HOVER_MOVE and SCROLL.

Bug: 3193114
Change-Id: I15dbd48a16810dfaf226ff7ad117d46908ca4f86
2011-03-02 19:57:07 -08:00
Fabrice Di Meglio
d313c665e6 Add TextLayout Cache
- use GenerationCache for caching
- move GenerationCache.h from libs/hwui/utils to include/utils
- add #define for cache activation / deactivation

Change-Id: Ifaf519f0b5e33b087a453e4aa6430162d8438f20
2011-03-02 13:29:20 -08:00
Christopher Tate
bd8b6f25bb Fix binder proxy death notice tracking
There was an issue with stale recipient tracking when BinderProxy weak
references had been purged and a new proxy object allocated for a
still-live underlying IBinder.  The death recipient bookkeeping has
now been reworked so that it's fundmentally tied to the BinderProxy
instances, not maintained as global state, to prevent this sort of
confusion entirely.

Bug 3499939

Change-Id: I75c5216b6d53b90868ac969e32c9725201e51be3
2011-03-01 18:25:52 -08:00
Mike Lockwood
c4308f01c9 Move USB framework support from android.hardware to android.hardware.usb package
Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-01 08:07:20 -08:00
Dianne Hackborn
c9119f5034 Add ParcelFileDescriptor APIs to get raw fd.
Change-Id: I66ba72ffffd27237e60c9411453eef950ae62705
2011-02-28 18:03:26 -08:00
Elliott Hughes
20ccb06a7c Merge "Fix Parcel.writeNative to not ignore 'offset'." 2011-02-28 15:11:00 -08:00
Elliott Hughes
a28b83ee04 Fix Parcel.writeNative to not ignore 'offset'.
Also switch to using libcore's array bounds checking. (This variant had no
detail message and was missing the length check.)

Bug: http://code.google.com/p/android/issues/detail?id=15075
Change-Id: Icfc045bd59403b59f02d95c8514abf881d3996e5
2011-02-28 14:55:29 -08:00
Christopher Tate
d5dac80fed Merge "Binder linkage no longer depends on JNI objrefs as persistent tokens" 2011-02-28 12:50:09 -08:00
Mathias Agopian
8c8cfec0ea Merge "Fix sp<> conversion operator / constructor" 2011-02-28 12:50:04 -08:00
Christopher Tate
0b41448506 Binder linkage no longer depends on JNI objrefs as persistent tokens
There are two areas that have changed to eliminate the assumption that
local jobject references are both canonical and persistent:

1. JavaBBinderHolder no longer holds onto and reuses it parent object
reference per se.  Since the underlying JavaBBinder object holds a
real global ref, this was redundant anyway.  Now, for purposes of its
transient need to perform JNI operations, it simply uses the current
jobject ref(s) passed during method invocation, and no longer attempts
to hold these refs beyond the scope of a single invocation.

2. Binder obituaries no longer assume that a jobject reference to a
recipient will always compare == as a 32-bit value with any future
reference to the same object.  The implementation now asks Dalvik
whether object references match.

This amended patch fixes the earlier bug around races between
remote binder death cleanup and local explicit unregistration of
VM-side death recipients.

Bug 2090115

Change-Id: I70bd788a80ea953632b1f466f385ab6b78ef2913
2011-02-28 11:37:20 -08:00
Dianne Hackborn
99aac7beca You can now specify a custom display size as NxM.
Change-Id: Ieb6df51aab009689f0f19b8887025261c5ceb69f
2011-02-28 11:23:18 -08:00
Jeff Brown
02cafc9f6e Log errors reading input channel from parcel.
Bug: 3378634
Change-Id: I47908e48b8348f0366dcef545e828b65d99d81a6
2011-02-26 15:39:12 -08:00
Mathias Agopian
32a55cf66e Fix sp<> conversion operator / constructor
some of the conversion operators were not using the proper
pointer type when calling incStrong/decStrong, usually it
has no bad consequences, but for some implementation
of the ref-counted object it could lead to recording the wrong
owner id.

Change-Id: If574b9069b8a4cf6e0911a992c8f095aba799995
2011-02-25 16:20:52 -08:00
Christopher Tate
e2ed9562fc Revert "Binder linkage no longer depends on JNI objrefs as persistent tokens"
This reverts commit c2d55dd89743c8a38deb809f3cdf1ad2d1dbac2b.
2011-02-25 15:18:53 -08:00
Vasu Nori
e6044145bc bug:3467948 if byteArray couldn't be allocated for blob, throw exception
Change-Id: I73e36c10f31086ea567debad536350316b2df67f
2011-02-25 08:56:07 -08:00
Eric Hassold
447ee77431 Merge "Detect out of memory in extractAlpha" 2011-02-24 13:47:16 -08:00
Christopher Tate
7e8a69ed5c Merge "Binder linkage no longer depends on JNI objrefs as persistent tokens" 2011-02-24 13:22:19 -08:00
Christopher Tate
c2d55dd897 Binder linkage no longer depends on JNI objrefs as persistent tokens
There are two areas that have changed to eliminate the assumption that
local jobject references are both canonical and persistent:

1. JavaBBinderHolder no longer holds onto and reuses it parent object
reference per se.  Since the underlying JavaBBinder object holds a
real global ref, this was redundant anyway.  Now, for purposes of its
transient need to perform JNI operations, it simply uses the current
jobject ref(s) passed during method invocation, and no longer attempts
to hold these refs beyond the scope of a single invocation.

2. Binder obituaries no longer assume that a jobject reference to a
recipient will always compare == as a 32-bit value with any future
reference to the same object.  The implementation now asks Dalvik
whether object references match.

Bug 2090115

Change-Id: If62edd554d0a9fbb2d2977b0cbf8ad7cc8e2e68d
2011-02-24 13:15:09 -08:00
Eric Hassold
ef7be262e5 Detect out of memory in extractAlpha
When extractAlpha() native method in Skia fails to allocate pixels,
it resets target bitmap. This change detects when such empty bitmap
is returned, and throws a OutOfMemory Java exception.

Depends on https://android-git.corp.google.com/g/97793

Bug: 3418381
Change-Id: I65a84998be089c49ed5005f6995bdc4f4d1669bc
2011-02-24 11:21:13 -08:00
Derek Sollenberger
62c7574c02 Merge "Skia Merge (revision 808)" 2011-02-24 05:27:34 -08:00
Romain Guy
47b8adec39 Add a new Camera API to control the camera's location
Change-Id: Id9a082d2def803eb527e1987875e0d8a22c6e8aa
2011-02-23 19:51:42 -08:00
Irfan Sheriff
563db5343f Merge "Add support for background scanning" 2011-02-23 10:41:12 -08:00
James Dong
e00cab707d Application-managed callback buffer support for raw image
bug - 3292153

Change-Id: I9789f7c5cde3a3889d7375e881181e9152d95fc2
2011-02-22 20:48:15 -08:00
Kenny Root
1665da555d Merge "Fix poll options for NativeActivity's hasEvents" 2011-02-22 16:08:42 -08:00
Kenny Root
2bb10f4299 Fix poll options for NativeActivity's hasEvents
NativeActivity created a pipe to wake up a Looper it's attached to, but
it failed to set the right options for the read part of the pipe. This
affects only the NativeActivity API call for AInputQueue_hasEvents

Change-Id: I02e5dad4e700f4c724b3187a4b7e0df931dd1eed
2011-02-22 15:29:21 -08:00
Fabrice Di Meglio
beefeb6151 Merge "Code cleaning" 2011-02-22 15:03:24 -08:00
Fabrice Di Meglio
dd347df9f8 Code cleaning
- use constants whenever possible
- better memory allocation of buffers
- add logging thru conditional compilation

Change-Id: I486195b1cb35046ea00971630832978c1b2e64a0
2011-02-22 14:52:50 -08:00