diff options
author | Kenny Guy <kennyguy@google.com> | 2015-01-26 16:03:07 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-26 16:03:07 +0000 |
commit | b5e3a4c81b60a9db2174b0a4c24cff6606a82392 (patch) | |
tree | 1efd6375e82e757d7d4b612912ccc695d7abe7a3 | |
parent | 2c919c4e3a4bf1841f7f11855df44f7663bbbd92 (diff) | |
parent | abaa423fa15f00b07b9c92c16ee186c909cac145 (diff) | |
download | packages_providers_ContactsProvider-b5e3a4c81b60a9db2174b0a4c24cff6606a82392.zip packages_providers_ContactsProvider-b5e3a4c81b60a9db2174b0a4c24cff6606a82392.tar.gz packages_providers_ContactsProvider-b5e3a4c81b60a9db2174b0a4c24cff6606a82392.tar.bz2 |
am abaa423f: Fix cross profile caller id to use manager profiles userid.
* commit 'abaa423fa15f00b07b9c92c16ee186c909cac145':
Fix cross profile caller id to use manager profiles userid.
-rw-r--r-- | src/com/android/providers/contacts/util/UserUtils.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/com/android/providers/contacts/util/UserUtils.java b/src/com/android/providers/contacts/util/UserUtils.java index 0df5a24..74fd2e7 100644 --- a/src/com/android/providers/contacts/util/UserUtils.java +++ b/src/com/android/providers/contacts/util/UserUtils.java @@ -61,16 +61,6 @@ public final class UserUtils { Log.v(TAG, "getCorpUserId: myUser=" + myUser); } - // TODO DevicePolicyManager is not mockable -- the constructor is private. - // Test it somehow. - if (getDevicePolicyManager(context) - .getCrossProfileCallerIdDisabled(new UserHandle(myUser))) { - if (VERBOSE_LOGGING) { - Log.v(TAG, "Enterprise caller-id disabled."); - } - return -1; - } - // Check each user. for (UserInfo ui : um.getUsers()) { if (!ui.isManagedProfile()) { @@ -82,10 +72,21 @@ public final class UserUtils { } // Check if it's linked to the current user. if (parent.id == myUser) { - if (VERBOSE_LOGGING) { - Log.v(TAG, "Corp user=" + ui.id); + // Check if profile is blocking calling id. + // TODO DevicePolicyManager is not mockable -- the constructor is private. + // Test it somehow. + if (getDevicePolicyManager(context) + .getCrossProfileCallerIdDisabled(ui.getUserHandle())) { + if (VERBOSE_LOGGING) { + Log.v(TAG, "Enterprise caller-id disabled for user " + ui.id); + } + return -1; + } else { + if (VERBOSE_LOGGING) { + Log.v(TAG, "Corp user=" + ui.id); + } + return ui.id; } - return ui.id; } } if (VERBOSE_LOGGING) { |