Address comments on commit 498944

Bug 15779911

Change-Id: I68ea7be682696efb40ff3bfc0ac615466402c8db
diff --git a/src/com/android/providers/contacts/util/UserUtils.java b/src/com/android/providers/contacts/util/UserUtils.java
index 9576727..e593d73 100644
--- a/src/com/android/providers/contacts/util/UserUtils.java
+++ b/src/com/android/providers/contacts/util/UserUtils.java
@@ -41,21 +41,17 @@
     /**
      * @return the user ID of the corp user that is linked to the current user, if any.
      * If there's no such user or cross-user contacts access is disallowed by policy, returns -1.
-     *
-     * STOPSHIP: Have amith look at it.
      */
     public static int getCorpUserId(Context context) {
         final UserManager um = getUserManager(context);
-        final int currentUser = um.getUserHandle();
+        final int myUser = um.getUserHandle();
 
-        // STOPSHIP Check the policy and make sure cross-user contacts lookup is allowed.
+        // STOPSHIP Check the policy and make sure cross-user contacts lookup is allowed. b/16301261
 
         if (VERBOSE_LOGGING) {
-            Log.v(TAG, "getCorpUserId: current=" + currentUser);
+            Log.v(TAG, "getCorpUserId: myUser=" + myUser);
         }
 
-        // TODO: Skip if the current is not the primary user?
-
         // Check each user.
         for (UserInfo ui : um.getUsers()) {
             if (!ui.isManagedProfile()) {
@@ -66,7 +62,7 @@
                 continue; // No parent.
             }
             // Check if it's linked to the current user.
-            if (um.getProfileParent(ui.id).id == currentUser) {
+            if (parent.id == myUser) {
                 if (VERBOSE_LOGGING) {
                     Log.v(TAG, "Corp user=" + ui.id);
                 }