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

Commit 2cfba50f authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Fix NPE in getAuthToken.

Bug: 178130980
Test: manual:
Change-Id: Id0eb9e87a7efc9c042ec453677c2c90bfa49d294
parent c7640aa6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2864,14 +2864,15 @@ public class AccountManagerService

        // Get the calling package. We will use it for the purpose of caching.
        final String callerPkg = loginOptions.getString(AccountManager.KEY_ANDROID_PACKAGE_NAME);
        List<String> callerOwnedPackageNames;
        String[] callerOwnedPackageNames;
        final long ident2 = Binder.clearCallingIdentity();
        try {
            callerOwnedPackageNames = Arrays.asList(mPackageManager.getPackagesForUid(callerUid));
            callerOwnedPackageNames = mPackageManager.getPackagesForUid(callerUid);
        } finally {
            Binder.restoreCallingIdentity(ident2);
        }
        if (callerPkg == null || !callerOwnedPackageNames.contains(callerPkg)) {
        if (callerPkg == null || callerOwnedPackageNames == null
                || !ArrayUtils.contains(callerOwnedPackageNames, callerPkg)) {
            String msg = String.format(
                    "Uid %s is attempting to illegally masquerade as package %s!",
                    callerUid,