diff options
4 files changed, 32 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 807dc103e..084789513 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -32,7 +32,6 @@ import com.android.services.telephony.common.Call; import com.android.services.telephony.common.Call.Capabilities; import android.app.Fragment; -import android.os.RemoteException; import android.telecomm.InCallAdapter; /** @@ -166,6 +165,12 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto Log.d(this, "Sending new Audio Mode: " + AudioMode.toString(mode)); CallCommandClient.getInstance().setAudioMode(mode); + + InCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter(); + if (telecommAdapter != null) { + Log.v(this, "Setting audio route"); + telecommAdapter.setAudioRoute(mode); + } } /** @@ -217,6 +222,12 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto Log.d(this, "turning on mute: " + checked); CallCommandClient.getInstance().mute(checked); + + InCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter(); + if (telecommAdapter != null) { + Log.i(this, "Setting mute"); + telecommAdapter.mute(checked); + } } public void holdClicked(boolean checked) { diff --git a/InCallUI/src/com/android/incallui/CallInfoTranslator.java b/InCallUI/src/com/android/incallui/CallInfoTranslator.java index cc2960004..827c54d40 100644 --- a/InCallUI/src/com/android/incallui/CallInfoTranslator.java +++ b/InCallUI/src/com/android/incallui/CallInfoTranslator.java @@ -79,7 +79,7 @@ final class CallInfoTranslator { // TODO: Each CallService needs to provide information what kind of call capabilities they // support. For now, always assume that all calls support hold by default. - call.addCapabilities(Call.Capabilities.HOLD); + call.addCapabilities(Call.Capabilities.HOLD | Call.Capabilities.MUTE); return call; } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index a0e0c473b..2180aeae0 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.telephony.DisconnectCause; +import android.telecomm.InCallAdapter; import android.view.KeyEvent; import android.view.View; import android.view.Window; @@ -268,6 +269,7 @@ public class InCallActivity extends Activity { case KeyEvent.KEYCODE_MUTE: // toggle mute + setMute(!AudioModeProvider.getInstance().getMute()); CallCommandClient.getInstance().mute(!AudioModeProvider.getInstance().getMute()); return true; @@ -294,6 +296,16 @@ public class InCallActivity extends Activity { return super.onKeyDown(keyCode, event); } + private void setMute(boolean shouldMute) { + CallCommandClient.getInstance().mute(shouldMute); + + InCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter(); + if (telecommAdapter != null) { + Log.i(this, "Setting mute"); + telecommAdapter.mute(shouldMute); + } + } + private boolean handleDialerKeyDown(int keyCode, KeyEvent event) { Log.v(this, "handleDialerKeyDown: keyCode " + keyCode + ", event " + event + "..."); diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index 752061437..f2ebb4bd0 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Looper; +import android.telecomm.CallAudioState; import android.telecomm.CallInfo; import android.telecomm.InCallAdapter; @@ -103,4 +104,10 @@ public class InCallServiceImpl extends android.telecomm.InCallService { CallList.getInstance().onUpdate(call); } } + + /** {@inheritDoc} */ + @Override protected void onAudioStateChanged(CallAudioState audioState) { + AudioModeProvider.getInstance().onAudioModeChange(audioState.route, audioState.isMuted); + AudioModeProvider.getInstance().onSupportedAudioModeChange(audioState.supportedRouteMask); + } } |