DO NOT MERGE: Don't throw RuntimeException in user dir delegations.

Bug: 25374338
Change-Id: I3b56d33292c0c0d7c6e4ac75c5ce37b1659de8ba
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 5e67414..1bbc186 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -2612,11 +2612,10 @@
                     + event.getMessage();
                 Slog.e(TAG,  error);
                 // ext4enc:TODO is this the right exception?
-                throw new RuntimeException(error);
+                throw new NativeDaemonConnectorException(error);
             }
         } catch (NativeDaemonConnectorException e) {
-            Slog.e(TAG, "createnewuserdir threw exception", e);
-            throw new RuntimeException("createnewuserdir threw exception", e);
+            throw e.rethrowAsParcelableException();
         }
     }
 
@@ -2641,11 +2640,10 @@
                     + event.getMessage();
                 Slog.e(TAG,  error);
                 // ext4enc:TODO is this the right exception?
-                throw new RuntimeException(error);
+                throw new NativeDaemonConnectorException(error);
             }
         } catch (NativeDaemonConnectorException e) {
-            Slog.e(TAG, "deleteuserkey threw exception", e);
-            throw new RuntimeException("deleteuserkey threw exception", e);
+            throw e.rethrowAsParcelableException();
         }
     }
 
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 06c3682..adfeda0 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -1901,10 +1901,15 @@
      * Create new {@code /data/user/[id]} directory and sets default
      * permissions.
      */
-    public static void prepareUserDirectory(Context context, String volumeUuid, int userId) {
+    public static void prepareUserDirectory(Context context, String volumeUuid, int userId)
+            throws IOException {
         final StorageManager storage = context.getSystemService(StorageManager.class);
         final File userDir = Environment.getDataUserDirectory(volumeUuid, userId);
-        storage.createNewUserDir(userId, userDir);
+        try {
+            storage.createNewUserDir(userId, userDir);
+        } catch (IllegalStateException e) {
+            throw new IOException(e);
+        }
     }
 
     /**