diff options
author | Andrew Lee <anwlee@google.com> | 2015-03-25 19:02:43 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-03-25 19:02:43 +0000 |
commit | 22875bb1d3fa4f023e6ca127a77159ab42bbbabc (patch) | |
tree | b2991edb40c4f06c78dff156018a4faa43307fe7 /InCallUI/src | |
parent | a42005350c1dd0aa956fe5f911f59e704b58c1c7 (diff) | |
parent | 82332c921b8dcef213700822e2404b005adab00c (diff) |
Don\'t show SSID for Wi-Fi calls.
automerge: 1a3d05d
* commit '1a3d05dc126773f0e0d32135f9b1018f1a4c8b5e':
Don't show SSID for Wi-Fi calls.
Diffstat (limited to 'InCallUI/src')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 20 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 51 |
2 files changed, 19 insertions, 52 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index cc7efe7f9..6550eecdc 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 762d8688e..3a4c46a60 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); } @@ -293,7 +291,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); @@ -599,13 +598,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(); @@ -631,11 +623,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; } @@ -741,34 +728,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); @@ -778,7 +737,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); |