diff options
author | Santos Cordon <santoscordon@google.com> | 2013-08-06 19:06:19 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-08-07 18:08:12 -0700 |
commit | ee4a3feabd047f27540c5967b88d407855f3de8a (patch) | |
tree | 5c60d1fc13b4d69006ca7ff2c456f999e00f8f78 /InCallUI/src/com/android/incallui/CallHandlerService.java | |
parent | 6d231f52e4f00399330d772f2a337283803f3a9d (diff) |
Audio Routing support in UI
Changes:
- AudioModeProvider - receives audio mode changes from
CallHandlerService
- CallButtonPresenter listens to AudioModeProvider so that it can use
those changes in the UI.
- CallButtonFragment uses the audio mode from Presenter() to display:
- The correct layers for the supported modes
- The popup menu when bluetooth is enabled
Change-Id: I8ec4024f7bbb5e3b1cfdaae20a4dd2f85ae802cf
Diffstat (limited to 'InCallUI/src/com/android/incallui/CallHandlerService.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallHandlerService.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index 173f6a345..8431fc91e 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -22,6 +22,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Message; +import com.android.services.telephony.common.AudioMode; import com.android.services.telephony.common.Call; import com.android.services.telephony.common.ICallCommandService; import com.android.services.telephony.common.ICallHandlerService; @@ -39,10 +40,14 @@ public class CallHandlerService extends Service { private static final int ON_UPDATE_CALL = 1; private static final int ON_UPDATE_MULTI_CALL = 2; private static final int ON_UPDATE_CALL_WITH_TEXT_RESPONSES = 3; + private static final int ON_AUDIO_MODE = 4; + private static final int ON_SUPPORTED_AUDIO_MODE = 5; + private CallList mCallList; private Handler mMainHandler; private InCallPresenter mInCallPresenter; + private AudioModeProvider mAudioModeProvider; @Override public void onCreate() { @@ -51,6 +56,7 @@ public class CallHandlerService extends Service { mCallList = CallList.getInstance(); mMainHandler = new MainHandler(); mInCallPresenter = InCallPresenter.init(this); + mAudioModeProvider = AudioModeProvider.getInstance(); } @Override @@ -66,12 +72,13 @@ public class CallHandlerService extends Service { @Override public void setCallCommandService(ICallCommandService service) { - Logger.d(this, "onConnected: " + service.toString()); + Logger.d(CallHandlerService.this, "onConnected: " + service.toString()); CallCommandClient.init(service); } @Override public void onDisconnect(Call call) { + Logger.d(CallHandlerService.this, "onDisconnected"); mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_UPDATE_CALL, 0, 0, call)); } @@ -86,16 +93,24 @@ public class CallHandlerService extends Service { @Override public void onUpdate(List<Call> calls, boolean fullUpdate) { + Logger.d(CallHandlerService.this, "onUpdate "); // TODO(klp): Add use of fullUpdate to message mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_UPDATE_MULTI_CALL, 0, 0, calls)); } @Override public void onAudioModeChange(int mode) { + Logger.d(CallHandlerService.this, "onAudioModeChange : " + AudioMode.toString(mode)); + mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode, 0, null)); } @Override - public void onAudioModeSupportChange(int modeMask) { + public void onSupportedAudioModeChange(int modeMask) { + Logger.d(CallHandlerService.this, "onSupportedAudioModeChange : " + + AudioMode.toString(modeMask)); + + mMainHandler.sendMessage( + mMainHandler.obtainMessage(ON_SUPPORTED_AUDIO_MODE, modeMask, 0, null)); } }; @@ -115,6 +130,8 @@ public class CallHandlerService extends Service { } private void executeMessage(Message msg) { + Logger.d(this, "executeMessage " + msg.what); + switch (msg.what) { case ON_UPDATE_CALL: mCallList.onUpdate((Call) msg.obj); @@ -125,6 +142,12 @@ public class CallHandlerService extends Service { case ON_UPDATE_CALL_WITH_TEXT_RESPONSES: mCallList.onUpdate((AbstractMap.SimpleEntry<Call, List<String> >) msg.obj); break; + case ON_AUDIO_MODE: + mAudioModeProvider.onAudioModeChange(msg.arg1); + break; + case ON_SUPPORTED_AUDIO_MODE: + mAudioModeProvider.onSupportedAudioModeChange(msg.arg1); + break; default: break; } |