diff options
author | Andrew Lee <anwlee@google.com> | 2015-03-20 13:57:17 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-03-24 17:50:40 -0700 |
commit | 82332c921b8dcef213700822e2404b005adab00c (patch) | |
tree | 5e32f6916f3f61ae7e88b79b1b17f4fc09e57e9d /InCallUI/src/com/android/incallui/CallCardPresenter.java | |
parent | 0ad206a7d1bb21e2668405ccd7e08881db3a6dcd (diff) |
Don't show SSID for Wi-Fi calls.
- Delete wifi icon and method to get SSID.
+ Use labels provided by StatusHints instead.
I'm not very happy with the additional "isWifi" cases I ended up
adding in call card fragment.
I felt this was necessary because of assumptions in some cases
that if a label is provided, it should be formatted as a phone
account source. While this was true before, it's becoming less so.
I feel like the fragment shouldn't have to worry about formatting
or choosing the label based on the call and conditions. It should
just display the label if it thinks it is appropriate to show a
label given the call state.
To fix that, it seems like logic should be moved to the presenter
instead, and possibly to Telephony. But, I'm hesitant to do that
until these WFC changes back merge to master because of potential
merge conflicts and its slightly more risky for this branch,
because it starts dealing with logic/flows outside of WFC..
Bug: 19866988
Change-Id: Iacd5a09259c84ea7be28b0170ae603eb9561f7ca
Diffstat (limited to 'InCallUI/src/com/android/incallui/CallCardPresenter.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 3944bf62f..d7e39d8c9 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -23,7 +23,6 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.net.wifi.WifiManager; import android.os.Bundle; import android.telecom.Call.Details; import android.telecom.DisconnectCause; @@ -68,7 +67,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> private CallTimer mCallTimer; private Context mContext; - private WifiManager mWifiManager; public static class ContactLookupCallback implements ContactInfoCacheCallback { private final WeakReference<CallCardPresenter> mCallCardPresenter; @@ -109,7 +107,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> public void init(Context context, Call call) { mContext = Preconditions.checkNotNull(context); - mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); // Call may be null if disconnect happened already. if (call != null) { @@ -246,7 +243,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> new DisconnectCause(DisconnectCause.UNKNOWN), null, null, - null); + null, + false /* isWifi */); getUi().showHdAudioIndicator(false); } @@ -301,7 +299,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> mPrimary.getDisconnectCause(), getConnectionLabel(), getCallStateIcon(), - getGatewayNumber()); + getGatewayNumber(), + primaryCallCan(Details.CAPABILITY_WIFI)); boolean showHdAudioIndicator = isPrimaryCallActive() && primaryCallCan(Details.CAPABILITY_HIGH_DEF_AUDIO); @@ -600,13 +599,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> return statusHints.getLabel().toString(); } - // Assume the SSID of the connection reported by the WifiManager is the name of the wifi - // network used for calling, since currently a phone only connects to a single wifi network. - if (isPrimaryCallActive() && primaryCallCan(Details.CAPABILITY_WIFI) - && mWifiManager.getConnectionInfo() != null) { - return formatWifiSSID(mWifiManager.getConnectionInfo().getSSID()); - } - if (hasOutgoingGatewayCall() && getUi() != null) { // Return the label for the gateway app on outgoing calls. final PackageManager pm = mContext.getPackageManager(); @@ -632,11 +624,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } } - if (primaryCallCan(Details.CAPABILITY_WIFI) && (isPrimaryCallActive() - || (mPrimary != null && mPrimary.getState() == Call.State.INCOMING))) { - return mContext.getResources().getDrawable(R.drawable.ic_signal_wifi_4_bar_18dp); - } - return null; } @@ -742,34 +729,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> return photo; } - /** - * Strip quotations off the outside of a Wifi SSID identifier. For example, \"GoogleGuest\" - * becomes GoogleGuest. - * - * TODO: Move into utility class. - * TODO: Add unit tests. - * - * @param ssid The ssid of the wifi network. - */ - private String formatWifiSSID(String ssid) { - if (TextUtils.isEmpty(ssid)) { - return ""; - } - - // Trim quotation if first character. - if (ssid.charAt(0) == '\"') { - ssid = ssid.substring(1); - } - - // Trim quotation if last character. - int lastIndex = ssid.length() - 1; - if (lastIndex >= 0 && ssid.charAt(lastIndex) == '\"') { - ssid = ssid.substring(0, lastIndex); - } - - return ssid; - } - public interface CallCardUi extends Ui { void setVisible(boolean on); void setCallCardVisible(boolean visible); @@ -779,7 +738,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> String providerLabel, boolean isConference); void setCallState(int state, int videoState, int sessionModificationState, DisconnectCause disconnectCause, String connectionLabel, - Drawable connectionIcon, String gatewayNumber); + Drawable connectionIcon, String gatewayNumber, boolean isWifi); void setPrimaryCallElapsedTime(boolean show, long duration); void setPrimaryName(String name, boolean nameIsNumber); void setPrimaryImage(Drawable image); |