Revert "Add work profile support for registering phone accounts ..."

Revert submission 20281770-telecomWorkProfileAccountRegistration

Reason for revert: As part of a chain of issues that caused b/258831395
Reverted Changes:
I51f8068eb:Add work profile support for registering phone acc...
Iccbf30712:Add work profile support for registering phone acc...

Change-Id: I843bb4c19c3015c4beeb73a64a64d7ee6596883b
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index a4ee836..d0aad4a 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -31,7 +31,6 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.PersistableBundle;
-import android.os.UserHandle;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
 import android.telecom.PhoneAccount;
@@ -703,7 +702,7 @@
     }
 
     public static PhoneAccountHandle makePstnPhoneAccountHandle(String id) {
-        return makePstnPhoneAccountHandleWithPrefix(id, "", false, null);
+        return makePstnPhoneAccountHandleWithPrefix(id, "", false);
     }
 
     public static PhoneAccountHandle makePstnPhoneAccountHandle(int phoneId) {
@@ -711,26 +710,22 @@
     }
 
     public static PhoneAccountHandle makePstnPhoneAccountHandle(Phone phone) {
-        return makePstnPhoneAccountHandleWithPrefix(phone, "", false, null);
+        return makePstnPhoneAccountHandleWithPrefix(phone, "", false);
     }
 
     public static PhoneAccountHandle makePstnPhoneAccountHandleWithPrefix(
-            Phone phone, String prefix, boolean isEmergency, UserHandle userHandle) {
+            Phone phone, String prefix, boolean isEmergency) {
         // TODO: Should use some sort of special hidden flag to decorate this account as
         // an emergency-only account
         String id = isEmergency ? EMERGENCY_ACCOUNT_HANDLE_ID : prefix +
                 String.valueOf(phone.getSubId());
-        return makePstnPhoneAccountHandleWithPrefix(id, prefix, isEmergency, userHandle);
+        return makePstnPhoneAccountHandleWithPrefix(id, prefix, isEmergency);
     }
 
     public static PhoneAccountHandle makePstnPhoneAccountHandleWithPrefix(
-            String id, String prefix, boolean isEmergency, UserHandle userHandle) {
+            String id, String prefix, boolean isEmergency) {
         ComponentName pstnConnectionServiceName = getPstnConnectionServiceName();
-        // If user handle is null, resort to default constructor to use phone process's
-        // user handle
-        return userHandle == null
-                ? new PhoneAccountHandle(pstnConnectionServiceName, id)
-                : new PhoneAccountHandle(pstnConnectionServiceName, id, userHandle);
+        return new PhoneAccountHandle(pstnConnectionServiceName, id);
     }
 
     public static int getSubIdForPhoneAccount(PhoneAccount phoneAccount) {
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index b6aaebe..49e1379 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -387,7 +387,7 @@
 
     private PhoneAccountHandle getEmergencyPhoneAccount() {
         return PhoneUtils.makePstnPhoneAccountHandleWithPrefix(
-                (Phone) null, "" /* prefix */, true /* isEmergency */, null /* userHandle */);
+                (Phone) null, "" /* prefix */, true /* isEmergency */);
     }
 
     public static Intent buildPhoneAccountConfigureIntent(
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 453cb55..8615325 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -403,7 +403,7 @@
         // receives an MT call while in ECM. Use the Emergency PhoneAccount to receive the account
         // if it exists.
         PhoneAccountHandle emergencyHandle =
-                PhoneUtils.makePstnPhoneAccountHandleWithPrefix(mPhone, "", true, null);
+                PhoneUtils.makePstnPhoneAccountHandleWithPrefix(mPhone, "", true);
         if(telecomAccountRegistry.hasAccountEntryForPhoneAccount(emergencyHandle)) {
             Log.i(this, "Receiving MT call in ECM. Using Emergency PhoneAccount Instead.");
             return emergencyHandle;
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index f112d33..115c32b 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -285,19 +285,13 @@
         private PhoneAccount buildPstnPhoneAccount(boolean isEmergency, boolean isTestAccount) {
             String testPrefix = isTestAccount ? "Test " : "";
 
-            // Check if we are registering another user. If we are, ensure that the account
-            // is registered to that user handle.
-            int subId = mPhone.getSubId();
-            UserHandle userToRegister = mSubscriptionManager.isActiveSubscriptionId(subId)
-                    ? mSubscriptionManager.getSubscriptionUserHandle(subId)
-                    : null;
-
             // Build the Phone account handle.
             PhoneAccountHandle phoneAccountHandle =
                     PhoneUtils.makePstnPhoneAccountHandleWithPrefix(
-                            mPhone, testPrefix, isEmergency, userToRegister);
+                            mPhone, testPrefix, isEmergency);
 
             // Populate the phone account data.
+            int subId = mPhone.getSubId();
             String subscriberId = mPhone.getSubscriberId();
             int color = PhoneAccount.NO_HIGHLIGHT_COLOR;
             int slotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
@@ -361,12 +355,8 @@
 
             // By default all SIM phone accounts can place emergency calls.
             int capabilities = PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
-                    PhoneAccount.CAPABILITY_CALL_PROVIDER;
-
-            // This is enabled by default. To support work profiles, it should not be enabled.
-            if (userToRegister == null) {
-                capabilities |= PhoneAccount.CAPABILITY_MULTI_USER;
-            }
+                    PhoneAccount.CAPABILITY_CALL_PROVIDER |
+                    PhoneAccount.CAPABILITY_MULTI_USER;
 
             if (mContext.getResources().getBoolean(R.bool.config_pstnCanPlaceEmergencyCalls)) {
                 capabilities |= PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 5b1f463..da918ad 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -360,8 +360,7 @@
         @Override
         public PhoneAccountHandle makePstnPhoneAccountHandleWithPrefix(Phone phone, String prefix,
                 boolean isEmergency) {
-            return PhoneUtils.makePstnPhoneAccountHandleWithPrefix(
-                    phone, prefix, isEmergency, null);
+            return PhoneUtils.makePstnPhoneAccountHandleWithPrefix(phone, prefix, isEmergency);
         }
     };