summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorIan Pedowitz <ijpedowitz@google.com>2015-10-22 22:26:32 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-22 22:26:32 +0000
commit09fd4ecf90c7ae2536a6848e8c88c4878e0e0c24 (patch)
treeb06217df6eb321a24ab39b8fbaf1dade467382a4 /core/java/android
parent6666b29cf7c5ddaeae3d66606a9982f7c5cc8686 (diff)
parente2adb2cf0f2c90c77fab3f09285a92e05e70b567 (diff)
downloadframeworks_base-09fd4ecf90c7ae2536a6848e8c88c4878e0e0c24.zip
frameworks_base-09fd4ecf90c7ae2536a6848e8c88c4878e0e0c24.tar.gz
frameworks_base-09fd4ecf90c7ae2536a6848e8c88c4878e0e0c24.tar.bz2
Merge "Revert "Track ashmem memory usage in Parcel"" into mnc-dr-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/Parcel.java42
1 files changed, 10 insertions, 32 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 5852f5f..1273772 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -16,7 +16,6 @@
package android.os;
-import android.annotation.IntegerRes;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -43,8 +42,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import dalvik.system.VMRuntime;
-
/**
* Container for a message (data and object references) that can
* be sent through an IBinder. A Parcel can contain both flattened data
@@ -196,7 +193,6 @@ public final class Parcel {
* indicating that we're responsible for its lifecycle.
*/
private boolean mOwnsNativeParcelObject;
- private long mNativeSize;
private RuntimeException mStack;
@@ -248,7 +244,7 @@ public final class Parcel {
private static native int nativeDataAvail(long nativePtr);
private static native int nativeDataPosition(long nativePtr);
private static native int nativeDataCapacity(long nativePtr);
- private static native long nativeSetDataSize(long nativePtr, int size);
+ private static native void nativeSetDataSize(long nativePtr, int size);
private static native void nativeSetDataPosition(long nativePtr, int pos);
private static native void nativeSetDataCapacity(long nativePtr, int size);
@@ -263,7 +259,7 @@ public final class Parcel {
private static native void nativeWriteDouble(long nativePtr, double val);
private static native void nativeWriteString(long nativePtr, String val);
private static native void nativeWriteStrongBinder(long nativePtr, IBinder val);
- private static native long nativeWriteFileDescriptor(long nativePtr, FileDescriptor val);
+ private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val);
private static native byte[] nativeCreateByteArray(long nativePtr);
private static native byte[] nativeReadBlob(long nativePtr);
@@ -276,13 +272,13 @@ public final class Parcel {
private static native FileDescriptor nativeReadFileDescriptor(long nativePtr);
private static native long nativeCreate();
- private static native long nativeFreeBuffer(long nativePtr);
+ private static native void nativeFreeBuffer(long nativePtr);
private static native void nativeDestroy(long nativePtr);
private static native byte[] nativeMarshall(long nativePtr);
- private static native long nativeUnmarshall(
+ private static native void nativeUnmarshall(
long nativePtr, byte[] data, int offset, int length);
- private static native long nativeAppendFrom(
+ private static native void nativeAppendFrom(
long thisNativePtr, long otherNativePtr, int offset, int length);
private static native boolean nativeHasFileDescriptors(long nativePtr);
private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName);
@@ -394,7 +390,7 @@ public final class Parcel {
* @param size The new number of bytes in the Parcel.
*/
public final void setDataSize(int size) {
- updateNativeSize(nativeSetDataSize(mNativePtr, size));
+ nativeSetDataSize(mNativePtr, size);
}
/**
@@ -446,11 +442,11 @@ public final class Parcel {
* Set the bytes in data to be the raw bytes of this Parcel.
*/
public final void unmarshall(byte[] data, int offset, int length) {
- updateNativeSize(nativeUnmarshall(mNativePtr, data, offset, length));
+ nativeUnmarshall(mNativePtr, data, offset, length);
}
public final void appendFrom(Parcel parcel, int offset, int length) {
- updateNativeSize(nativeAppendFrom(mNativePtr, parcel.mNativePtr, offset, length));
+ nativeAppendFrom(mNativePtr, parcel.mNativePtr, offset, length);
}
/**
@@ -603,24 +599,7 @@ public final class Parcel {
* if {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE} is set.</p>
*/
public final void writeFileDescriptor(FileDescriptor val) {
- updateNativeSize(nativeWriteFileDescriptor(mNativePtr, val));
- }
-
- private void updateNativeSize(long newNativeSize) {
- if (mOwnsNativeParcelObject) {
- if (newNativeSize > Integer.MAX_VALUE) {
- newNativeSize = Integer.MAX_VALUE;
- }
- if (newNativeSize != mNativeSize) {
- int delta = (int) (newNativeSize - mNativeSize);
- if (delta > 0) {
- VMRuntime.getRuntime().registerNativeAllocation(delta);
- } else {
- VMRuntime.getRuntime().registerNativeFree(-delta);
- }
- mNativeSize = newNativeSize;
- }
- }
+ nativeWriteFileDescriptor(mNativePtr, val);
}
/**
@@ -2566,7 +2545,7 @@ public final class Parcel {
private void freeBuffer() {
if (mOwnsNativeParcelObject) {
- updateNativeSize(nativeFreeBuffer(mNativePtr));
+ nativeFreeBuffer(mNativePtr);
}
}
@@ -2574,7 +2553,6 @@ public final class Parcel {
if (mNativePtr != 0) {
if (mOwnsNativeParcelObject) {
nativeDestroy(mNativePtr);
- updateNativeSize(0);
}
mNativePtr = 0;
}