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

Commit 5c0c83f8 authored by Dmitry Dementyev's avatar Dmitry Dementyev Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in getAuthToken."

parents 386dfed0 2cfba50f
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,