summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-09-17 14:43:52 -0700
committerChristine Chen <christinech@google.com>2013-09-17 14:44:21 -0700
commitc925e87be05fa88888b135bf9f663332e7875200 (patch)
tree447a3621adc41317dc6f9d302d2768b66c2454c5 /InCallUI
parentc45651f66d67ad0ff33c302ae2c350bfdd4fe7d1 (diff)
Disable HOLD when SWAP is possible
Bug: 10803088 Change-Id: I2aa40c4f645aa78cbec53e1ef72339c3bf17b038
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java38
1 files changed, 33 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 7e473e8d0..78cc084fa 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -239,11 +239,39 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
ui.enableAddCall(canAdd);
}
- ui.showHold(call.can(Capabilities.SUPPORT_HOLD));
- ui.setHold(call.getState() == Call.State.ONHOLD);
- ui.enableHold(call.can(Capabilities.HOLD));
-
- ui.showSwap(call.can(Capabilities.SWAP_CALLS));
+ final boolean canHold = call.can(Capabilities.HOLD);
+ final boolean canSwap = call.can(Capabilities.SWAP_CALLS);
+ final boolean supportHold = call.can(Capabilities.SUPPORT_HOLD);
+
+ if (canHold) {
+ ui.showHold(true);
+ ui.setHold(call.getState() == Call.State.ONHOLD);
+ ui.enableHold(true);
+ ui.showSwap(false);
+ } else if (canSwap) {
+ ui.showHold(false);
+ ui.showSwap(true);
+ } else {
+ // Neither "Hold" nor "Swap" is available. This can happen for two
+ // reasons:
+ // (1) this is a transient state on a device that *can*
+ // normally hold or swap, or
+ // (2) this device just doesn't have the concept of hold/swap.
+ //
+ // In case (1), show the "Hold" button in a disabled state. In case
+ // (2), remove the button entirely. (This means that the button row
+ // will only have 4 buttons on some devices.)
+
+ if (supportHold) {
+ ui.showHold(true);
+ ui.enableHold(false);
+ ui.setHold(call.getState() == Call.State.ONHOLD);
+ ui.showSwap(false);
+ } else {
+ ui.showHold(false);
+ ui.showSwap(false);
+ }
+ }
ui.enableMute(call.can(Capabilities.MUTE));