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

Commit 471817fa authored by Dario Freni's avatar Dario Freni Committed by Todd Kennedy
Browse files

Don't throw a runtime exception in getPackageInfo.

If the input is invalid, we need to just return null, otherwise we'll
make PackageManager crash.

Bug: 123676932
Fix: 123878869
Test: used a small app to query the API, reproduce the bug and
verified that the new code fixes it.

Change-Id: Icefb108cc95ec01e36021a5259c59dabdc24c4d6
parent 49b56314
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3941,13 +3941,13 @@ public class PackageManagerService extends IPackageManager.Stub
                if (apex != null) {
                    try {
                        final ApexInfo activePkg = apex.getActivePackage(packageName);
                        if (activePkg != null) {
                        if (activePkg != null && !TextUtils.isEmpty(activePkg.packagePath)) {
                            try {
                                return PackageParser.generatePackageInfoFromApex(
                                        new File(activePkg.packagePath), true /* collect certs */);
                            } catch (PackageParserException pe) {
                                throw new IllegalStateException("Unable to parse: " + activePkg,
                                        pe);
                                Log.e(TAG, "Unable to parse package at "
                                        + activePkg.packagePath, pe);
                            }
                        }
                    } catch (RemoteException e) {