summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/CallCardPresenter.java
diff options
context:
space:
mode:
authorSailesh Nepal <sail@google.com>2014-04-07 22:33:09 -0700
committerSailesh Nepal <sail@google.com>2014-04-07 22:34:12 -0700
commit46848bb9b89cc5417afae19aaab38fe331a7b474 (patch)
treec7c1f92fe123c112175577ffeb5187d98f1044c3 /InCallUI/src/com/android/incallui/CallCardPresenter.java
parentc6f4e50a4130fb8f7247f5eab6849829701ad484 (diff)
InCallUI: Handoff UI tweaks
This CL disables the handoff button when handoff is pending. It also cleans up the handoff UI code. Bug: 13565185, 13799169 Change-Id: Ie2831ba29d628fb5a0538defe918e3151eb5b824
Diffstat (limited to 'InCallUI/src/com/android/incallui/CallCardPresenter.java')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java52
1 files changed, 23 insertions, 29 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index a63c426b6..30639751c 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -21,8 +21,6 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.graphics.Bitmap;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
import android.telecomm.CallCapabilities;
import android.telecomm.CallServiceDescriptor;
import android.telephony.DisconnectCause;
@@ -56,6 +54,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
private ContactCacheEntry mSecondaryContactInfo;
private CallTimer mCallTimer;
private Context mContext;
+ private boolean mIsWiFiCachedValue;
public CallCardPresenter() {
// create the call timer
@@ -183,41 +182,36 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
ui.setPrimaryCallElapsedTime(false, null);
}
- // Set the call state
+ setUiCallState();
+ }
+
+ private void setUiCallState() {
if (mPrimary != null) {
- final boolean bluetoothOn =
+ boolean bluetoothOn =
(AudioModeProvider.getInstance().getAudioMode() == AudioMode.BLUETOOTH);
- ui.setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
- getGatewayLabel(), getGatewayNumber(), getWifiConnection());
+ boolean isHandoffCapable = mPrimary.can(CallCapabilities.CONNECTION_HANDOFF);
+ boolean isHandoffPending = mPrimary.getHandoffCallServiceDescriptor() != null;
+
+ CallServiceDescriptor descriptor = mPrimary.getCurrentCallServiceDescriptor();
+ boolean isWiFi = descriptor != null &&
+ descriptor.getNetworkType() == CallServiceDescriptor.FLAG_WIFI;
+ // Cache the value so the UI doesn't change when the call ends.
+ mIsWiFiCachedValue = isWiFi;
+
+ getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
+ getGatewayLabel(), getGatewayNumber(), isWiFi, isHandoffCapable,
+ isHandoffPending);
} else {
- ui.setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null, null);
+ getUi().setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null,
+ mIsWiFiCachedValue, false, false);
}
-
- ui.setShowConnectionHandoff(mPrimary != null &&
- mPrimary.can(CallCapabilities.CONNECTION_HANDOFF));
}
@Override
public void onAudioMode(int mode) {
if (mPrimary != null && getUi() != null) {
- final boolean bluetoothOn = (AudioMode.BLUETOOTH == mode);
-
- getUi().setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
- getGatewayLabel(), getGatewayNumber(), getWifiConnection());
- }
- }
-
- private String getWifiConnection() {
- CallServiceDescriptor descriptor = mPrimary.getCurrentCallServiceDescriptor();
- if (descriptor != null && descriptor.getNetworkType() == CallServiceDescriptor.FLAG_WIFI) {
- final WifiManager wifiManager = (WifiManager) mContext.getSystemService(
- Context.WIFI_SERVICE);
- final WifiInfo info = wifiManager.getConnectionInfo();
- if (info != null) {
- return info.getSSID();
- }
+ setUiCallState();
}
- return null;
}
@Override
@@ -489,12 +483,12 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
Drawable photo, boolean isConference, boolean isGeneric);
void setSecondaryImage(Drawable image);
void setCallState(int state, int cause, boolean bluetoothOn,
- String gatewayLabel, String gatewayNumber, String wifiConnection);
+ String gatewayLabel, String gatewayNumber, boolean isWiFi,
+ boolean isHandoffCapable, boolean isHandoffPending);
void setPrimaryCallElapsedTime(boolean show, String duration);
void setPrimaryName(String name, boolean nameIsNumber);
void setPrimaryImage(Drawable image);
void setPrimaryPhoneNumber(String phoneNumber);
void setPrimaryLabel(String label);
- void setShowConnectionHandoff(boolean showConnectionHandoff);
}
}