Revert "SharedMemory: break Cleaner reference cycle."
Bug: 138422309

This reverts commit 390d9e6a1806626eb521d55a36b1578d28714cc8.

Reason for revert: crashes documented in b/138422309

Change-Id: I235f727d0fe87c09f6f05dddcae7759bab64dfd8
(cherry picked from commit b16411f83aee0847fec77d79fb4e98b2e3fa8828)
diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java
index 3e2ba3d..57a8801 100644
--- a/core/java/android/os/SharedMemory.java
+++ b/core/java/android/os/SharedMemory.java
@@ -62,7 +62,7 @@
 
         mMemoryRegistration = new MemoryRegistration(mSize);
         mCleaner = Cleaner.create(mFileDescriptor,
-                new Closer(mFileDescriptor.getInt$(), mMemoryRegistration));
+                new Closer(mFileDescriptor, mMemoryRegistration));
     }
 
     /**
@@ -290,10 +290,10 @@
      * Cleaner that closes the FD
      */
     private static final class Closer implements Runnable {
-        private int mFd;
+        private FileDescriptor mFd;
         private MemoryRegistration mMemoryReference;
 
-        private Closer(int fd, MemoryRegistration memoryReference) {
+        private Closer(FileDescriptor fd, MemoryRegistration memoryReference) {
             mFd = fd;
             mMemoryReference = memoryReference;
         }
@@ -301,9 +301,7 @@
         @Override
         public void run() {
             try {
-                FileDescriptor fd = new FileDescriptor();
-                fd.setInt$(mFd);
-                Os.close(fd);
+                Os.close(mFd);
             } catch (ErrnoException e) { /* swallow error */ }
             mMemoryReference.release();
             mMemoryReference = null;