Update the flag for the fix related to the profile user issues

Bug: 326270861
Test: atest TelecomUnitTests:InCallControllerTests
Change-Id: Ie943bc84010613314dc8ce74a2ce1e2647d80ffe
diff --git a/flags/Android.bp b/flags/Android.bp
index 3497db8..b089796 100644
--- a/flags/Android.bp
+++ b/flags/Android.bp
@@ -39,5 +39,6 @@
         "telecom_bluetoothroutemanager_flags.aconfig",
         "telecom_work_profile_flags.aconfig",
         "telecom_connection_service_wrapper_flags.aconfig",
+        "telecom_profile_user_flags.aconfig",
     ],
 }
diff --git a/flags/telecom_profile_user_flags.aconfig b/flags/telecom_profile_user_flags.aconfig
new file mode 100644
index 0000000..c046de8
--- /dev/null
+++ b/flags/telecom_profile_user_flags.aconfig
@@ -0,0 +1,12 @@
+package: "com.android.server.telecom.flags"
+container: "system"
+
+flag {
+  name: "profile_user_support"
+  namespace: "telecom"
+  description: "Fix issues related to the profile user like private profile"
+  bug: "326270861"
+  metadata {
+    purpose: PURPOSE_BUGFIX
+  }
+}
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 55f48e3..0ec3209 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -104,8 +104,6 @@
     public static final String SET_IN_CALL_ADAPTER_ERROR_MSG =
             "Exception thrown while setting the in-call adapter.";
 
-    private final com.android.internal.telephony.flags.FeatureFlags mTelephonyFeatureFlags;
-
     @VisibleForTesting
     public void setAnomalyReporterAdapter(AnomalyReporterAdapter mAnomalyReporterAdapter){
         mAnomalyReporter = mAnomalyReporterAdapter;
@@ -1296,12 +1294,6 @@
         userAddedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
         mContext.registerReceiver(mUserAddedReceiver, userAddedFilter);
         mFeatureFlags = featureFlags;
-        if (telephonyFeatureFlags != null) {
-            mTelephonyFeatureFlags = telephonyFeatureFlags;
-        } else {
-            mTelephonyFeatureFlags =
-                    new com.android.internal.telephony.flags.FeatureFlagsImpl();
-        }
     }
 
     private void restrictPhoneCallOps() {
@@ -2030,9 +2022,9 @@
     public void bindToServices(Call call, boolean skipBTServices) {
         UserHandle userFromCall = getUserFromCall(call);
         UserManager um = mContext.getSystemService(UserManager.class);
-        UserHandle parentUser = mTelephonyFeatureFlags.workProfileApiSplit()
+        UserHandle parentUser = mFeatureFlags.profileUserSupport()
                 ? um.getProfileParent(userFromCall) : null;
-        if (!mTelephonyFeatureFlags.workProfileApiSplit()
+        if (!mFeatureFlags.profileUserSupport()
                 && um.isManagedProfile(userFromCall.getIdentifier())) {
             parentUser = um.getProfileParent(userFromCall);
         }
@@ -2111,10 +2103,10 @@
         UserHandle userFromCall = getUserFromCall(call);
 
         UserManager um = mContext.getSystemService(UserManager.class);
-        UserHandle parentUser = mTelephonyFeatureFlags.workProfileApiSplit()
+        UserHandle parentUser = mFeatureFlags.profileUserSupport()
                 ? um.getProfileParent(userFromCall) : null;
 
-        if (!mTelephonyFeatureFlags.workProfileApiSplit()
+        if (!mFeatureFlags.profileUserSupport()
                 && um.isManagedProfile(userFromCall.getIdentifier())) {
             parentUser = um.getProfileParent(userFromCall);
         }
diff --git a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
index 24b14de..3d99d07 100644
--- a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
+++ b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
@@ -208,7 +208,6 @@
     private UserHandle mChildUserHandle = UserHandle.of(10);
     private @Mock Call mMockChildUserCall;
     private UserHandle mParentUserHandle = UserHandle.of(1);
-    private @Mock com.android.internal.telephony.flags.FeatureFlags mTelephonyFeatureFlags;
 
     @Override
     @Before
@@ -239,11 +238,9 @@
                 mMockPermissionInfo);
         when(mMockContext.getAttributionSource()).thenReturn(new AttributionSource(Process.myUid(),
                 "com.android.server.telecom.tests", null));
-        when(mTelephonyFeatureFlags.workProfileApiSplit()).thenReturn(false);
         mInCallController = new InCallController(mMockContext, mLock, mMockCallsManager,
                 mMockSystemStateHelper, mDefaultDialerCache, mTimeoutsAdapter,
-                mEmergencyCallHelper, mCarModeTracker, mClockProxy, mFeatureFlags,
-                mTelephonyFeatureFlags);
+                mEmergencyCallHelper, mCarModeTracker, mClockProxy, mFeatureFlags);
         // Capture the broadcast receiver registered.
         doAnswer(invocation -> {
             mRegisteredReceiver = invocation.getArgument(0);
@@ -319,6 +316,7 @@
         when(mMockUserManager.getUserInfo(anyInt())).thenReturn(mMockUserInfo);
         when(mMockUserInfo.isManagedProfile()).thenReturn(true);
         when(mFeatureFlags.separatelyBindToBtIncallService()).thenReturn(false);
+        when(mFeatureFlags.profileUserSupport()).thenReturn(false);
     }
 
     @Override
@@ -1941,7 +1939,7 @@
                 mMockChildUserInfo);
         when(mMockUserManager.isManagedProfile(mParentUserHandle.getIdentifier())).thenReturn(
                 false);
-        when(mTelephonyFeatureFlags.workProfileApiSplit()).thenReturn(true);
+        when(mFeatureFlags.profileUserSupport()).thenReturn(true);
     }
 
     @Test