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

Commit 29a06e0b authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files
parents 48df01c0 655d1897
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -54,10 +54,12 @@ public class CallStreamingController extends CallsManagerListenerBase {
    private CallStreamingServiceConnection mConnection;
    private boolean mIsStreaming;
    private final Object mLock;
    private TelecomSystem.SyncRoot mTelecomLock;

    public CallStreamingController(Context context) {
    public CallStreamingController(Context context, TelecomSystem.SyncRoot telecomLock) {
        mLock = new Object();
        mContext = context;
        mTelecomLock = telecomLock;
    }

    private void onConnectedInternal(Call call, TransactionalServiceWrapper wrapper,
@@ -101,6 +103,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
        private final CallsManager mCallsManager;

        public QueryCallStreamingTransaction(CallsManager callsManager) {
            super(callsManager.getLock());
            mCallsManager = callsManager;
        }

@@ -128,7 +131,9 @@ public class CallStreamingController extends CallsManagerListenerBase {
        private Call mCall;
        private boolean mEnterInterception;

        public AudioInterceptionTransaction(Call call, boolean enterInterception) {
        public AudioInterceptionTransaction(Call call, boolean enterInterception,
                TelecomSystem.SyncRoot lock) {
            super(lock);
            mCall = call;
            mEnterInterception = enterInterception;
        }
@@ -164,6 +169,7 @@ public class CallStreamingController extends CallsManagerListenerBase {

        public StreamingServiceTransaction(Context context, TransactionalServiceWrapper wrapper,
                Call call) {
            super(mTelecomLock);
            mWrapper = wrapper;
            mCall = call;
            mUserHandle = mCall.getInitiatingUser();
@@ -240,6 +246,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
        private static final String TAG = "UnbindStreamingServiceTransaction";

        public UnbindStreamingServiceTransaction() {
            super(mTelecomLock);
        }

        @SuppressLint("LongLogTag")
@@ -305,6 +312,7 @@ public class CallStreamingController extends CallsManagerListenerBase {
        @StreamingCall.StreamingCallState int mState;

        public CallStreamingStateChangeTransaction(@StreamingCall.StreamingCallState int state) {
            super(mTelecomLock);
            mState = state;
        }

+6 −2
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ import com.android.server.telecom.ui.ConfirmCallDialogActivity;
import com.android.server.telecom.ui.DisconnectedCallNotifier;
import com.android.server.telecom.ui.IncomingCallNotifier;
import com.android.server.telecom.ui.ToastFactory;
import com.android.server.telecom.voip.TransactionManager;

import java.util.ArrayList;
import java.util.Arrays;
@@ -441,6 +442,7 @@ public class CallsManager extends Call.ListenerBase
    private final CallAnomalyWatchdog mCallAnomalyWatchdog;
    private final CallStreamingController mCallStreamingController;
    private final BlockedNumbersAdapter mBlockedNumbersAdapter;
    private final TransactionManager mTransactionManager;

    private final ConnectionServiceFocusManager.CallsManagerRequester mRequester =
            new ConnectionServiceFocusManager.CallsManagerRequester() {
@@ -549,7 +551,8 @@ public class CallsManager extends Call.ListenerBase
            CallAnomalyWatchdog callAnomalyWatchdog,
            Ringer.AccessibilityManagerAdapter accessibilityManagerAdapter,
            Executor asyncTaskExecutor,
            BlockedNumbersAdapter blockedNumbersAdapter) {
            BlockedNumbersAdapter blockedNumbersAdapter,
            TransactionManager transactionManager) {
        mContext = context;
        mLock = lock;
        mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter;
@@ -632,8 +635,9 @@ public class CallsManager extends Call.ListenerBase
        mClockProxy = clockProxy;
        mToastFactory = toastFactory;
        mRoleManagerAdapter = roleManagerAdapter;
        mCallStreamingController = new CallStreamingController(mContext);
        mTransactionManager = transactionManager;
        mBlockedNumbersAdapter = blockedNumbersAdapter;
        mCallStreamingController = new CallStreamingController(mContext, mLock);

        mListeners.add(mInCallWakeLockController);
        mListeners.add(statusBarNotifier);
+4 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.server.telecom.ui.DisconnectedCallNotifier;
import com.android.server.telecom.ui.IncomingCallNotifier;
import com.android.server.telecom.ui.MissedCallNotifierImpl.MissedCallNotifierImplFactory;
import com.android.server.telecom.ui.ToastFactory;
import com.android.server.telecom.voip.TransactionManager;

import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -337,6 +338,7 @@ public class TelecomSystem {
            CallAnomalyWatchdog callAnomalyWatchdog = new CallAnomalyWatchdog(
                    Executors.newSingleThreadScheduledExecutor(),
                    mLock, timeoutsAdapter, clockProxy);
            TransactionManager transactionManager = TransactionManager.getInstance();

            mCallsManager = new CallsManager(
                    mContext,
@@ -372,8 +374,8 @@ public class TelecomSystem {
                    callAnomalyWatchdog,
                    accessibilityManagerAdapter,
                    asyncTaskExecutor,
                    blockedNumbersAdapter);

                    blockedNumbersAdapter,
                    transactionManager);
            mIncomingCallNotifier = incomingCallNotifier;
            incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() {
                @Override
+15 −13
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public class TransactionalServiceWrapper implements
    private ConnectionServiceFocusManager.ConnectionServiceFocusListener mConnSvrFocusListener;
    // init when constructor is called
    private final Hashtable<String, Call> mTrackedCalls = new Hashtable<>();
    private final Object mLock;
    private final TelecomSystem.SyncRoot mLock;
    private final String mPackageName;
    // needs to be non-final for testing
    private TransactionManager mTransactionManager;
@@ -105,7 +105,7 @@ public class TransactionalServiceWrapper implements
        mPackageName = phoneAccountHandle.getComponentName().getPackageName();
        mTransactionManager = TransactionManager.getInstance();
        mStreamingController = mCallsManager.getCallStreamingController();
        mLock = new Object();
        mLock = mCallsManager.getLock();
    }

    @VisibleForTesting
@@ -378,7 +378,7 @@ public class TransactionalServiceWrapper implements
        SerialTransaction serialTransactions = createSetActiveTransactions(call);
        serialTransactions.appendTransaction(
                new CallEventCallbackAckTransaction(mICallEventCallback,
                        action, call.getId(), videoState));
                        action, call.getId(), videoState, mLock));

        // do CallsManager workload before asking client and
        //   reset CallsManager state if client does NOT ack
@@ -403,7 +403,7 @@ public class TransactionalServiceWrapper implements
            Log.i(TAG, String.format(Locale.US, "onSetInactive: callId=[%s]", call.getId()));
            mTransactionManager.addTransaction(
                    new CallEventCallbackAckTransaction(mICallEventCallback,
                            ON_SET_INACTIVE, call.getId()), new OutcomeReceiver<>() {
                            ON_SET_INACTIVE, call.getId(), mLock), new OutcomeReceiver<>() {
                        @Override
                        public void onResult(VoipCallTransactionResult result) {
                            mCallsManager.markCallAsOnHold(call);
@@ -426,7 +426,7 @@ public class TransactionalServiceWrapper implements

            mTransactionManager.addTransaction(
                    new CallEventCallbackAckTransaction(mICallEventCallback, ON_DISCONNECT,
                            call.getId(), cause), new OutcomeReceiver<>() {
                            call.getId(), cause, mLock), new OutcomeReceiver<>() {
                        @Override
                        public void onResult(VoipCallTransactionResult result) {
                            removeCallFromCallsManager(call, cause);
@@ -451,7 +451,7 @@ public class TransactionalServiceWrapper implements

            mTransactionManager.addTransaction(
                    new CallEventCallbackAckTransaction(mICallEventCallback, ON_STREAMING_STARTED,
                            call.getId()), new OutcomeReceiver<>() {
                            call.getId(), mLock), new OutcomeReceiver<>() {
                        @Override
                        public void onResult(VoipCallTransactionResult result) {
                        }
@@ -560,7 +560,7 @@ public class TransactionalServiceWrapper implements
        transactions.add(new RequestFocusTransaction(mCallsManager, call));

        // send off to Transaction Manager to process
        return new SerialTransaction(transactions);
        return new SerialTransaction(transactions, mLock);
    }

    private SerialTransaction createSetAnswerTransactions(Call call, int videoState) {
@@ -574,7 +574,7 @@ public class TransactionalServiceWrapper implements
        transactions.add(new AnswerCallTransaction(mCallsManager, call, videoState));

        // send off to Transaction Manager to process
        return new SerialTransaction(transactions);
        return new SerialTransaction(transactions, mLock);
    }

    /***
@@ -631,12 +631,13 @@ public class TransactionalServiceWrapper implements
        subTransactions.add(mStreamingController.getCallStreamingServiceTransaction(
                mCallsManager.getContext(), this, call));
        // add t2.2 audio route operations
        subTransactions.add(new CallStreamingController.AudioInterceptionTransaction(call, true));
        subTransactions.add(new CallStreamingController.AudioInterceptionTransaction(call,
                true, mLock));

        // add t2
        transactions.add(new ParallelTransaction(subTransactions));
        transactions.add(new ParallelTransaction(subTransactions, mLock));
        // send off to Transaction Manager to process
        return new SerialTransaction(transactions);
        return new SerialTransaction(transactions, mLock);
    }

    private VoipCallTransaction createStopStreamingTransaction(Call call) {
@@ -647,8 +648,9 @@ public class TransactionalServiceWrapper implements
        // 1. unbind to call streaming service
        transactions.add(mStreamingController.getUnbindStreamingServiceTransaction());
        // 2. audio route operations
        transactions.add(new CallStreamingController.AudioInterceptionTransaction(call, false));
        return new ParallelTransaction(transactions);
        transactions.add(new CallStreamingController.AudioInterceptionTransaction(call,
                false, mLock));
        return new ParallelTransaction(transactions, mLock);
    }


+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ public class AnswerCallTransaction extends VoipCallTransaction {
    private final int mVideoState;

    public AnswerCallTransaction(CallsManager callsManager, Call call, int videoState) {
        super(callsManager.getLock());
        mCallsManager = callsManager;
        mCall = call;
        mVideoState = videoState;
Loading