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

Commit f7d8df19 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Don't crash in AccountManagerService if a uid has no packages

PackageManagerService.getPackagesForUid() may return null

BUG:31544109
Change-Id: I8ce45b5462154ac53cf5930e1889cf5d2fa486f4
parent 682ad3b4
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -928,6 +928,7 @@ public class AccountManagerService
        String interestedPackages = null;
        try {
            String[] allPackages = mPackageManager.getPackagesForUid(uid);
            if (allPackages != null) {
                for(String aPackage : allPackages) {
                    ApplicationInfo ai = mPackageManager.getApplicationInfo(aPackage,
                            PackageManager.GET_META_DATA);
@@ -937,6 +938,7 @@ public class AccountManagerService
                    }
                    interestedPackages = b.getString("android.accounts.SupportedLoginTypes");
                }
            }
        } catch (PackageManager.NameNotFoundException e) {
            Log.d("NameNotFoundException", e.getMessage());
        }