Merge "Check cross user permission before clear calling identity in getSimCallManagerForUser." into sc-dev
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 0037aaf..c873bc4 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -471,11 +471,11 @@
                 try {
                     Log.startSession("TSI.gSCMFU");
                     final int callingUid = Binder.getCallingUid();
+                    if (user != ActivityManager.getCurrentUser()) {
+                        enforceCrossUserPermission(callingUid);
+                    }
                     long token = Binder.clearCallingIdentity();
                     try {
-                        if (user != ActivityManager.getCurrentUser()) {
-                            enforceCrossUserPermission(callingUid);
-                        }
                         return mPhoneAccountRegistrar.getSimCallManager(UserHandle.of(user));
                     } finally {
                         Binder.restoreCallingIdentity(token);