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

Commit 6d962524 authored by Bryce Lee's avatar Bryce Lee
Browse files

Notify connections when the ringer is silenced.

This is necessary for connected experiences (such as headset clients) where
another device must be notified of the ringer state.

Bug: 25644529
Change-Id: I89a98a4ad8ed4d94d7bf5eed07b57f353824e338
parent 88f900a5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -993,6 +993,19 @@ public class Call implements CreateConnectionResponse {
        }
    }

    /**
     * Silences the ringer.
     */
    void silence() {
        if (mConnectionService == null) {
            Log.w(this, "silence() request on a call without a connection service.");
        } else {
            Log.i(this, "Send silence to connection service for call %s", this);
            Log.event(this, Log.Events.STOP_DTMF);
            mConnectionService.silence(this);
        }
    }

    void disconnect() {
        disconnect(false);
    }
+12 −0
Original line number Diff line number Diff line
@@ -709,6 +709,18 @@ final class ConnectionServiceWrapper extends ServiceBinder {
        removeCall(call, new DisconnectCause(DisconnectCause.LOCAL));
    }

    /** @see IConnectionService#silence(String) */
    void silence(Call call) {
        final String callId = mCallIdMapper.getCallId(call);
        if (callId != null && isServiceValid("silence")) {
            try {
                logOutgoing("silence %s", callId);
                mServiceInterface.silence(callId);
            } catch (RemoteException e) {
            }
        }
    }

    /** @see IConnectionService#hold(String) */
    void hold(Call call) {
        final String callId = mCallIdMapper.getCallId(call);
+4 −0
Original line number Diff line number Diff line
@@ -142,6 +142,10 @@ final class Ringer extends CallsManagerListenerBase {
     * Silences the ringer for any actively ringing calls.
     */
    void silence() {
        for (Call call : mRingingCalls) {
            call.silence();
        }

        // Remove all calls from the "ringing" set and then update the ringer.
        mRingingCalls.clear();
        updateRinging(null);
+4 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.telecom.ParcelableConnection;
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;

import java.lang.Override;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -112,6 +113,9 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService>
        @Override
        public void disconnect(String callId) throws RemoteException { }

        @Override
        public void silence(String callId) throws RemoteException { }

        @Override
        public void hold(String callId) throws RemoteException { }