Add WFC StatusHints for Conferences.
Bug: 20160799
Change-Id: Ica8b91364a3ad2402e2afc959d8ce258ce4b0cd7
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index b63b75c..19432a5 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -16,18 +16,22 @@
package com.android.services.telephony;
+import android.content.ComponentName;
+import android.content.Context;
import android.net.Uri;
import android.telecom.Conference;
import android.telecom.ConferenceParticipant;
import android.telecom.Connection;
import android.telecom.DisconnectCause;
import android.telecom.PhoneAccountHandle;
+import android.telecom.StatusHints;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.imsphone.ImsPhoneConnection;
import com.android.phone.PhoneUtils;
+import com.android.phone.R;
import java.util.ArrayList;
import java.util.HashSet;
@@ -145,6 +149,12 @@
TelephonyConnection telephonyConnection = (TelephonyConnection) c;
handleConferenceParticipantsUpdate(telephonyConnection, participants);
}
+
+ @Override
+ public void onStatusHintsChanged(Connection c, StatusHints statusHints) {
+ Log.v(this, "onStatusHintsChanged");
+ updateStatusHints();
+ }
};
/**
@@ -376,6 +386,7 @@
mConferenceHost = conferenceHost;
mConferenceHost.addConnectionListener(mConferenceHostListener);
mConferenceHost.addTelephonyConnectionListener(mTelephonyConnectionListener);
+ updateStatusHints();
}
/**
@@ -537,6 +548,8 @@
setDisconnected(new DisconnectCause(DisconnectCause.OTHER));
destroy();
}
+
+ updateStatusHints();
}
/**
@@ -574,6 +587,27 @@
}
}
+ private void updateStatusHints() {
+ if (mConferenceHost == null) {
+ setStatusHints(null);
+ return;
+ }
+
+ if (mConferenceHost.isWifi()) {
+ Phone phone = mConferenceHost.getPhone();
+ if (phone != null) {
+ Context context = phone.getContext();
+ setStatusHints(new StatusHints(
+ new ComponentName(context, TelephonyConnectionService.class),
+ context.getString(R.string.status_hint_label_wifi_call),
+ R.drawable.ic_signal_wifi_4_bar_24dp,
+ null /* extras */));
+ }
+ } else {
+ setStatusHints(null);
+ }
+ }
+
/**
* Builds a string representation of the {@link ImsConference}.
*
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index d079df7..d6b2514 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -839,6 +839,13 @@
}
/**
+ * Whether the call is using wifi.
+ */
+ boolean isWifi() {
+ return mIsWifi;
+ }
+
+ /**
* Sets the current call audio quality. Used during rebuild of the capabilities
* to set or unset the {@link Connection#CAPABILITY_HIGH_DEF_AUDIO} capability.
*