summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers
diff options
context:
space:
mode:
authorKenny Guy <kennyguy@google.com>2015-01-23 20:17:09 +0000
committerKenny Guy <kennyguy@google.com>2015-01-23 20:56:47 +0000
commitabaa423fa15f00b07b9c92c16ee186c909cac145 (patch)
tree1efd6375e82e757d7d4b612912ccc695d7abe7a3 /src/com/android/providers
parentbecda5cc4e265ab2cc3fc958e39de08380abd6c3 (diff)
downloadpackages_providers_ContactsProvider-abaa423fa15f00b07b9c92c16ee186c909cac145.zip
packages_providers_ContactsProvider-abaa423fa15f00b07b9c92c16ee186c909cac145.tar.gz
packages_providers_ContactsProvider-abaa423fa15f00b07b9c92c16ee186c909cac145.tar.bz2
Fix cross profile caller id to use manager profiles userid.
Cross profile caller id was checking myUserId when deciding whether to allow caller id from manged profiles where it should have used the managed profiles userid. Bug: 19122752 Change-Id: I230fc933655cd9464d00b619a383ff0682660c12
Diffstat (limited to 'src/com/android/providers')
-rw-r--r--src/com/android/providers/contacts/util/UserUtils.java27
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) {