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

Commit 6e6af8af 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: I4c346731e3b85cce5dd6b6c13b1312c420a60b34
parents d836c4f8 9ae597b6
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -5330,16 +5330,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) {
@@ -5347,9 +5345,11 @@ public class AccountManagerService
                    }
                } catch (PackageManager.NameNotFoundException e) {
                    Log.d(TAG, "Package not found " + e.getMessage());
                return false;
                }
            }
        } finally {
            Binder.restoreCallingIdentity(identityToken);
        }
        return false;
    }