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

Commit 0bde0c54 authored by Nancy Chen's avatar Nancy Chen Committed by Android Git Automerger
Browse files

am 1e01a160: Merge "Add an option to set the selected phone account as the...

am 1e01a160: Merge "Add an option to set the selected phone account as the default. (2/3)" into lmp-sprout-dev

* commit '1e01a160':
  Add an option to set the selected phone account as the default. (2/3)
parents 7fa8a55a 1e01a160
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -699,7 +699,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 {
@@ -718,6 +718,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();
        }
    }