Should check against calling user instead of current user

The bug is introduced in ag/862293.
We should check calling user instead of current user to support work
profile.

BUG: 27313818
Change-Id: I248ed87a71363d9b624013e938391c4fd79977fa
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 9361160..77d9cfe 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -967,7 +967,8 @@
                                     phoneAccountHandle.getComponentName().getPackageName());
                             // Make sure it doesn't cross the UserHandle boundary
                             enforceUserHandleMatchesCaller(phoneAccountHandle);
-                            enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle);
+                            enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle,
+                                    Binder.getCallingUserHandle());
                         }
                         long token = Binder.clearCallingIdentity();
                         try {
@@ -1009,7 +1010,8 @@
 
                         // Make sure it doesn't cross the UserHandle boundary
                         enforceUserHandleMatchesCaller(phoneAccountHandle);
-                        enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle);
+                        enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle,
+                                Binder.getCallingUserHandle());
                         long token = Binder.clearCallingIdentity();
 
                         try {
@@ -1296,9 +1298,10 @@
 
     // Enforce that the PhoneAccountHandle being passed in is both registered to the current user
     // and enabled.
-    private void enforcePhoneAccountIsRegisteredEnabled(PhoneAccountHandle phoneAccountHandle) {
-        PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountOfCurrentUser(
-                phoneAccountHandle);
+    private void enforcePhoneAccountIsRegisteredEnabled(PhoneAccountHandle phoneAccountHandle,
+                                                        UserHandle callingUserHandle) {
+        PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccount(phoneAccountHandle,
+                callingUserHandle);
         if(phoneAccount == null) {
             EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "R");
             throw new SecurityException("This PhoneAccountHandle is not registered for this user!");