예제 #1
0
 // from Parcelable
 @Override
 public void writeToParcel(Parcel out, int flags) {
   if (mRelroFd >= 0) {
     out.writeLong(mLoadAddress);
     out.writeLong(mLoadSize);
     out.writeLong(mRelroStart);
     out.writeLong(mRelroSize);
     try {
       ParcelFileDescriptor fd = ParcelFileDescriptor.fromFd(mRelroFd);
       fd.writeToParcel(out, 0);
       fd.close();
     } catch (java.io.IOException e) {
       Log.e(TAG, "Cant' write LibInfo file descriptor to parcel", e);
     }
   }
 }
예제 #2
0
 @CalledByNative
 private static FileDescriptorInfo makeFdInfo(
     int id, int fd, boolean autoClose, long offset, long size) {
   ParcelFileDescriptor pFd;
   if (autoClose) {
     // Adopt the FD, it will be closed when we close the ParcelFileDescriptor.
     pFd = ParcelFileDescriptor.adoptFd(fd);
   } else {
     try {
       pFd = ParcelFileDescriptor.fromFd(fd);
     } catch (IOException e) {
       Log.e(TAG, "Invalid FD provided for process connection, aborting connection.", e);
       return null;
     }
   }
   return new FileDescriptorInfo(id, pFd, offset, size);
 }