summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-08-29 04:06:45 -0700
committerSantos Cordon <santoscordon@google.com>2013-08-29 04:06:45 -0700
commit8c478132fbc07bd075df6aba85bcfd2990bbd66a (patch)
tree0e4373cfbd368649ffaf75e68d017523fbf4df56
parentfacff288cfbdfcfd9281a64fa05a78532acf3d90 (diff)
Support visual indication of mute from headset
This change uses new binder api changes to bring down mute status from TeleService. mute state routed through AudioModeProvider. bug:10395427 Change-Id: Ie15efcc780e99072363188de2a954a1888eec9dd
-rw-r--r--InCallUI/src/com/android/incallui/AudioModeProvider.java19
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java2
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java8
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallHandlerService.java7
-rw-r--r--InCallUI/src/com/android/incallui/ProximitySensor.java4
6 files changed, 36 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java
index 6ac8e23c2..36ec20ffa 100644
--- a/InCallUI/src/com/android/incallui/AudioModeProvider.java
+++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java
@@ -30,17 +30,26 @@ import java.util.List;
private static AudioModeProvider sAudioModeProvider;
private int mAudioMode = AudioMode.EARPIECE;
+ private boolean mMuted = false;
private int mSupportedModes = AudioMode.ALL_MODES;
private final List<AudioModeListener> mListeners = Lists.newArrayList();
public AudioModeProvider() {
}
- public void onAudioModeChange(int newMode) {
- mAudioMode = newMode;
+ public void onAudioModeChange(int newMode, boolean muted) {
+ if (mAudioMode != newMode) {
+ mAudioMode = newMode;
+ for (AudioModeListener l : mListeners) {
+ l.onAudioMode(mAudioMode);
+ }
+ }
- for (AudioModeListener l : mListeners) {
- l.onAudioMode(mAudioMode);
+ if (mMuted != muted) {
+ mMuted = muted;
+ for (AudioModeListener l : mListeners) {
+ l.onMute(mMuted);
+ }
}
}
@@ -57,6 +66,7 @@ import java.util.List;
mListeners.add(listener);
listener.onSupportedAudioMode(mSupportedModes);
listener.onAudioMode(mAudioMode);
+ listener.onMute(mMuted);
}
}
@@ -76,6 +86,7 @@ import java.util.List;
/* package */ interface AudioModeListener {
void onAudioMode(int newMode);
+ void onMute(boolean muted);
void onSupportedAudioMode(int modeMask);
}
}
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index a1592924b..bd193818a 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -201,6 +201,8 @@ public class CallButtonFragment
@Override
public void setAudio(int mode) {
+ updateAudioButtons(getPresenter().getSupportedAudio());
+ refreshAudioModePopup();
}
@Override
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 9db383fdd..6e64e65c4 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -79,6 +79,13 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
}
}
+ @Override
+ public void onMute(boolean muted) {
+ if (getUi() != null) {
+ getUi().setMute(muted);
+ }
+ }
+
public int getAudioMode() {
if (mAudioModeProvider != null) {
return mAudioModeProvider.getAudioMode();
@@ -140,7 +147,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
Log.d(this, "turning on mute: " + checked);
CallCommandClient.getInstance().mute(checked);
- getUi().setMute(checked);
}
public void holdClicked(boolean checked) {
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index c06806926..0b6f54104 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -199,6 +199,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
public void onSupportedAudioMode(int mask) {
}
+ @Override
+ public void onMute(boolean muted) {
+ }
+
public void updateCallTime() {
final CallCardUi ui = getUi();
diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java
index ca749aa46..b73135590 100644
--- a/InCallUI/src/com/android/incallui/CallHandlerService.java
+++ b/InCallUI/src/com/android/incallui/CallHandlerService.java
@@ -155,10 +155,11 @@ public class CallHandlerService extends Service {
}
@Override
- public void onAudioModeChange(int mode) {
+ public void onAudioModeChange(int mode, boolean muted) {
try {
Log.d(CallHandlerService.this, "onAudioModeChange : " + AudioMode.toString(mode));
- mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode, 0, null));
+ mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode,
+ muted ? 1 : 0, null));
} catch (Exception e) {
Log.e(TAG, "Error processing onAudioModeChange() call.", e);
}
@@ -223,7 +224,7 @@ public class CallHandlerService extends Service {
mCallList.onDisconnect((Call) msg.obj);
break;
case ON_AUDIO_MODE:
- mAudioModeProvider.onAudioModeChange(msg.arg1);
+ mAudioModeProvider.onAudioModeChange(msg.arg1, msg.arg2 == 1);
break;
case ON_SUPPORTED_AUDIO_MODE:
mAudioModeProvider.onSupportedAudioModeChange(msg.arg1);
diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java
index 0012e8a0f..4befb2b25 100644
--- a/InCallUI/src/com/android/incallui/ProximitySensor.java
+++ b/InCallUI/src/com/android/incallui/ProximitySensor.java
@@ -96,6 +96,10 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
public void onSupportedAudioMode(int modeMask) {
}
+ @Override
+ public void onMute(boolean muted) {
+ }
+
/**
* Called when the audio mode changes during a call.
*/