Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f30d97a authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[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
parent 6a7f2787
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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();
        }
+3 −0
Original line number Diff line number Diff line
@@ -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();
        }