diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2014-01-22 16:00:20 +0000 |
---|---|---|
committer | David Butcher <david.butcher@arm.com> | 2014-01-23 16:25:19 +0000 |
commit | 8ab665dda40ab10e60fc69392022171f454af530 (patch) | |
tree | 31c33947ff99a921cb19beec7f1bbf03bcc17a29 /core/java/android | |
parent | 407f74f494e5374d9bdceae9d9fb453aa8270f6b (diff) | |
download | frameworks_base-8ab665dda40ab10e60fc69392022171f454af530.zip frameworks_base-8ab665dda40ab10e60fc69392022171f454af530.tar.gz frameworks_base-8ab665dda40ab10e60fc69392022171f454af530.tar.bz2 |
AArch64: Make Binder and Parcel 64-bit compatible
Changes include
[x] Long is used to store native pointers
[x] Added new method obtain(long obj) to Parcel. Binder
uses this method instead of obtain(int obj).
[x] obtain(int) has been changed to throw unsupported
operation exception.
Change-Id: I408e0f2a24deb28c9277d86670653a51eb314266
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/os/Binder.java | 8 | ||||
-rw-r--r-- | core/java/android/os/Parcel.java | 89 |
2 files changed, 51 insertions, 46 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index f4a8391..ba71605 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -56,7 +56,7 @@ public class Binder implements IBinder { private static String sDumpDisabled = null; /* mObject is used by native code, do not remove or rename */ - private int mObject; + private long mObject; private IInterface mOwner; private String mDescriptor; @@ -390,7 +390,7 @@ public class Binder implements IBinder { private native final void destroy(); // Entry point from android_util_Binder.cpp's onTransact - private boolean execTransact(int code, int dataObj, int replyObj, + private boolean execTransact(int code, long dataObj, long replyObj, int flags) { Parcel data = Parcel.obtain(dataObj); Parcel reply = Parcel.obtain(replyObj); @@ -499,6 +499,6 @@ final class BinderProxy implements IBinder { } final private WeakReference mSelf; - private int mObject; - private int mOrgue; + private long mObject; + private long mOrgue; } diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 94b9617..6716098 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -182,7 +182,7 @@ public final class Parcel { private static final String TAG = "Parcel"; @SuppressWarnings({"UnusedDeclaration"}) - private int mNativePtr; // used by native code + private long mNativePtr; // used by native code /** * Flag indicating if {@link #mNativePtr} was allocated by this object, @@ -232,47 +232,47 @@ public final class Parcel { private static final int EX_NETWORK_MAIN_THREAD = -6; private static final int EX_HAS_REPLY_HEADER = -128; // special; see below - private static native int nativeDataSize(int nativePtr); - private static native int nativeDataAvail(int nativePtr); - private static native int nativeDataPosition(int nativePtr); - private static native int nativeDataCapacity(int nativePtr); - private static native void nativeSetDataSize(int nativePtr, int size); - private static native void nativeSetDataPosition(int nativePtr, int pos); - private static native void nativeSetDataCapacity(int nativePtr, int size); - - private static native boolean nativePushAllowFds(int nativePtr, boolean allowFds); - private static native void nativeRestoreAllowFds(int nativePtr, boolean lastValue); - - private static native void nativeWriteByteArray(int nativePtr, byte[] b, int offset, int len); - private static native void nativeWriteInt(int nativePtr, int val); - private static native void nativeWriteLong(int nativePtr, long val); - private static native void nativeWriteFloat(int nativePtr, float val); - private static native void nativeWriteDouble(int nativePtr, double val); - private static native void nativeWriteString(int nativePtr, String val); - private static native void nativeWriteStrongBinder(int nativePtr, IBinder val); - private static native void nativeWriteFileDescriptor(int nativePtr, FileDescriptor val); - - private static native byte[] nativeCreateByteArray(int nativePtr); - private static native int nativeReadInt(int nativePtr); - private static native long nativeReadLong(int nativePtr); - private static native float nativeReadFloat(int nativePtr); - private static native double nativeReadDouble(int nativePtr); - private static native String nativeReadString(int nativePtr); - private static native IBinder nativeReadStrongBinder(int nativePtr); - private static native FileDescriptor nativeReadFileDescriptor(int nativePtr); - - private static native int nativeCreate(); - private static native void nativeFreeBuffer(int nativePtr); - private static native void nativeDestroy(int nativePtr); - - private static native byte[] nativeMarshall(int nativePtr); + private static native int nativeDataSize(long nativePtr); + private static native int nativeDataAvail(long nativePtr); + private static native int nativeDataPosition(long nativePtr); + private static native int nativeDataCapacity(long nativePtr); + 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); + + private static native boolean nativePushAllowFds(long nativePtr, boolean allowFds); + private static native void nativeRestoreAllowFds(long nativePtr, boolean lastValue); + + private static native void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len); + private static native void nativeWriteInt(long nativePtr, int val); + private static native void nativeWriteLong(long nativePtr, long val); + private static native void nativeWriteFloat(long nativePtr, float val); + 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 void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val); + + private static native byte[] nativeCreateByteArray(long nativePtr); + private static native int nativeReadInt(long nativePtr); + private static native long nativeReadLong(long nativePtr); + private static native float nativeReadFloat(long nativePtr); + private static native double nativeReadDouble(long nativePtr); + private static native String nativeReadString(long nativePtr); + private static native IBinder nativeReadStrongBinder(long nativePtr); + private static native FileDescriptor nativeReadFileDescriptor(long nativePtr); + + private static native long nativeCreate(); + private static native void nativeFreeBuffer(long nativePtr); + private static native void nativeDestroy(long nativePtr); + + private static native byte[] nativeMarshall(long nativePtr); private static native void nativeUnmarshall( - int nativePtr, byte[] data, int offest, int length); + long nativePtr, byte[] data, int offest, int length); private static native void nativeAppendFrom( - int thisNativePtr, int otherNativePtr, int offset, int length); - private static native boolean nativeHasFileDescriptors(int nativePtr); - private static native void nativeWriteInterfaceToken(int nativePtr, String interfaceName); - private static native void nativeEnforceInterface(int nativePtr, String interfaceName); + long thisNativePtr, long otherNativePtr, int offset, int length); + private static native boolean nativeHasFileDescriptors(long nativePtr); + private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName); + private static native void nativeEnforceInterface(long nativePtr, String interfaceName); public final static Parcelable.Creator<String> STRING_CREATOR = new Parcelable.Creator<String>() { @@ -2229,6 +2229,11 @@ public final class Parcel { mCreators = new HashMap<ClassLoader,HashMap<String,Parcelable.Creator>>(); static protected final Parcel obtain(int obj) { + throw new UnsupportedOperationException(); + } + + /** @hide */ + static protected final Parcel obtain(long obj) { final Parcel[] pool = sHolderPool; synchronized (pool) { Parcel p; @@ -2247,7 +2252,7 @@ public final class Parcel { return new Parcel(obj); } - private Parcel(int nativePtr) { + private Parcel(long nativePtr) { if (DEBUG_RECYCLE) { mStack = new RuntimeException(); } @@ -2255,7 +2260,7 @@ public final class Parcel { init(nativePtr); } - private void init(int nativePtr) { + private void init(long nativePtr) { if (nativePtr != 0) { mNativePtr = nativePtr; mOwnsNativeParcelObject = false; |