• Home
  • History
  • Annotate
  • only in /frameworks/native/libs/binder/
History log of /frameworks/native/libs/binder/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0bed1f541d5a8284691d2296754604cde0723787 07-Oct-2012 Dave Burke <daveburke@google.com> Revert "ugly, temporary, workaroung for a problem where a binder thread spins forever"

This reverts commit 0845d0245e09548110cacb0f20e9934753388aab

Change-Id: I395037cb9427cd11f7de6bb78fbdfa917fc6263a
PCThreadState.cpp
0845d0245e09548110cacb0f20e9934753388aab 06-Oct-2012 Mathias Agopian <mathias@google.com> ugly, temporary, workaroung for a problem where a binder thread spins forever

Bug: 7289992
Change-Id: I0c3d482a1af57e5f444be2ba7f2751ac3e954af2
PCThreadState.cpp
8210185fe337ca9d5b01f2bff8590ea60984c31e 31-Aug-2012 Dianne Hackborn <hackbod@google.com> No longer need "original calling uid".

Change-Id: Ifc4a89dd088609a5a8553f6ac6553174e09e8222
PCThreadState.cpp
db1597a98958b78dc0d8eced19ae1406382b70d6 17-Feb-2011 Johannes Carlsson <johannes.carlsson.x@sonyericsson.com> Fix shutdown sequence to avoid SIGSEGV when running am command

When the app_process is shutting down the main thread will close the
binder fd while pool threads are executing an ioctl (in
IPCThreadState::stopProcess called by AppRuntime::onStarted in
app_main.c).

The binder driver will then return all pending calls in ioctl
without any error and with a command. One of the threads gets a
BR_SPAWN_LOOPER which will create a new thread (the other thread
gets a BR_NOOP). This new thread then calls
vm->AttachCurrentThread. Usually this results in a log entry with
"AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed",
but sometimes it also causes a SIGSEGV. This depends on the timing
between the new thread an the main thread that calls DestroyJavaVM
(in AndroidRuntime::start).

If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the
pool thread will loop and hit the
ALOG_ASSERT(mProcess->mDriverFD >= 0) in
IPCThreadState::talkWithDriver.

Crashes like this has been seen when running the am command and
other commands that use the app_process.

This fix makes sure that any command that is received when the driver
fd is closed are ignored and IPCThreadState::talkWithDriver instead
returns an error which will cause the pool thread to exit and detach
itself from the vm. A check to avoid calling ioctl to a fd with -1
was also added in IPCThreadState::threadDestructor.

Another solution might be to change the binder driver so that it
returns an error when the fd is closed (or atleast not a
BR_SPAWN_LOOPER command). It might also be possible to call exit(0)
which is done when System.exit(0) is called from java.

Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429
PCThreadState.cpp
1ba24574b2debd3ca012adbbd77f12bed4f2d266 03-May-2011 Magnus Strandberg <magnus.strandberg@sonyericsson.com> Aligning native Parcel implementation to Java.

The Java implementation of writing the RPC response header
calculates the length of the header including the 4 bytes
specifying the header length but the native implementation
excludes the 4 bytes specifying the length from the header
length.
The native implementation has been aligned to the Java impl.

Change-Id: I325bf272a63152d8fded4cf4e51a906b5a9bfe19
arcel.cpp
555f89d8df316cdc5a25dbedb8614c2ac7a5e0a9 09-May-2012 Dianne Hackborn <hackbod@google.com> Add callback hack to find out when to reload system properties.

Every IBinder object can accept a new transaction to tell it that
it might want to reload system properties, and in the process
anyone can register a callback to be executed when this happens.

Use this to reload the trace property.

This is very much ONLY for debugging.

Change-Id: I55c67c46f8f3fa9073bef0dfaab4577ed1d47eb4
inder.cpp
a26e1cfbbcb7dc5e0b1cd79a815362d6a048ef26 16-Mar-2012 Glenn Kasten <gkasten@google.com> Scheduling group cleanup

Remove C++ APIs androidSetThreadSchedulingGroup and
androidGetThreadSchedulingGroup, and the ANDROID_TGROUP_* constants.

Former callers of these should now use the C APIs set_sched_policy and
get_sched_policy, and the SP_* constants.

Note: debug.sys.noschedgroups is not supported by the C APIs,
this needs to be discussed.

Change-Id: I32bbfc539ef4090faf9ef0320380e8cca9eae07c
PCThreadState.cpp
1b80f793d2328dd94a151411a1cc3a676121ffc7 18-Apr-2012 Mathias Agopian <mathias@google.com> add set thread count

Change-Id: I70f02908d8362a465eb8a2a24356f6989847f7ba
rocessState.cpp
e8db871de7b26bf4fe7ae8d400c4a2c503cfe3a2 17-Apr-2012 Mathias Agopian <mathias@google.com> double checked locking pattern is not safe on SMP

Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
rocessState.cpp
4bcb57502c5a7da53ef84228aceeffb54d36e06b 06-Mar-2012 Glenn Kasten <gkasten@google.com> Remove obsolete references to sched_policy.h

As part of scheduling policy cleanup, remove or isolate
all references to the scheduling policy APIs.

