Loading api/current.xml +22 −0 Original line number Diff line number Diff line Loading @@ -149702,6 +149702,17 @@ visibility="public" > </method> <method name="detachFd" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="fromSocket" return="android.os.ParcelFileDescriptor" abstract="false" Loading @@ -149715,6 +149726,17 @@ <parameter name="socket" type="java.net.Socket"> </parameter> </method> <method name="getFd" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getFileDescriptor" return="java.io.FileDescriptor" abstract="false" core/java/android/os/Parcel.java +1 −0 Original line number Diff line number Diff line Loading @@ -1385,6 +1385,7 @@ public final class Parcel { int mode) throws FileNotFoundException; /*package*/ static native void closeFileDescriptor(FileDescriptor desc) throws IOException; /*package*/ static native void clearFileDescriptor(FileDescriptor desc); /** * Read a byte value from the parcel at the current dataPosition(). Loading core/java/android/os/ParcelFileDescriptor.java +34 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,40 @@ public class ParcelFileDescriptor implements Parcelable { */ public native long seekTo(long pos); /** * Return the native fd int for this ParcelFileDescriptor. The * ParcelFileDescriptor still owns the fd, and it still must be closed * through this API. */ public int getFd() { if (mClosed) { throw new IllegalStateException("Already closed"); } return getFdNative(); } private native int getFdNative(); /** * Return the native fd int for this ParcelFileDescriptor and detach it * from the object here. You are now responsible for closing the fd in * native code. */ public int detachFd() { if (mClosed) { throw new IllegalStateException("Already closed"); } if (mParcelDescriptor != null) { int fd = mParcelDescriptor.detachFd(); mClosed = true; return fd; } int fd = getFd(); mClosed = true; Parcel.clearFileDescriptor(mFileDescriptor); return fd; } /** * Close the ParcelFileDescriptor. This implementation closes the underlying * OS resources allocated to represent this stream. Loading core/jni/android_os_ParcelFileDescriptor.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,17 @@ static jlong android_os_ParcelFileDescriptor_seekTo(JNIEnv* env, return lseek(fd, pos, SEEK_SET); } static jlong android_os_ParcelFileDescriptor_getFdNative(JNIEnv* env, jobject clazz) { jint fd = getFd(env, clazz); if (fd < 0) { jniThrowException(env, "java/lang/IllegalArgumentException", "bad file descriptor"); return -1; } return fd; } static const JNINativeMethod gParcelFileDescriptorMethods[] = { {"getFileDescriptorFromSocket", "(Ljava/net/Socket;)Ljava/io/FileDescriptor;", (void*)android_os_ParcelFileDescriptor_getFileDescriptorFromSocket}, Loading @@ -134,7 +145,9 @@ static const JNINativeMethod gParcelFileDescriptorMethods[] = { {"getStatSize", "()J", (void*)android_os_ParcelFileDescriptor_getStatSize}, {"seekTo", "(J)J", (void*)android_os_ParcelFileDescriptor_seekTo} (void*)android_os_ParcelFileDescriptor_seekTo}, {"getFdNative", "()I", (void*)android_os_ParcelFileDescriptor_getFdNative} }; const char* const kParcelFileDescriptorPathName = "android/os/ParcelFileDescriptor"; Loading core/jni/android_util_Binder.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1520,6 +1520,14 @@ static void android_os_Parcel_closeFileDescriptor(JNIEnv* env, jobject clazz, jo } } static void android_os_Parcel_clearFileDescriptor(JNIEnv* env, jobject clazz, jobject object) { int fd = env->GetIntField(object, gFileDescriptorOffsets.mDescriptor); if (fd >= 0) { env->SetIntField(object, gFileDescriptorOffsets.mDescriptor, -1); } } static void android_os_Parcel_freeBuffer(JNIEnv* env, jobject clazz) { int32_t own = env->GetIntField(clazz, gParcelOffsets.mOwnObject); Loading Loading @@ -1719,6 +1727,7 @@ static const JNINativeMethod gParcelMethods[] = { {"internalReadFileDescriptor", "()Ljava/io/FileDescriptor;", (void*)android_os_Parcel_readFileDescriptor}, {"openFileDescriptor", "(Ljava/lang/String;I)Ljava/io/FileDescriptor;", (void*)android_os_Parcel_openFileDescriptor}, {"closeFileDescriptor", "(Ljava/io/FileDescriptor;)V", (void*)android_os_Parcel_closeFileDescriptor}, {"clearFileDescriptor", "(Ljava/io/FileDescriptor;)V", (void*)android_os_Parcel_clearFileDescriptor}, {"freeBuffer", "()V", (void*)android_os_Parcel_freeBuffer}, {"init", "(I)V", (void*)android_os_Parcel_init}, {"destroy", "()V", (void*)android_os_Parcel_destroy}, Loading Loading
api/current.xml +22 −0 Original line number Diff line number Diff line Loading @@ -149702,6 +149702,17 @@ visibility="public" > </method> <method name="detachFd" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="fromSocket" return="android.os.ParcelFileDescriptor" abstract="false" Loading @@ -149715,6 +149726,17 @@ <parameter name="socket" type="java.net.Socket"> </parameter> </method> <method name="getFd" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getFileDescriptor" return="java.io.FileDescriptor" abstract="false"
core/java/android/os/Parcel.java +1 −0 Original line number Diff line number Diff line Loading @@ -1385,6 +1385,7 @@ public final class Parcel { int mode) throws FileNotFoundException; /*package*/ static native void closeFileDescriptor(FileDescriptor desc) throws IOException; /*package*/ static native void clearFileDescriptor(FileDescriptor desc); /** * Read a byte value from the parcel at the current dataPosition(). Loading
core/java/android/os/ParcelFileDescriptor.java +34 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,40 @@ public class ParcelFileDescriptor implements Parcelable { */ public native long seekTo(long pos); /** * Return the native fd int for this ParcelFileDescriptor. The * ParcelFileDescriptor still owns the fd, and it still must be closed * through this API. */ public int getFd() { if (mClosed) { throw new IllegalStateException("Already closed"); } return getFdNative(); } private native int getFdNative(); /** * Return the native fd int for this ParcelFileDescriptor and detach it * from the object here. You are now responsible for closing the fd in * native code. */ public int detachFd() { if (mClosed) { throw new IllegalStateException("Already closed"); } if (mParcelDescriptor != null) { int fd = mParcelDescriptor.detachFd(); mClosed = true; return fd; } int fd = getFd(); mClosed = true; Parcel.clearFileDescriptor(mFileDescriptor); return fd; } /** * Close the ParcelFileDescriptor. This implementation closes the underlying * OS resources allocated to represent this stream. Loading
core/jni/android_os_ParcelFileDescriptor.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,17 @@ static jlong android_os_ParcelFileDescriptor_seekTo(JNIEnv* env, return lseek(fd, pos, SEEK_SET); } static jlong android_os_ParcelFileDescriptor_getFdNative(JNIEnv* env, jobject clazz) { jint fd = getFd(env, clazz); if (fd < 0) { jniThrowException(env, "java/lang/IllegalArgumentException", "bad file descriptor"); return -1; } return fd; } static const JNINativeMethod gParcelFileDescriptorMethods[] = { {"getFileDescriptorFromSocket", "(Ljava/net/Socket;)Ljava/io/FileDescriptor;", (void*)android_os_ParcelFileDescriptor_getFileDescriptorFromSocket}, Loading @@ -134,7 +145,9 @@ static const JNINativeMethod gParcelFileDescriptorMethods[] = { {"getStatSize", "()J", (void*)android_os_ParcelFileDescriptor_getStatSize}, {"seekTo", "(J)J", (void*)android_os_ParcelFileDescriptor_seekTo} (void*)android_os_ParcelFileDescriptor_seekTo}, {"getFdNative", "()I", (void*)android_os_ParcelFileDescriptor_getFdNative} }; const char* const kParcelFileDescriptorPathName = "android/os/ParcelFileDescriptor"; Loading
core/jni/android_util_Binder.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1520,6 +1520,14 @@ static void android_os_Parcel_closeFileDescriptor(JNIEnv* env, jobject clazz, jo } } static void android_os_Parcel_clearFileDescriptor(JNIEnv* env, jobject clazz, jobject object) { int fd = env->GetIntField(object, gFileDescriptorOffsets.mDescriptor); if (fd >= 0) { env->SetIntField(object, gFileDescriptorOffsets.mDescriptor, -1); } } static void android_os_Parcel_freeBuffer(JNIEnv* env, jobject clazz) { int32_t own = env->GetIntField(clazz, gParcelOffsets.mOwnObject); Loading Loading @@ -1719,6 +1727,7 @@ static const JNINativeMethod gParcelMethods[] = { {"internalReadFileDescriptor", "()Ljava/io/FileDescriptor;", (void*)android_os_Parcel_readFileDescriptor}, {"openFileDescriptor", "(Ljava/lang/String;I)Ljava/io/FileDescriptor;", (void*)android_os_Parcel_openFileDescriptor}, {"closeFileDescriptor", "(Ljava/io/FileDescriptor;)V", (void*)android_os_Parcel_closeFileDescriptor}, {"clearFileDescriptor", "(Ljava/io/FileDescriptor;)V", (void*)android_os_Parcel_clearFileDescriptor}, {"freeBuffer", "()V", (void*)android_os_Parcel_freeBuffer}, {"init", "(I)V", (void*)android_os_Parcel_init}, {"destroy", "()V", (void*)android_os_Parcel_destroy}, Loading