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 | |
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
-rw-r--r-- | InCallUI/res/drawable-hdpi/ic_signal_wifi_4_bar_18dp.png | bin | 290 -> 0 bytes | |||
-rw-r--r-- | InCallUI/res/drawable-mdpi/ic_signal_wifi_4_bar_18dp.png | bin | 204 -> 0 bytes | |||
-rw-r--r-- | InCallUI/res/drawable-xhdpi/ic_signal_wifi_4_bar_18dp.png | bin | 339 -> 0 bytes | |||
-rw-r--r-- | InCallUI/res/drawable-xxhdpi/ic_signal_wifi_4_bar_18dp.png | bin | 474 -> 0 bytes | |||
-rw-r--r-- | InCallUI/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_18dp.png | bin | 619 -> 0 bytes | |||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 20 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 51 |
7 files changed, 19 insertions, 52 deletions
diff --git a/InCallUI/res/drawable-hdpi/ic_signal_wifi_4_bar_18dp.png b/InCallUI/res/drawable-hdpi/ic_signal_wifi_4_bar_18dp.png Binary files differdeleted file mode 100644 index d7b98055e..000000000 --- a/InCallUI/res/drawable-hdpi/ic_signal_wifi_4_bar_18dp.png +++ /dev/null diff --git a/InCallUI/res/drawable-mdpi/ic_signal_wifi_4_bar_18dp.png b/InCallUI/res/drawable-mdpi/ic_signal_wifi_4_bar_18dp.png Binary files differdeleted file mode 100644 index d537ab469..000000000 --- a/InCallUI/res/drawable-mdpi/ic_signal_wifi_4_bar_18dp.png +++ /dev/null diff --git a/InCallUI/res/drawable-xhdpi/ic_signal_wifi_4_bar_18dp.png b/InCallUI/res/drawable-xhdpi/ic_signal_wifi_4_bar_18dp.png Binary files differdeleted file mode 100644 index 5a5319212..000000000 --- a/InCallUI/res/drawable-xhdpi/ic_signal_wifi_4_bar_18dp.png +++ /dev/null diff --git a/InCallUI/res/drawable-xxhdpi/ic_signal_wifi_4_bar_18dp.png b/InCallUI/res/drawable-xxhdpi/ic_signal_wifi_4_bar_18dp.png Binary files differdeleted file mode 100644 index b627198f5..000000000 --- a/InCallUI/res/drawable-xxhdpi/ic_signal_wifi_4_bar_18dp.png +++ /dev/null diff --git a/InCallUI/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_18dp.png b/InCallUI/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_18dp.png Binary files differdeleted file mode 100644 index f4105ec8d..000000000 --- a/InCallUI/res/drawable-xxxhdpi/ic_signal_wifi_4_bar_18dp.png +++ /dev/null diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 814876105..28f449b93 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -488,10 +488,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr DisconnectCause disconnectCause, String connectionLabel, Drawable callStateIcon, - String gatewayNumber) { + String gatewayNumber, + boolean isWifi) { boolean isGatewayCall = !TextUtils.isEmpty(gatewayNumber); CharSequence callStateLabel = getCallStateLabelFromState(state, videoState, - sessionModificationState, disconnectCause, connectionLabel, isGatewayCall); + sessionModificationState, disconnectCause, connectionLabel, isGatewayCall, isWifi); Log.v(this, "setCallState " + callStateLabel); Log.v(this, "DisconnectCause " + disconnectCause.toString()); @@ -499,6 +500,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr if (TextUtils.equals(callStateLabel, mCallStateLabel.getText())) { // Nothing to do if the labels are the same + if (state == Call.State.ACTIVE || state == Call.State.CONFERENCED) { + mCallStateLabel.clearAnimation(); + mCallStateIcon.clearAnimation(); + } return; } @@ -652,10 +657,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr * 2. Ongoing calls will display the name of the provider. * 3. Incoming calls will only display "Incoming via..." for accounts. * 4. Video calls, and session modification states (eg. requesting video). + * 5. Incoming and active Wi-Fi calls will show label provided by hint. */ private CharSequence getCallStateLabelFromState(int state, int videoState, int sessionModificationState, DisconnectCause disconnectCause, String label, - boolean isGatewayCall) { + boolean isGatewayCall, boolean isWifi) { final Context context = getView().getContext(); CharSequence callStateLabel = null; // Label to display as part of the call banner @@ -669,7 +675,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr case Call.State.ACTIVE: // We normally don't show a "call state label" at all in this state // (but we can use the call state label to display the provider name). - if (isAccount) { + if (isAccount || isWifi) { callStateLabel = label; } else if (sessionModificationState == Call.SessionModificationState.REQUEST_FAILED) { @@ -686,7 +692,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr break; case Call.State.CONNECTING: case Call.State.DIALING: - if (isSpecialCall) { + if (isSpecialCall && !isWifi) { callStateLabel = context.getString(R.string.calling_via_template, label); } else { callStateLabel = context.getString(R.string.card_title_dialing); @@ -697,7 +703,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr break; case Call.State.INCOMING: case Call.State.CALL_WAITING: - if (isAccount) { + if (isWifi) { + callStateLabel = label; + } else if (isAccount) { callStateLabel = context.getString(R.string.incoming_via_template, label); } else if (VideoProfile.VideoState.isBidirectional(videoState)) { callStateLabel = context.getString(R.string.notification_incoming_video_call); 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); |