From 7b3ea13b177ca92f02a98fe0e1bea67b60abd084 Mon Sep 17 00:00:00 2001 From: Dmitry Dementyev Date: Wed, 10 May 2017 12:45:02 -0700 Subject: [PATCH] Don't request account access for apps if it is explictly made not visible to them. Test: manual. Bug: 38190080 Change-Id: Ifc9023cb37f05f29a2d2076dcff75b710efb6276 --- .../com/android/server/accounts/AccountManagerService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 03da5b21fef8b..9d2b86cf7fd54 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -5922,6 +5922,13 @@ public class AccountManagerService return; } + int visibility = + resolveAccountVisibility(account, packageName, getUserAccounts(userId)); + if (visibility == AccountManager.VISIBILITY_NOT_VISIBLE) { + Slog.w(TAG, "requestAccountAccess: account is hidden"); + return; + } + if (AccountManagerService.this.hasAccountAccess(account, packageName, new UserHandle(userId))) { Bundle result = new Bundle();