Change-Id: Ia1ea2fe711a399039f25217309e061267744b856
PCThreadState.cpp
67f8b5228e10e99136fcaf994940092f5784cabb 29-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Shorten thread names"
102d539a4c6e70ec2403bfd2bfef3a3373da15ac 28-Feb-2012 Glenn Kasten <gkasten@google.com> Shorten thread names

prctl(PR_SET_NAME) limits to 15 characters. Before we had names like
"Binder Thread #" and the counter was cut off :-( Also remove redundant
"thread" at end of name; it's always a thread.

Change-Id: I1f99c2730ba0787ed9b59c15914356cddf698e2f
rocessState.cpp
7a7524810a0950c1c2b18014a8f1c637275165c4 28-Feb-2012 Mathias Agopian <mathias@google.com> get rid of MemoryHeapPmem

MemoryHeapPmem is not used any longer. PMEM is not a supported
type of memory by the system anymore. a particular device might
use PMEM and need something like MemoryHeapPmem, in this case this
should be implemented in device specific code (HAL).

This will most likely break older no longer supported targets.

Change-Id: I434e4291219950018de8b793b0403bb2d92dd5cc
ndroid.mk
emoryHeapPmem.cpp
89d353a4c52197695f06e37267ade99dc627e7e0 28-Feb-2012 Mathias Agopian <mathias@google.com> move CursorWindow from libbinder to libandroidfw

Change-Id: I3b304e4f74e0d0ec8b20c57296c62449c9a0f792
ndroid.mk
ursorWindow.cpp
a94f129a7bbaa8ea45c50e49ba3e6127ca2a15ec 10-Feb-2012 Dianne Hackborn <hackbod@google.com> Some hardening of isolated processes by restricting access to services.

Services now must explicitly opt in to being accessed by isolated
processes. Currently only the activity manager and surface flinger
allow this. Activity manager is needed so that we can actually
bring up the process; SurfaceFlinger is needed to be able to get the
display information for creating the Configuration. The SurfaceFlinger
should be safe because the app doesn't have access to the window
manager so can't actually get a surface to do anything with.

The activity manager now protects most of its entry points against
isolated processes.

Change-Id: I0dad8cb2c873575c4c7659c3c2a7eda8e98f46b0
ServiceManager.cpp
4e975bb488bb3947703e95cb33a4838adda680f7 04-May-2011 Amith Yamasani <yamasani@google.com> Multi-user - 1st major checkin

Switching activity stacks
Cache ContentProvider per user
Long-press power to switch users (on phone)

Added ServiceMap for separating services by user
Launch PendingIntents on the correct user's uid
Fix task switching from Recents list
AppWidgetService is mostly working.

Commands added to pm and am to allow creating and switching profiles.

Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
PCThreadState.cpp
6726347e8950d34ae162fb8d6a3680a871d359e2 09-Jan-2012 Steve Block <steveblock@google.com> Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGE

See https://android-git.corp.google.com/g/157519

Bug: 5449033
Change-Id: I8ceb2dba1b031a0fd68d15d146960d9ced62bbf3
PCThreadState.cpp
e6f43ddce78d6846af12550ff9193c5c6fe5844b 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
pBinder.cpp
ursorWindow.cpp
Memory.cpp
emoryDealer.cpp
emoryHeapBase.cpp
emoryHeapPmem.cpp
arcel.cpp
rocessState.cpp
32397c1cd3327905173b36baa6fd1c579bc328ff 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
inder.cpp
ursorWindow.cpp
ServiceManager.cpp
emoryDealer.cpp
arcel.cpp
rocessState.cpp
a19954ab377b46dbcb9cbe8a6ab6d458f2e32bca 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
PCThreadState.cpp
ServiceManager.cpp
arcel.cpp
9d4536835248525f32f1504a3d28d5bbfa0a2910 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
Memory.cpp
emoryDealer.cpp
emoryHeapBase.cpp
arcel.cpp
ermissionCache.cpp
c4cd5301d4978dda5266194625ef4fd7f9d3dde4 14-Dec-2011 Ji-Hwan Lee <jihwan@google.com> Fix invalid madvise() during concurrent alloc/dealloc of MemoryDealer

Currently, madvise(MADV_REMOVE) is called after deallocation.
Another thread might allocate (and even write) the same region between
deallocation and madvise(), in which case the new thread will fail to read
what it have written. So, call deallocate() after madvise(MADV_REMOVE).

Bug: 5654596
Change-Id: I26f36cd6013de499090768a0ddc68206a4a68219
emoryDealer.cpp
a63ee4c2fdc4869fd1169d22e79ae9f1220c5bdb 02-Dec-2011 Ben Cheng <bccheng@google.com> am f1a4c48b: am e21dabf6: Merge "Initialize bwr.read_buffer in IPCThreadState::talkWithDriver." into ics-mr1

* commit 'f1a4c48b886d53e2afceb0620215e3792af79fd5':
Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.
d640f89205e17d9f19b11c2954862f0945a40e7b 02-Dec-2011 Ben Cheng <bccheng@google.com> Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.

I/valgrind( 1309): ==1310== Syscall param
ioctl(BINDER_WRITE_READ).read_buffer points to uninitialised byte(s)
I/valgrind( 1309): ==1310== at 0x480E670: __ioctl (__ioctl.S:10)
I/valgrind( 1309): ==1310== Address 0xbda651b4 is on thread 1's stack

Change-Id: I02893df7b5786b6b2dbd9659f5706d7171295ab2
PCThreadState.cpp
d341c7178fffc7ad5b57645c2bcf5a395ca95591 05-Nov-2011 Jeff Brown <jeffbrown@google.com> Fix possible leak in Parcel::writeDupFileDescriptor.

Also, check the result of dup() just in case we got EMFILE
or something.

Change-Id: I18e627bd84f4c7941813fe1c2bad2cdd9e5afa83
arcel.cpp
c17f56fdf11d5c5207d02d457692a40252aa3f34 07-Nov-2011 Jeff Brown <jeffbrown@google.com> am 88061d6b: am 5462bc63: Fix a leak in Parcel::writeBlob.

* commit '88061d6b38cfb4bf374039846b753a3b21ac61e1':
Fix a leak in Parcel::writeBlob.
efd912c05c0ef550a1c5ba7a14281261f6a0f9f4 05-Nov-2011 Jeff Brown <jeffbrown@google.com> am 5462bc63: Fix a leak in Parcel::writeBlob.

* commit '5462bc6318b4b70e7a58c66994e2bd79f59d9739':
Fix a leak in Parcel::writeBlob.
93ff1f985e233fe04412a65041e977c9f0c21f5b 05-Nov-2011 Jeff Brown <jeffbrown@google.com> Fix a leak in Parcel::writeBlob.

Was mistakenly assuming that Parcel::writeFileDescriptor took
ownership of the fd that was passed in. It does not!
Added some comments and a default parameter to allow the caller
to specify whether it wishes the Parcel to take ownership.

Bug: 5563374
Change-Id: I5a12f51d582bf246ce90133cce7690bb9bca93f6
arcel.cpp
9897b4613881b272b5a0ce82eb127d2350550dad 30-Oct-2011 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 2d280f75 to ics-mr1

Change-Id: I459e1cb0b60fb94dfb12862fedb9f8d949c226a7
27a852b620c54e4c722d8af3d954db169fdd7554 28-Oct-2011 Jeff Brown <jeffbrown@google.com> Improve the slow query instrumentation.

On user-debug and eng builds, you can set the
"db.log.slow_query_threshold" system property to queries that
take longer than the specified number of milliseconds.
Set it to 0 to log all queries.

This property has been around for a while but it was implemented
poorly. In particular, it *changed* the behavior of the query
by calling getCount() while holding the Db connection.
In normal operation, the query will not actually run until later.

By putting the timing logic into fillWindow() instead, we ensure
that we only measure queries that actually ran. We also capture
cases where the cursor window gets filled multiple times.

Bug: 5520301
Change-Id: I174f5e1ea15831a1d22a36e9a804d7755f230b38
ursorWindow.cpp
20b3da9a01f73cf60f39e837ee5bef73ce078b7c 27-Oct-2011 Jeff Brown <jeffbrown@google.com> Optimize fillWindow to improve reverse-seek performance.
Bug: 5520301

When an application requests a row from a SQLiteCursor that
is not in the window, instead of filling from the requested
row position onwards, fill from a little bit ahead of the
requested row position.

This fixes a problem with applications that seek backwards
in large cursor windows. Previously the application could
end up refilling the window every time it moved back
one position.

We try to fill about 1/3 before the requested position and
2/3 after which substantially improves scrolling responsiveness
when the list is bound to a data set that does not fit
entirely within one cursor window.

Change-Id: I168ff1d3aed1a41ac96267be34a026c108590e52
ursorWindow.cpp
6807e59e0ff943cc6225d46e3c33a8a7eae9b3d7 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
pBinder.cpp
arcel.cpp
rocessState.cpp
9f760150f6e0f39b9923cfdc875373606839ee00 12-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/141576

Bug: 5449033
Change-Id: I42575e7c29cf1c0f465c357a5c97ab118df6f473
PCThreadState.cpp
arcel.cpp
3e2fb7056ab4f459c63c6204d60abd537adf8442 13-Oct-2011 Jeff Brown <jeffbrown@google.com> Deprecate local-only CursorWindows.

There is no difference and has never really been a difference
between local-only and remotable CursorWindows. By removing the
distinction officially in the API, we will make it easier to
implement CrossProcessCursor correctly. CrossProcessCursor
is problematic currently because it's not clear whether a call
to getWindow() will return a local-only window or a remotable window.
As a result, the bulk cursor adaptor has special case handling
for AbstractWindowedCursors vs. ordinary CrossProcessCursors
so that it can set a remotable window before the cursor fills it.
All these problems go away if we just forget about local-only
windows being special in any way.

Change-Id: Ie59f517968e33d0ecb239c3c4f60206495e8f376
ursorWindow.cpp
ec4e0063a1c5cc6e01472cc2a9d27609ce3827d7 10-Oct-2011 Jeff Brown <jeffbrown@google.com> Use ashmem for CursorWindows.
Bug: 5332296

The memory dealer introduces additional delays for reclaiming
the memory owned by CursorWindows because the Binder object must
be finalized. Using ashmem instead gives CursorWindow more
direct control over the lifetime of the shared memory region.

The provider now allocates the CursorWindows and returns them
to clients with a read-only protection bit set on the ashmem
region.

Improved the encapsulation of CursorWindow. Callers shouldn't
need to care about details like how string fields are allocated.

Removed the compile-time configuration of string and numeric
storage modes to remove some dead weight.

Change-Id: I07c2bc2a9c573d7e435dcaecd269d25ea9807acd
ursorWindow.cpp
arcel.cpp
cc0bf53f214d8c9029ce27ac3985dc5c18d5130a 06-Oct-2011 Jeff Brown <jeffbrown@google.com> Clean up CursorWindow code.
Bug: 5332296

The code is functionally equivalent, but a little more efficient
and much easier to maintain.

Change-Id: I90670a13799df05831843a5137ab234929281b7c
ursorWindow.cpp
7746cc318829358bb2c4dc0a03d40a7856a6d13e 04-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix handling of "allow fds" state.

Didn't take into account nesting of bundles. Boo.

Change-Id: Ic8cf21ad8d6f4938a3e105128624c9d162310d01
arcel.cpp
5707dbf15d0b44c88fbaa6dd271097f2d42932e0 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: If385a66adf4c6179a0bb49c0e6d09a9567e23808
arcel.cpp
8938ed2c8e906fc332301b64787728d4d34da571 29-Sep-2011 Dianne Hackborn <hackbod@google.com> Add mechanism for Parcel to not allow FDs to be written to it.

This is to help implement issue #5224703.

Change-Id: I026a5890495537d15b57fe61227a640aac806d46
arcel.cpp
8acda7803417cc38cb284298fcb86b479d11fdb5 25-Sep-2011 Bart Sears <bsears@google.com> Revert "Transfer large bitmaps using ashmem. Bug: 5224703"

This reverts commit 56c58f66b97d22fe7e7de1f7d9548bcbe1973029

This CL was causing the browser to crash when adding bookmarks, visiting the bookmarks page, and sharing pages (see bug http://b/issue?id=5369231
arcel.cpp
f4c1088d750a182bd85889c86b3c9ef4ba772405 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: Ic7481dd9f173986f085a8bbdcc59bbe9830d7a44
arcel.cpp
aefc9cda45adb00ec1cb2c8fbd03c50fd48499fb 31-Aug-2011 Andy McFadden <fadden@android.com> Resurrect verbose binder logging

Updated the command name lists, and masked off the additional bits in
the command word when doing the name lookup.

Made descriptor values easier to grep for and consistent with kernel
output (i.e. decimal rather than hex). Attempt to show transaction
descriptors as such (they're in a union with a pointer).

Also, the writeLines() function in Static was using a no-op
logging call to write an iovec. It looks like all callers are using
N=1, so I just added a log for the first string.

Bug 5155269

Change-Id: I417b8d77da3eb6ee1d2069ba94047210f75738bc
PCThreadState.cpp
c2be743a9c366a17d64c6afb5a299664ddfcd32f 13-Jul-2011 Mike Lockwood <lockwood@android.com> Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build

Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
rocessState.cpp
e16986cae281f118ecd563c384b7f6e5a4b937b5 09-Jul-2011 Jeff Brown <jeffbrown@google.com> Eliminate single-process mode.
Bug: 5010576

Change-Id: Id450dc83efed4897d1e4ff451530fed14457aace
rocessState.cpp
99b49840d309727678b77403d6cc9f920111623f 28-Jun-2011 Mathias Agopian <mathias@google.com> PermissionCache caches permission checks

This is intended to absorb the cost of the IPC
to the permission controller.
Cached permission checks cost about 3us, while
full blown ones are two orders of magnitude slower.

CAVEAT: PermissionCache can only handle system
permissions safely for now, because the cache is
not purged upon global permission changes.

Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
ndroid.mk
ermission.cpp
ermissionCache.cpp
5728a92e29c1c9729017a82c5d0bc18fc1069923 22-Jun-2011 Anu Sundararajan <sanuradha@ti.com> MemoryHeapBase: Save and binderize the offset

The offset that is used in the creation of the MemoryHeapBase must be saved, so
that it can be used to recreate the Heap when an IMemory object is passed
across process boundary through the binder.

Change-Id: Ie618fb5c0718e6711f55ed9235616fd801e648dc
Signed-off-by: Anu Sundararajan <sanuradha@ti.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Memory.cpp
emoryHeapBase.cpp
d547432f98889d57a8c37e91090664efe63da436 21-Apr-2011 Evgeniy Stepanov <eugenis@google.com> Make sure binder ioctl structs don't contain uninitialized values.

Change-Id: I8a678f91262417bb120e65e32c244ce1512b46c2
PCThreadState.cpp
6e9eb7453fe81fd0bb06eaa263c1767765ef5a78 18-Apr-2011 Andreas Huber <andih@google.com> Merge "Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)"
97e2bcd76021b31c5064fd3f669bc3f450b4c952 14-Apr-2011 Dianne Hackborn <hackbod@google.com> Rewrite battery history storage.

We now write battery history directly into a buffer, instead of
creating objects. This allows for more efficient storage; later
it can be even better because we can only write deltas.

The old code is still there temporarily for validation.

Change-Id: I9707d4d8ff30855be8ebdc93bc078911040d8e0b
arcel.cpp
51faf46e2958c57dab46d9420e585319125c7c42 13-Apr-2011 Andreas Huber <andih@google.com> Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)

As far as I can tell "parcel" isn't actually modified by the implementation.

Change-Id: Ib806eefdc13c97b932773e1dc9ca3a4aad4422b2
arcel.cpp
af1cf07134dccc884c654da0e713c9213d7be3f4 16-Feb-2011 Kenny Root <kroot@google.com> Clean up use of HAVE_ANDROID_OS

HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches
all the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
emoryHeapBase.cpp
emoryHeapPmem.cpp
1ee57e397f4917aa1b42db31b52242eed2fa9b09 28-Dec-2010 Jean-Baptiste Queru <jbq@google.com> am 6637e307: am bfb5f596: Merge "Fix for writing empty strings to Parcel::writeString8()"

* commit '6637e307494475b85afe8869d312d4a2f832d8f4':
Fix for writing empty strings to Parcel::writeString8()
d1dff8d4d47a5f9142a22b11950adc55ea2b36df 15-Dec-2010 Pravat Dalbehera <pravat.dalbehera@sonyericsson.com> Fix for writing empty strings to Parcel::writeString8()

If writeString8 is called with the following sequence:

writeString8(String8(""));
writeString8(String8("TempString"));

Then in the readString8, the 2nd String i.e. "TempString" is not read,
instead an empty string is read.

The bug comes because of the write call for String8("") where there are
no String bytes present. In the write Statement, an extra ‘\0’ is
written. During the Marshalling, Following bytes are written:

1 2 3 4 5 ...
0x0 0x0 0xB ‘T’ ‘e’ ...

The readString8 function has a check that, if String length is 0, don’t
read anything. So the first byte is read as the length for the first
string. The second byte i.e. ‘\0’ is read as the length for the second
string and hence the second string becomes empty too.

Change-Id: Id7acc0c80ae16e77be4331f1ddf69ea87e758420
arcel.cpp
1b6084354710ca52c04ea361d751d19174802d57 14-Dec-2010 Brad Fitzpatrick <bradfitz@android.com> Framework-side support for Dalvik "isSensitiveThread" hook.

Used in lock contention stats.

Bug: 3226270
Change-Id: Ie6f58d130a29079a59bdefad40b80304d9bc3623
PCThreadState.cpp
7c4f09db4caf022cdc1a8ce44c85b7fe2319316c 29-Nov-2010 Vasu Nori <vnori@google.com> fix messages from sqlite layer in c++ code to be useful.

Change-Id: Ib13f86f3481aae391f5e887bb14877f12bf48034
ursorWindow.cpp
82bd26d904f3805d9bfaf475677e4c7a7e120ff1 27-Oct-2010 Vasu Nori <vnori@google.com> convert one of the LOGE to LOG_WINDOW msg to reduce grief

grief from people who think this message is bad news.
but in reality, this message is really just an informational message
to aid in debugging

Change-Id: I1a2ab1666a27adb7d3fd210528b2c5218640d53d
ursorWindow.cpp
91abfdd3ed40f6d90cc7d8f05d3b09bab1beed47 06-Oct-2010 Vasu Nori <vnori@google.com> turn off some useless messages

Change-Id: I5ed5696cd052b70e7cf7b872205470cd56fada90
ursorWindow.cpp
be8bf0ced452c8efbf7c61828b9e5c5f5df44281 25-Sep-2010 Dianne Hackborn <hackbod@google.com> am deaa8ff1: am a7ef18fc: Merge "Some debugging support." into gingerbread

Merge commit 'deaa8ff1b10d38add4f7c276e7be2ffc19359a14'

* commit 'deaa8ff1b10d38add4f7c276e7be2ffc19359a14':
Some debugging support.
67f78c4fe8f89b52199f509f36e42df0b1cdfe2d 24-Sep-2010 Dianne Hackborn <hackbod@google.com> Some debugging support.

- New feature to "am monitor" to have it automatically launch
gdbserv for you when a crash/ANR happens, and tell you how to
run the client.

- Update dumpstate to match new location of binder debug logs

- Various commented out logs that are being used to track down
issues.

Change-Id: Ia5dd0cd2df983a1fc6be697642a4590aa02a26a5
PCThreadState.cpp
f3372f7ca355cbc8828f543937469e313e9500ec 01-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> am ae087369: am 63070856: Merge "Don\'t propagate StrictMode over one-way Binder calls." into gingerbread

Merge commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80'

* commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80':
Don't propagate StrictMode over one-way Binder calls.
5273603e98d2db3bac656b7bcf5352c04c86d62f 31-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Don't propagate StrictMode over one-way Binder calls.

This was causing stack stitching problems where a one-way call with
violations followed by a two-way call without violations was getting
the previous one-way call's violation stack stitched on to the second
caller's stack.

The solution is a little more indirect than I would've liked
(preserving the binder's onTransact flags until enforceInterface) but
was seemingly necessary to work without changing the AIDL compiler.
It should also be sufficiently cheap, since no new calls to
thread-local IPCThreadState lookups were required. The additional
work is just same-thread getter/setters on the existing
IPCThreadState.

Change-Id: I4b6db1d445c56e868e6d0d7be3ba6849f4ef23ae
PCThreadState.cpp
arcel.cpp
b8f4015c0aeb006d5028b5e3a6d5e522b184e008 27-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> am 245cb784: am 84c924a6: Merge "Replace several IPCThreadState::get() lookups with one." into gingerbread

Merge commit '245cb7846c82f7c0840e13f0b994d356846b1678'

* commit '245cb7846c82f7c0840e13f0b994d356846b1678':
Replace several IPCThreadState::get() lookups with one.
70081a1511955f53bd0ed7f2aec9a1bf09f0f379 27-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> Replace several IPCThreadState::get() lookups with one.

Also, make StrictMode's ThreadLocal final.

Change-Id: I08d400ed254fa67bb7a3dae1227f205a54c00df0
arcel.cpp
e9f1a6478fb0f6457fe085eddaa66e3f23081c00 16-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> am 3e5e21d4: am 1772c34e: Merge "StrictMode: gather and return violating stacks in Binder replies" into gingerbread

Merge commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d'

* commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d':
StrictMode: gather and return violating stacks in Binder replies
721c4162c3ad46d55ac09bf68f5922bb683d36f7 16-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> am cc52121c: am c4b204bd: Merge "More StrictMode work, keeping Binder & BlockGuard\'s thread-locals in-sync." into gingerbread

Merge commit 'cc52121c4f88e9feb8404937bcbfff6e73084666'

* commit 'cc52121c4f88e9feb8404937bcbfff6e73084666':
More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.
d36f4a5f130be7f7b29a8b63cedbc8edfa56db96 12-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> StrictMode: gather and return violating stacks in Binder replies

Now, when Thread A has a strict mode policy in effect and does a
Binder call to Thread B (most likely in another process), the strict
mode policy is passed along, but with the GATHER penalty bit set which
overrides other policies and instead gathers all offending stack
traces to a threadlocal which are then written back in the Parcel's
reply header.

Change-Id: I7d4497032a0609b37b1a2a15855f5c929ba0584d
arcel.cpp
a877cd85b5a026384542e3271fc310d6a8fe24c6 08-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.

Change-Id: Ia67cabcc17a73a0f15907ffea683d06bc41b90e5
PCThreadState.cpp
arcel.cpp
0c2aaca5d6495dabadd6544bc694f881724e65ee 14-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> am 706623dd: am c0a7e690: Add Parcel::readExceptionCode() and Parcel::writeNoException()

Merge commit '706623ddb8314850c0551f0b66e24b5f0bd28620'

* commit '706623ddb8314850c0551f0b66e24b5f0bd28620':
Add Parcel::readExceptionCode() and Parcel::writeNoException()
837a0d0fb2c3fba8082d47d04cb6120af1eb9a54 14-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> Add Parcel::readExceptionCode() and Parcel::writeNoException()

Add native Parcel methods analogous to the Java versions.

Currently, these don't do much, but upcoming StrictMode work changes
the RPC calling conventions in some cases, so it's important that
everybody uses these consistently, rather than having a lot of code
trying to parse RPC responses out of Parcels themselves.

As a summary, the current convention that Java Binder services use is
to prepend the reply Parcel with an int32 signaling the exception
status:

0: no exception
-1: Security exception
-2: Bad Parcelable
-3: ...
-4: ...
-5: ...

... followed by Parceled String if the exception code is non-zero.

With an upcoming change, it'll be the case that a response Parcel can,
non-exceptionally return rich data in the header, and also return data
to the caller. The important thing to note in this new case is that
the first int32 in the reply parcel *will not be zero*, so anybody
manually checking for it with reply.readInt32() will get false
negative failures.

Short summary: If you're calling into a Java service and manually
checking the exception status with reply.readInt32(), change it to
reply.readExceptionCode().

Change-Id: I23f9a0e53a8cfbbd9759242cfde16723641afe04
PermissionController.cpp
ServiceManager.cpp
arcel.cpp
f9e01ea4818328ecb2f573bcaee3116b49414035 23-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> am efcf68aa: am ef8f96a7: Merge "Start of work on passing around StrictMode policy over Binder calls." into gingerbread

Merge commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b'

* commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b':
Start of work on passing around StrictMode policy over Binder calls.
702ea9d42f52fc145090c0f0bfbe64993e4b8b33 18-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> Start of work on passing around StrictMode policy over Binder calls.

This is (intendend to be) a no-op change.

At this stage, Binder RPCs just have an additional uint32 passed around
in the header, right before the interface name. But nothing is actually
done with them yet. That value should right now always be 0.

This now boots and seems to work.

Change-Id: I135b7c84f07575e6b9717fef2424d301a450df7b
PCThreadState.cpp
ServiceManager.cpp
arcel.cpp
244a7655aea626c6f16f68d39ba3c92a164adc16 27-May-2010 Mike Lockwood <lockwood@android.com> Move CursorWindow class from core/jni to libbinder

To allow use of the native CursorWindow class outside of the core framework jni

Change-Id: I72e8dcb91a2c691130c33cdfd9a25d343da1c592
Signed-off-by: Mike Lockwood <lockwood@android.com>
ndroid.mk
ursorWindow.cpp
386a332b4f70718cccb08d5511d66e9f4f5bd409 06-May-2010 Dan Egnor <egnor@google.com> Make static versions of libutils and libbinder.

Fix some small static-initialization-order issues (and a static-
initializers-missing issue) that result from doing so. The static
libraries don't actually get used for anything real at the moment --
they're used for perf tests of bug 2660235.

Bug: 2660235
Change-Id: Iee2f38f79cc93b395e8d0a5a144ed92461f5ada0
ndroid.mk
inder.cpp
3c772b706dd8e53fe17b284bb2e60c146867f787 20-Apr-2010 Mathias Agopian <mathias@google.com> fix [2599939] "cannot play video" after open/close a video player a dozen of times

get rid off the MAP_ONCE flag is MemoryHeapBase (as well as it's functionality),
this feature should not be used anymore.

the software renderer was incorrectly using the default ctor which set MAP_ONCE,
causing the leak. the software renderer itself is incorrectly used while coming
back from sleep.

Change-Id: I123621f8d140550b864f352bbcd8a5729db12b57
Memory.cpp
440fd870b20b4720e11c9ea71d2a3284f8cf2f59 19-Mar-2010 Christopher Tate <ctate@google.com> Ensure that binder incalls to the system process keep the fg cgroup

On binder incalls, the handler thread is given the caller's priority by the
driver, but not the caller's cgroup. We have explicit code that sets the
handler's cgroup to match the caller's, *except* that the system process
explicitly disables this behavior. This led to a siuation in which we were
running binder incalls to the system process at nice=10 but cgroup=fg.

That's fine as far as it goes, except that if a GC happened in the handler
thread, it would be promoted to foreground priority and cgroup both, to avoid
having the GC take forever. Then, when GC finished, the original priority
is reset, and the cgroup set *based on that priority*. This would push the
handler thread into nice=10 cgroup=bg_non_interactive -- which matches the
caller, but is supposed to be impossible in the system process.

The end result of this was that we could be running "lengthy" operations in
the system process in the background. Unfortunately, some of the operations
that wound up like this would hold important global system locks for up to
twenty seconds as a result, making the entire device unresponsive to input
for that period.

This CL fixes the binder incall setup to ensure that within the system process,
a binder incall is always begun from the normal foreground priority as well
as cgroup. In practice now the device still becomes laggy/sluggish when the
offending lock-holding time-consuming incall occurs, but since it still runs
as a foreground task it is able to proceed to completion within a short time
rather than taking 20 seconds.

Fixes bug #2403717

Change-Id: Id046aeabd0e80c48eef94accc37842835eab308d
PCThreadState.cpp
98e71ddaede9a0bfb681fd237bec1f66c6c53193 12-Feb-2010 Mathias Agopian <mathias@google.com> remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).

Add a Flattenable interface to libutils which can be used to flatten
an object into bytestream + filedescriptor stream.
Parcel is modified to handle Flattenable. And GraphicBuffer implements
Flattenable.

Except for the overlay classes libui is now independent of libbinder.
arcel.cpp
0dd0d2944a0a7b985db162dec8b49b77d689d171 26-Jan-2010 Mathias Agopian <mathias@google.com> Simplify the MemoryDealer implementation

At some point the implementation became complicated because of
SurfaceFlinger's special needs, since we are now relying on gralloc
we can go back to much simpler MemoryDealer.

Removed HeapInterface and AllocatorInterface, since those don't need
to be paramterized anymore. Merged SimpleMemory and Allocation.
Made SimplisticAllocator non virtual.

Removed MemoryDealer flags (READ_ONLY, PAGE_ALIGNED)

Removed a lot of unneeded code.
emoryDealer.cpp
emoryHeapPmem.cpp
8c6cedc9bc9a4b69616a79a95449f6f6b08c7bf1 08-Dec-2009 Dianne Hackborn <hackbod@google.com> Propagate background scheduling class across processes.

This is a very simply implementation: upon receiving an IPC, if the handling
thread is at a background priority (the driver will have taken care of
propagating this from the calling thread), then stick it in to the background
scheduling group. Plus an API to turn this off for the process, which is
used by the system process.

This also pulls some of the code for managing scheduling classes out of
the Process JNI wrappers and in to some convenience methods in thread.h.
PCThreadState.cpp
c0c1092183ceb38dd4d70d2732dd3a743fefd567 31-Oct-2009 Rebecca Schultz Zavin <rebecca@android.com> Modify the binder to request 1M - 2 pages instead of 1M. The backing store
in the kernel requires a guard page, so 1M allocations fragment memory very
badly. Subtracting a couple of pages so that they fit in a power of
two allows the kernel to make more efficient use of its virtual address space.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
rocessState.cpp
07d69893e1677bd59a3461a0c4fcd3541563144d 08-Nov-2009 Christopher Tate <ctate@android.com> Reset binder service threads' cgroup/priority after command completion

To prevent buggy command implementations from poisoning binder threads'
scheduling class & priority for future command execution, we now reset the
cgroup and thread priority to foreground/normal when a binder service thread
finishes executing the designated command.

Change-Id: Ibc0ab2485751453f6dc96fdb4eb877fd02796e3f
PCThreadState.cpp
6dfe8f1ffad455363fff4fe69ced6da386970fbc 06-Nov-2009 Evan Millar <emillar@google.com> Revert jparks code from IPCThreadState.
PCThreadState.cpp
b5c41353337b3db2dc0ca0df163d5294af8281bc 04-Nov-2009 Jason Parks <jparks@google.com> When a thread is about to be put back onto the thread pool ensure that it is in the foreground cgroup.
PCThreadState.cpp
dcd3958c5086f757dc09472700ae7384efea7fc8 03-Nov-2009 Jason Parks <jparks@google.com> Add a warning when we leave threads in the binder thread pool in the background scheduling group.
PCThreadState.cpp
d7f53e1945be8db145a5f1be038ed223d25a8edf 03-Nov-2009 Dima Zavin <dima@android.com> libbinder: MemoryHeapPmem: honor the NO_CACHING flag when creating a client heap

Change-Id: Ia7beb800f5a24beaa4b7f3032b486d4ed1991b23
Signed-off-by: Dima Zavin <dima@android.com>
emoryHeapPmem.cpp
0db1a8931bb24b4f240c19210e70844af8c1e9ff 30-Oct-2009 Iliyan Malchev <malchev@google.com> libbinder: add a NO_CACHING flag to MemoryHeapBase

The NO_CACHING flag translates to opening a memory region with O_SYNC.

Signed-off-by: Iliyan Malchev <malchev@google.com>
emoryHeapBase.cpp
d4851d74ac9c737acda85f1fdbc028c68f481a36 17-Aug-2009 Benny Wong <Benny.Wong@motorola.com> Add offset handling in MemoryHeapBase class
emoryHeapBase.cpp
84a6d041e2c69d4d0b69269a0b59e725c9f119a3 17-Aug-2009 Andreas Huber <andih@google.com> Support for marshalling pointers / intptr_t in Parcel.

Some refactoring to eliminate code duplication in Parcel implementation.
arcel.cpp
1d0a95b12a9194f64dd436224ec3bf8e0622d678 01-Aug-2009 Mathias Agopian <mathias@google.com> don't crash in Parcel when given a null (and therfore invalid) native_handle_t
arcel.cpp
d43b194b69fca6c81023effc921fcc7576bad496 17-Jul-2009 Marco Nelissen <marcone@google.com> Instead of using -1 for pid and uid in the simulator, and then having
to special-case the simulator case all over the framework, just use
getuid and getpid, and intercept those in the simulator wrapper.
PCThreadState.cpp
375f56363a8737119ce2222dcfaacbe1cf733fc0 16-Jun-2009 Mathias Agopian <mathias@google.com> new Permission class used to improve permission checks speed (by caching results)
ndroid.mk
ServiceManager.cpp
ermission.cpp
83c0446f27b9542d6c2e724817b2b2d8d1f55085 23-May-2009 Mathias Agopian <mathias@google.com> some work to try to reduce the code size of some native libraries

- make sure that all binder Bn classes define a ctor and dtor in their respective library.
This avoids duplication of the ctor/dtor in libraries where these objects are instantiated.
This is also cleaner, should we want these ctor/dtor to do something one day.

- same change as above for some Bp classes and various other non-binder classes

- moved the definition of CHECK_INTERFACE() in IInterface.h instead of having it everywhere.

- improved the CHECK_INTERFACE() macro so it calls a single method in Parcel, instead of inlining its code everywhere

- IBinder::getInterfaceDescriptor() now returns a "const String16&" instead of String16, which saves calls to String16 and ~String16

- implemented a cache for BpBinder::getInterfaceDescriptor(), since this does an IPC. HOWEVER, this method never seems to be called.
The cache makes BpBinder bigger, so we need to figure out if we need this method at all.
inder.cpp
pBinder.cpp
Interface.cpp
Memory.cpp
PermissionController.cpp
ServiceManager.cpp
emoryDealer.cpp
emoryHeapPmem.cpp
arcel.cpp
4e97f8c62f3eb3c51343e9f4bbd898992a13903d 22-May-2009 Android (Google) Code Review <android-gerrit@google.com> am d50a458b: Merge change 2351 into donut

Merge commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3'

* commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3':
Fix a major bug in Bundle when unparcelling from AIDL.
a47f02afb1e1f2c4abd9379c13903a5dde89d354 22-May-2009 Mathias Agopian <mathias@google.com> change 2115 wasn't merged properly into master. this fixes that.

Merge change 2115 into donut

* changes:
bring the native_handle stuff back from master_gl

Conflicts:

libs/binder/Parcel.cpp
arcel.cpp
c5b2c0bf8007562536b822eb060fc54a01f8e08b 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
inder.cpp
pBinder.cpp
DataConnection.cpp
Interface.cpp
Memory.cpp
PCThreadState.cpp
PermissionController.cpp
ServiceManager.cpp
emoryBase.cpp
emoryDealer.cpp
emoryHeapBase.cpp
emoryHeapPmem.cpp
arcel.cpp
rocessState.cpp
tatic.cpp
208059f67ed2dd9fa025e07fcb6954d3cb61c79e 19-May-2009 Mathias Agopian <mathias@google.com> checkpoint: split libutils into libutils + libbinder
ndroid.mk
inder.cpp
pBinder.cpp
DataConnection.cpp
Interface.cpp
Memory.cpp
PCThreadState.cpp
PermissionController.cpp
ServiceManager.cpp
emoryBase.cpp
emoryDealer.cpp
emoryHeapBase.cpp
emoryHeapPmem.cpp
arcel.cpp
rocessState.cpp
tatic.cpp