diff options
| author | Kenny Root <kroot@google.com> | 2012-05-09 09:14:28 -0700 |
|---|---|---|
| committer | Kenny Root <kroot@google.com> | 2012-05-09 09:14:30 -0700 |
| commit | 07ba2ae327dbf209da5bafee9cdcb40e03e29d58 (patch) | |
| tree | 70e575e5ab933174d620a664b00e36ac8b274189 /core/java | |
| parent | 2f4b10e2d4320db490b03eb198ce034302ef00fc (diff) | |
Throw RemoteException when MountService is not yet up
Instead of throwing NullPointerException when getMountService() returns
null, simply throw RemoteException so the code calling getMountService()
can fail gracefully.
Bug: 6461657
Change-Id: Ibefc17de3e0024eb73bbd24914759c0a404f538e
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/content/PackageHelper.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java index 48ed5613e385..246b0c960fd6 100644 --- a/core/java/com/android/internal/content/PackageHelper.java +++ b/core/java/com/android/internal/content/PackageHelper.java @@ -57,25 +57,25 @@ public class PackageHelper { public static final int APP_INSTALL_INTERNAL = 1; public static final int APP_INSTALL_EXTERNAL = 2; - public static IMountService getMountService() { + public static IMountService getMountService() throws RemoteException { IBinder service = ServiceManager.getService("mount"); if (service != null) { return IMountService.Stub.asInterface(service); } else { Log.e(TAG, "Can't get mount service"); + throw new RemoteException("Could not contact mount service"); } - return null; } public static String createSdDir(int sizeMb, String cid, String sdEncKey, int uid, boolean isExternal) { // Create mount point via MountService - IMountService mountService = getMountService(); + try { + IMountService mountService = getMountService(); - if (localLOGV) - Log.i(TAG, "Size of container " + sizeMb + " MB"); + if (localLOGV) + Log.i(TAG, "Size of container " + sizeMb + " MB"); - try { int rc = mountService.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid, isExternal); if (rc != StorageResultCode.OperationSucceeded) { |
