diff options
| author | 2024-05-24 16:41:16 +0000 | |
|---|---|---|
| committer | 2024-05-24 18:00:30 +0000 | |
| commit | 9f30d97a8e1833a757938197cb07de297925d25d (patch) | |
| tree | b0dc4b4057bb44668e975e088eba65fc62ebd1b2 | |
| parent | 6a7f27873a0fc815a8a1ad3fa6b93bcf9d3ea897 (diff) | |
[pm] Catch ParcelableException in PackageManager.isAppArchivable
Catches the ParcelableException exception type and rethrows it as a NameNotFoundException. Also improves a few existing APIs to rethrow the ParcelableException as a RuntimeException if it is not one of the expected exception type.
Change-Id: I76f6cc246fca1fe0624429c500015b0cce5ffd40
BUG: 341212469
FIXES: 341212469
Test: builds
| -rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 3 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageInstaller.java | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 287d2bd9e6a7..b38f76ed699f 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -2593,6 +2593,9 @@ public class ApplicationPackageManager extends PackageManager { try { Objects.requireNonNull(packageName); return mPM.isAppArchivable(packageName, new UserHandle(getUserId())); + } catch (ParcelableException e) { + e.maybeRethrow(NameNotFoundException.class); + throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java index 640422359f95..b18c7bef422d 100644 --- a/core/java/android/content/pm/PackageInstaller.java +++ b/core/java/android/content/pm/PackageInstaller.java @@ -2360,6 +2360,7 @@ public class PackageInstaller { new UserHandle(mUserId), flags); } catch (ParcelableException e) { e.maybeRethrow(PackageManager.NameNotFoundException.class); + throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -2396,6 +2397,7 @@ public class PackageInstaller { } catch (ParcelableException e) { e.maybeRethrow(IOException.class); e.maybeRethrow(PackageManager.NameNotFoundException.class); + throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -2427,6 +2429,7 @@ public class PackageInstaller { userActionIntent, new UserHandle(mUserId)); } catch (ParcelableException e) { e.maybeRethrow(PackageManager.NameNotFoundException.class); + throw new RuntimeException(e); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } |