summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-07-29 17:05:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-29 17:05:58 +0000
commiteda1cc50cead674287616e6a852f8f281b70b9f5 (patch)
tree1bad2e448d3382d7758b321b30d05791131c0b4a
parent64ac302f0c10de0016689b234ba01c1c81da0061 (diff)
parent86cbc2bf30a7623b2ad6564cf50ca20f87067ea7 (diff)
downloadframeworks_base-eda1cc50cead674287616e6a852f8f281b70b9f5.zip
frameworks_base-eda1cc50cead674287616e6a852f8f281b70b9f5.tar.gz
frameworks_base-eda1cc50cead674287616e6a852f8f281b70b9f5.tar.bz2
Merge "Work on issue #22765972: Binder transactions running out of address..." into mnc-dev
-rw-r--r--core/java/android/app/assist/AssistStructure.java4
-rw-r--r--core/java/android/content/pm/ParceledListSlice.java5
-rw-r--r--core/java/android/os/IBinder.java9
3 files changed, 12 insertions, 6 deletions
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index ee0fc91..e08686c 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -141,10 +141,10 @@ public class AssistStructure implements Parcelable {
if (DEBUG_PARCEL) Log.d(TAG, "Creating PooledStringWriter @ " + out.dataPosition());
PooledStringWriter pwriter = new PooledStringWriter(out);
while (writeNextEntryToParcel(as, out, pwriter)) {
- // If the parcel contains more than 100K of data, then we are getting too
+ // If the parcel is above the IPC limit, then we are getting too
// large for a single IPC so stop here and let the caller come back when it
// is ready for more.
- if (out.dataSize() > 1024*1024) {
+ if (out.dataSize() > IBinder.MAX_IPC_SIZE) {
if (DEBUG_PARCEL) Log.d(TAG, "Assist data size is " + out.dataSize()
+ " @ pos " + out.dataPosition() + "; returning partial result");
out.writeInt(0);
diff --git a/core/java/android/content/pm/ParceledListSlice.java b/core/java/android/content/pm/ParceledListSlice.java
index e5c2203..cfb4473 100644
--- a/core/java/android/content/pm/ParceledListSlice.java
+++ b/core/java/android/content/pm/ParceledListSlice.java
@@ -46,8 +46,7 @@ public class ParceledListSlice<T extends Parcelable> implements Parcelable {
* TODO get this number from somewhere else. For now set it to a quarter of
* the 1MB limit.
*/
- private static final int MAX_IPC_SIZE = 256 * 1024;
- private static final int MAX_FIRST_IPC_SIZE = MAX_IPC_SIZE / 2;
+ private static final int MAX_IPC_SIZE = IBinder.MAX_IPC_SIZE;
private final List<T> mList;
@@ -150,7 +149,7 @@ public class ParceledListSlice<T extends Parcelable> implements Parcelable {
final Class<?> listElementClass = mList.get(0).getClass();
dest.writeParcelableCreator(mList.get(0));
int i = 0;
- while (i < N && dest.dataSize() < MAX_FIRST_IPC_SIZE) {
+ while (i < N && dest.dataSize() < MAX_IPC_SIZE) {
dest.writeInt(1);
final T parcelable = mList.get(i);
diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java
index 73a0f65..2c21d13 100644
--- a/core/java/android/os/IBinder.java
+++ b/core/java/android/os/IBinder.java
@@ -149,7 +149,14 @@ public interface IBinder {
* processes.
*/
int FLAG_ONEWAY = 0x00000001;
-
+
+ /**
+ * Limit that should be placed on IPC sizes to keep them safely under the
+ * transaction buffer limit.
+ * @hide
+ */
+ public static final int MAX_IPC_SIZE = 64 * 1024;
+
/**
* Get the canonical name of the interface supported by this binder.
*/