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

Commit f5e5d3cc authored by Nancy Chen's avatar Nancy Chen
Browse files

Add an option to set the selected phone account as the default. (2/3)

Modify the phoneAccountSelected method to support the option to set the
selected phone account as the default for outgoing phone calls.

Bug: 18078232
Change-Id: I1c0e1ba9ef7d886d890d86825eb53bc0ba8483d1
parent 140004a1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ public final class CallsManager extends Call.ListenerBase {
        mProximitySensorManager.turnOff(screenOnImmediately);
    }

    void phoneAccountSelected(Call call, PhoneAccountHandle account) {
    void phoneAccountSelected(Call call, PhoneAccountHandle account, boolean setDefault) {
        if (!mCalls.contains(call)) {
            Log.i(this, "Attempted to add account to unknown call %s", call);
        } else {
@@ -715,6 +715,10 @@ public final class CallsManager extends Call.ListenerBase {
            } else {
                call.disconnect();
            }

            if (setDefault) {
                mPhoneAccountRegistrar.setUserSelectedOutgoingPhoneAccount(account);
            }
        }
    }

+5 −2
Original line number Diff line number Diff line
@@ -139,7 +139,8 @@ class InCallAdapter extends IInCallAdapter.Stub {
                    try {
                        call = mCallIdMapper.getCall(args.arg1);
                        if (call != null) {
                            mCallsManager.phoneAccountSelected(call, (PhoneAccountHandle) args.arg2);
                            mCallsManager.phoneAccountSelected(call,
                                    (PhoneAccountHandle) args.arg2, args.argi1 == 1);
                        } else {
                            Log.w(this, "phoneAccountSelected, unknown call id: %s", args.arg1);
                        }
@@ -284,11 +285,13 @@ class InCallAdapter extends IInCallAdapter.Stub {
    }

    @Override
    public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle) {
    public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle,
            boolean setDefault) {
        if (mCallIdMapper.isValidCallId(callId)) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.arg2 = accountHandle;
            args.argi1 = setDefault? 1 : 0;
            mHandler.obtainMessage(MSG_PHONE_ACCOUNT_SELECTED, args).sendToTarget();
        }
    }