From 450039ae0fe1143c92e22bdd81573619cbf829c9 Mon Sep 17 00:00:00 2001 From: Pranav Madapurmath Date: Wed, 6 Dec 2023 14:40:16 -0800 Subject: Rename work profile associated users fix flag. Rename the flag for the associated user fix that was addressed in U. The original flagged change had to be reverted due to a build breakage and was later relanded with the same flag name. Once the flag was removed from Gerrit, the flag was deleted and is preventing the workflow from progressing in Gantry. The fix is to create a separate flag in order to begin a new workflow. Bug: 315035693 Test: atest TelecomUnitTests Change-Id: I573a9e6c7cf77e884c4c5c59f78af965e3c260da --- flags/telecom_work_profile_flags.aconfig | 4 ++-- src/com/android/server/telecom/Call.java | 2 +- src/com/android/server/telecom/CallsManager.java | 8 ++++---- src/com/android/server/telecom/InCallController.java | 4 ++-- tests/src/com/android/server/telecom/tests/BasicCallTests.java | 2 +- .../com/android/server/telecom/tests/InCallControllerTests.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/flags/telecom_work_profile_flags.aconfig b/flags/telecom_work_profile_flags.aconfig index cc78b3083..180af5915 100644 --- a/flags/telecom_work_profile_flags.aconfig +++ b/flags/telecom_work_profile_flags.aconfig @@ -1,8 +1,8 @@ package: "com.android.server.telecom.flags" flag { - name: "work_profile_associated_user" + name: "associated_user_refactor_for_work_profile" namespace: "telecom" description: "Redefines the associated user for calls in the context of work profile support (U+)" - bug: "294699269" + bug: "315035693" } \ No newline at end of file diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java index c9557f205..1ec113c68 100644 --- a/src/com/android/server/telecom/Call.java +++ b/src/com/android/server/telecom/Call.java @@ -1789,7 +1789,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, mContext.getPackageManager()); // Set the associated user for the call for MT calls based on the target phone account. UserHandle associatedUser = UserUtil.getAssociatedUserForCall( - mFlags.workProfileAssociatedUser(), + mFlags.associatedUserRefactorForWorkProfile(), mCallsManager.getPhoneAccountRegistrar(), mCallsManager.getCurrentUserHandle(), accountHandle); if (isIncoming() && !associatedUser.equals(mAssociatedUser)) { diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java index e4ea6d53a..b04e9fa6b 100755 --- a/src/com/android/server/telecom/CallsManager.java +++ b/src/com/android/server/telecom/CallsManager.java @@ -1511,7 +1511,7 @@ public class CallsManager extends Call.ListenerBase } // Incoming address was set via EXTRA_INCOMING_CALL_ADDRESS above. UserHandle associatedUser = UserUtil.getAssociatedUserForCall( - mFeatureFlags.workProfileAssociatedUser(), + mFeatureFlags.associatedUserRefactorForWorkProfile(), getPhoneAccountRegistrar(), getCurrentUserHandle(), phoneAccountHandle); call.setAssociatedUser(associatedUser); } @@ -1724,7 +1724,7 @@ public class CallsManager extends Call.ListenerBase // For unknown calls, base the associated user off of the target phone account handle. UserHandle associatedUser = UserUtil.getAssociatedUserForCall( - mFeatureFlags.workProfileAssociatedUser(), + mFeatureFlags.associatedUserRefactorForWorkProfile(), getPhoneAccountRegistrar(), getCurrentUserHandle(), phoneAccountHandle); call.setAssociatedUser(associatedUser); setIntentExtrasAndStartTime(call, extras); @@ -4269,7 +4269,7 @@ public class CallsManager extends Call.ListenerBase call.putConnectionServiceExtras(parcelableConference.getExtras()); // For conference calls, set the associated user from the target phone account user handle. UserHandle associatedUser = UserUtil.getAssociatedUserForCall( - mFeatureFlags.workProfileAssociatedUser(), getPhoneAccountRegistrar(), + mFeatureFlags.associatedUserRefactorForWorkProfile(), getPhoneAccountRegistrar(), getCurrentUserHandle(), phoneAccount); call.setAssociatedUser(associatedUser); // In case this Conference was added via a ConnectionManager, keep track of the original @@ -5326,7 +5326,7 @@ public class CallsManager extends Call.ListenerBase // For existing connections, use the phone account user handle to determine the user // association with the call. UserHandle associatedUser = UserUtil.getAssociatedUserForCall( - mFeatureFlags.workProfileAssociatedUser(), getPhoneAccountRegistrar(), + mFeatureFlags.associatedUserRefactorForWorkProfile(), getPhoneAccountRegistrar(), getCurrentUserHandle(), connection.getPhoneAccount()); call.setAssociatedUser(associatedUser); call.addListener(this); diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java index 1aee25c75..ad3d26a66 100644 --- a/src/com/android/server/telecom/InCallController.java +++ b/src/com/android/server/telecom/InCallController.java @@ -1414,7 +1414,7 @@ public class InCallController extends CallsManagerListenerBase implements UserHandle userFromCall = getUserFromCall(call); Stream callsAssociatedWithUserFromCall = mCallsManager.getCalls().stream() .filter((c) -> getUserFromCall(c).equals(userFromCall)); - boolean isCallCountZero = mFeatureFlags.workProfileAssociatedUser() + boolean isCallCountZero = mFeatureFlags.associatedUserRefactorForWorkProfile() ? callsAssociatedWithUserFromCall.count() == 0 : mCallsManager.getCalls().isEmpty(); if (isCallCountZero) { @@ -1427,7 +1427,7 @@ public class InCallController extends CallsManagerListenerBase implements // Check again to make sure there are no active calls for the associated user. Stream callsAssociatedWithUserFromCall = mCallsManager.getCalls().stream() .filter((c) -> getUserFromCall(c).equals(userFromCall)); - boolean isCallCountZero = mFeatureFlags.workProfileAssociatedUser() + boolean isCallCountZero = mFeatureFlags.associatedUserRefactorForWorkProfile() ? callsAssociatedWithUserFromCall.count() == 0 : mCallsManager.getCalls().isEmpty(); if (isCallCountZero) { diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java index d2937e234..0b9ee656e 100644 --- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java +++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java @@ -627,7 +627,7 @@ public class BasicCallTests extends TelecomSystemTest { @LargeTest @Test public void testIncomingThenOutgoingCalls_AssociatedUsersNotEqual() throws Exception { - when(mFeatureFlags.workProfileAssociatedUser()).thenReturn(true); + when(mFeatureFlags.associatedUserRefactorForWorkProfile()).thenReturn(true); InCallServiceFixture.setIgnoreOverrideAdapterFlag(true); // Receive incoming call via mPhoneAccountMultiUser diff --git a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java index cd8431a1a..faae1484d 100644 --- a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java +++ b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java @@ -1844,7 +1844,7 @@ public class InCallControllerTests extends TelecomTestCase { @Test public void testRemoveAllServiceConnections_MultiUser() throws Exception { - when(mFeatureFlags.workProfileAssociatedUser()).thenReturn(true); + when(mFeatureFlags.associatedUserRefactorForWorkProfile()).thenReturn(true); setupMocks(false /* isExternalCall */); setupMockPackageManager(true /* default */, true /* system */, false /* external calls */); UserHandle workUser = new UserHandle(12); -- cgit v1.2.3