Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 663bd936 authored by Thomas Stuart's avatar Thomas Stuart
Browse files

add flag for transactional CS changes

b/267234374 was merged to V without a flag to gate the new logic.
This CL gates all the changes in b/267234374 and updates 2 tests.

Fixes: 309541257
Bug: 267234374 (root bug)
Test: 2 modified tests
Change-Id: I26967870b19be3670248ea237ccd8198f624c079
parent 22808895
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ aconfig_declarations {
      "telecom_incallservice_flags.aconfig",
      "telecom_default_phone_account_flags.aconfig",
      "telecom_callaudioroutestatemachine_flags.aconfig",
      "telecom_call_flags.aconfig",
      "telecom_calls_manager_flags.aconfig",
      "telecom_anomaly_report_flags.aconfig",
      "telecom_callaudiomodestatemachine_flags.aconfig",
+8 −0
Original line number Diff line number Diff line
package: "com.android.server.telecom.flags"

flag {
  name: "transactional_cs_verifier"
  namespace: "telecom"
  description: "verify connection service callbacks via a transaction"
  bug: "309541257"
}
 No newline at end of file
+8 −4
Original line number Diff line number Diff line
@@ -849,7 +849,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
            ClockProxy clockProxy,
            ToastFactory toastFactory,
            FeatureFlags featureFlags) {

        mFlags = featureFlags;
        mId = callId;
        mConnectionId = callId;
@@ -1370,9 +1369,11 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
                Log.addEvent(this, event, stringData);
            }

            if (mFlags.transactionalCsVerifier()) {
                for (CallStateListener listener : mCallStateListeners) {
                    listener.onCallStateChanged(newState);
                }
            }

            mCallStateChangedAtomWriter
                    .setDisconnectCause(getDisconnectCause())
@@ -2957,7 +2958,10 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
            if (mTransactionalService != null) {
                mTransactionalService.onSetInactive(this);
            } else if (mConnectionService != null) {
                awaitCallStateChangeAndMaybeDisconnectCall(CallState.ON_HOLD, isSelfManaged(), "hold");
                if (mFlags.transactionalCsVerifier()) {
                    awaitCallStateChangeAndMaybeDisconnectCall(CallState.ON_HOLD, isSelfManaged(),
                            "hold");
                }
                mConnectionService.hold(this);
            } else {
                Log.e(this, new NullPointerException(),
+2 −2
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ public class MissedInformationTest extends TelecomSystemTest {
        setUpIncomingCall();
        doReturn(mNotificationManager).when(mSpyContext)
                .getSystemService(Context.NOTIFICATION_SERVICE);
        doReturn(false).when(mNotificationManager).matchesCallFilter(any(Uri.class));
        doReturn(false).when(mNotificationManager).matchesCallFilter(any(Bundle.class));
        doReturn(false).when(mIncomingCall).wasDndCheckComputedForCall();
        mCallsManager.getRinger().setNotificationManager(mNotificationManager);

@@ -372,7 +372,7 @@ public class MissedInformationTest extends TelecomSystemTest {

        // Wait for ringer attributes build completed
        verify(mNotificationManager, timeout(TEST_TIMEOUT_MILLIS))
                .matchesCallFilter(any(Uri.class));
                .matchesCallFilter(any(Bundle.class));
        mCallsManager.getRinger().waitForAttributesCompletion();

        mCallsManager.markCallAsDisconnected(mIncomingCall,
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.server.telecom.CallerInfoLookupHelper;
import com.android.server.telecom.CallsManager;
import com.android.server.telecom.ClockProxy;
import com.android.server.telecom.ConnectionServiceWrapper;
import com.android.server.telecom.flags.FeatureFlags;
import com.android.server.telecom.PhoneNumberUtilsAdapter;
import com.android.server.telecom.TelecomSystem;
import com.android.server.telecom.ui.ToastFactory;
@@ -272,6 +273,7 @@ public class TransactionTests extends TelecomTestCase {
    @Test
    public void testCallStateChangeTimesOut()
            throws ExecutionException, InterruptedException, TimeoutException {
        when(mFeatureFlags.transactionalCsVerifier()).thenReturn(true);
        VerifyCallStateChangeTransaction t = new VerifyCallStateChangeTransaction(mCallsManager,
                mMockCall1, CallState.ON_HOLD, true);
        // WHEN
@@ -300,6 +302,7 @@ public class TransactionTests extends TelecomTestCase {
    @Test
    public void testCallStateIsSuccessfullyChanged()
            throws ExecutionException, InterruptedException, TimeoutException {
        when(mFeatureFlags.transactionalCsVerifier()).thenReturn(true);
        VerifyCallStateChangeTransaction t = new VerifyCallStateChangeTransaction(mCallsManager,
                mMockCall1, CallState.ON_HOLD, true);
        // WHEN