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

Commit 9870b12b authored by sunjian's avatar sunjian Committed by android-build-merger
Browse files

Fix Android O: AccountManager API not working in managed profile.

am: 9ae597b6

Change-Id: Ibae496434676b3f895259bfa4549fa48b08e1a36
parents a3a45977 9ae597b6
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -5289,16 +5289,14 @@ public class AccountManagerService
        long identityToken = Binder.clearCallingIdentity();
        try {
            packages = mPackageManager.getPackagesForUid(callingUid);
        } finally {
            Binder.restoreCallingIdentity(identityToken);
        }
            if (packages == null) {
                Log.d(TAG, "No packages for callingUid " + callingUid);
                return false;
            }
            for (String name : packages) {
                try {
                PackageInfo packageInfo = mPackageManager.getPackageInfo(name, 0 /* flags */);
                    PackageInfo packageInfo =
                        mPackageManager.getPackageInfo(name, 0 /* flags */);
                    if (packageInfo != null
                        && (packageInfo.applicationInfo.privateFlags
                            & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0) {
@@ -5306,9 +5304,11 @@ public class AccountManagerService
                    }
                } catch (PackageManager.NameNotFoundException e) {
                    Log.d(TAG, "Package not found " + e.getMessage());
                return false;
                }
            }
        } finally {
            Binder.restoreCallingIdentity(identityToken);
        }
        return false;
    }