Revert "Revert "File{Input,Output}Stream: catch ownership misassignment on construction.""

This reverts commit 38ab76fe3bbc113e2839922710959283e40616fe.

Reason for revert: the crashes in backup and restore were due to the corresponding fix not being merged until after

Bug: http://b/156867945
Bug: http://b/159264419
Change-Id: I301a9ac88cfd8be070c1b35d24eb71f489a76419
Test: atest android.backup.cts.FullBackupLifecycleTest
diff --git a/ojluni/src/main/java/java/io/FileInputStream.java b/ojluni/src/main/java/java/io/FileInputStream.java
index 38230bb..9ce75ff 100755
--- a/ojluni/src/main/java/java/io/FileInputStream.java
+++ b/ojluni/src/main/java/java/io/FileInputStream.java
@@ -222,6 +222,9 @@
         fd.attach(this);
         */
         this.isFdOwner = isFdOwner;
+        if (isFdOwner) {
+            IoUtils.setFdOwner(this.fd, this);
+        }
     }
 
     // BEGIN Android-changed: Open files using IoBridge to share BlockGuard & StrictMode logic.
diff --git a/ojluni/src/main/java/java/io/FileOutputStream.java b/ojluni/src/main/java/java/io/FileOutputStream.java
index d0d0d40..66f4c05 100755
--- a/ojluni/src/main/java/java/io/FileOutputStream.java
+++ b/ojluni/src/main/java/java/io/FileOutputStream.java
@@ -299,6 +299,9 @@
         // Android-changed: FileDescriptor ownership tracking mechanism.
         // fd.attach(this);
         this.isFdOwner = isFdOwner;
+        if (isFdOwner) {
+            IoUtils.setFdOwner(this.fd, this);
+        }
     }
 
     // BEGIN Android-changed: Open files using IoBridge to share BlockGuard & StrictMode logic.