diff options
author | Sailesh Nepal <sail@google.com> | 2014-03-25 00:16:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-25 00:16:55 +0000 |
commit | 53c3c2496804b41a4b520293afbeeb8edc31061e (patch) | |
tree | 5db5c54cb5fcb9bf3c0ba6358938d588677a87ba /InCallUI | |
parent | 7a3f2707da6e5fecc7090e5cb1bac240f9e26f32 (diff) | |
parent | c58da178877a4d42cb6dab9ad67d8cf86d030e1a (diff) |
Merge "Hookup audio mode to InCallUI" into master-nova
Diffstat (limited to 'InCallUI')
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 02b0237d8..544746bc3 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 a97f6a05f..203476cc0 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -28,6 +28,7 @@ import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; +import android.telecomm.InCallAdapter; import android.view.KeyEvent; import android.view.View; import android.view.Window; @@ -258,6 +259,7 @@ public class InCallActivity extends Activity { case KeyEvent.KEYCODE_MUTE: // toggle mute + setMute(!AudioModeProvider.getInstance().getMute()); CallCommandClient.getInstance().mute(!AudioModeProvider.getInstance().getMute()); return true; @@ -284,6 +286,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); + } } |