diff options
| -rw-r--r-- | core/java/android/os/SharedMemory.java | 17 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/content/ContentResolverTest.java | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index d008034f633b..cba4423831a2 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -25,8 +25,6 @@ import android.system.OsConstants; import dalvik.system.VMRuntime; -import libcore.io.IoUtils; - import java.io.Closeable; import java.io.FileDescriptor; import java.io.IOException; @@ -65,7 +63,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor, mMemoryRegistration)); + new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** @@ -328,20 +326,21 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - private FileDescriptor mFd; + private int mFd; private MemoryRegistration mMemoryReference; - private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { + private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; - IoUtils.setFdOwner(mFd, this); mMemoryReference = memoryReference; } @Override public void run() { - IoUtils.closeQuietly(mFd); - mFd = null; - + try { + FileDescriptor fd = new FileDescriptor(); + fd.setInt$(mFd); + Os.close(fd); + } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; } diff --git a/core/tests/coretests/src/android/content/ContentResolverTest.java b/core/tests/coretests/src/android/content/ContentResolverTest.java index c8015d43b404..7b70b412e62b 100644 --- a/core/tests/coretests/src/android/content/ContentResolverTest.java +++ b/core/tests/coretests/src/android/content/ContentResolverTest.java @@ -87,7 +87,7 @@ public class ContentResolverTest { bitmap.compress(Bitmap.CompressFormat.PNG, 90, mImage.getOutputStream()); final AssetFileDescriptor afd = new AssetFileDescriptor( - ParcelFileDescriptor.dup(mImage.getFileDescriptor()), 0, mSize, null); + new ParcelFileDescriptor(mImage.getFileDescriptor()), 0, mSize, null); when(mProvider.openTypedAssetFile(any(), any(), any(), any(), any())).thenReturn( afd); } |