Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java +52 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.telephony.ServiceState; import android.text.TextUtils; import com.android.ims.ImsException; Loading Loading @@ -92,6 +93,16 @@ public class ImsPhoneConnection extends Connection { private boolean mIsEmergency = false; /** * Used to indicate whether the wifi state is based on * {@link com.android.ims.ImsConnectionStateListener# * onFeatureCapabilityChanged(int, int[], int[])} callbacks, or values received via the * {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE} extra. Util we receive a value via the extras, * we will use the wifi state based on the {@code onFeatureCapabilityChanged}. Once a value * is received via the extras, we will prefer those values going forward. */ private boolean mIsWifiStateFromExtras = false; //***** Event Constants private static final int EVENT_DTMF_DONE = 1; private static final int EVENT_PAUSE_DONE = 2; Loading Loading @@ -161,8 +172,6 @@ public class ImsPhoneConnection extends Connection { mCreateTime = System.currentTimeMillis(); mUusInfo = null; //mIndex = index; updateWifiState(); // Ensure any extras set on the ImsCallProfile at the start of the call are cached locally Loading Loading @@ -819,6 +828,13 @@ public class ImsPhoneConnection extends Connection { * @return Whether the ImsPhoneCallTracker's usage of wifi has been changed. */ public boolean updateWifiState() { // If we've received the wifi state via the ImsCallProfile.EXTRA_CALL_RAT_TYPE extra, we // will no longer use state updates which are based on the onFeatureCapabilityChanged // callback. if (mIsWifiStateFromExtras) { return false; } Rlog.d(LOG_TAG, "updateWifiState: " + mOwner.isVowifiEnabled()); if (isWifi() != mOwner.isVowifiEnabled()) { setWifi(mOwner.isVowifiEnabled()); Loading @@ -827,6 +843,38 @@ public class ImsPhoneConnection extends Connection { return false; } /** * Updates the wifi state based on the {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE}. * The call is considered to be a WIFI call if the extra value is * {@link ServiceState#RIL_RADIO_TECHNOLOGY_IWLAN}. * * @param extras The ImsCallProfile extras. */ private void updateWifiStateFromExtras(Bundle extras) { if (extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE)) { // The RIL (sadly) sends us the EXTRA_CALL_RAT_TYPE as a string extra, rather than an // integer extra, so we need to parse it. int radioTechnology; try { radioTechnology = Integer.parseInt(extras.getString( ImsCallProfile.EXTRA_CALL_RAT_TYPE)); } catch (NumberFormatException nfe) { radioTechnology = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN; } // We've received the extra indicating the radio technology, so we will continue to // prefer the radio technology received via this extra going forward. mIsWifiStateFromExtras = true; boolean isWifi = radioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN; // Report any changes if (isWifi() != isWifi) { setWifi(isWifi); } } } /** * Check for a change in call extras of {@link ImsCall}, and * update the {@link ImsPhoneConnection} accordingly. Loading @@ -847,6 +895,8 @@ public class ImsPhoneConnection extends Connection { final boolean changed = !areBundlesEqual(extras, mExtras); if (changed) { updateWifiStateFromExtras(extras); mExtras.clear(); mExtras.putAll(extras); setConnectionExtras(mExtras); Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java +52 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.telephony.ServiceState; import android.text.TextUtils; import com.android.ims.ImsException; Loading Loading @@ -92,6 +93,16 @@ public class ImsPhoneConnection extends Connection { private boolean mIsEmergency = false; /** * Used to indicate whether the wifi state is based on * {@link com.android.ims.ImsConnectionStateListener# * onFeatureCapabilityChanged(int, int[], int[])} callbacks, or values received via the * {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE} extra. Util we receive a value via the extras, * we will use the wifi state based on the {@code onFeatureCapabilityChanged}. Once a value * is received via the extras, we will prefer those values going forward. */ private boolean mIsWifiStateFromExtras = false; //***** Event Constants private static final int EVENT_DTMF_DONE = 1; private static final int EVENT_PAUSE_DONE = 2; Loading Loading @@ -161,8 +172,6 @@ public class ImsPhoneConnection extends Connection { mCreateTime = System.currentTimeMillis(); mUusInfo = null; //mIndex = index; updateWifiState(); // Ensure any extras set on the ImsCallProfile at the start of the call are cached locally Loading Loading @@ -819,6 +828,13 @@ public class ImsPhoneConnection extends Connection { * @return Whether the ImsPhoneCallTracker's usage of wifi has been changed. */ public boolean updateWifiState() { // If we've received the wifi state via the ImsCallProfile.EXTRA_CALL_RAT_TYPE extra, we // will no longer use state updates which are based on the onFeatureCapabilityChanged // callback. if (mIsWifiStateFromExtras) { return false; } Rlog.d(LOG_TAG, "updateWifiState: " + mOwner.isVowifiEnabled()); if (isWifi() != mOwner.isVowifiEnabled()) { setWifi(mOwner.isVowifiEnabled()); Loading @@ -827,6 +843,38 @@ public class ImsPhoneConnection extends Connection { return false; } /** * Updates the wifi state based on the {@link ImsCallProfile#EXTRA_CALL_RAT_TYPE}. * The call is considered to be a WIFI call if the extra value is * {@link ServiceState#RIL_RADIO_TECHNOLOGY_IWLAN}. * * @param extras The ImsCallProfile extras. */ private void updateWifiStateFromExtras(Bundle extras) { if (extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE)) { // The RIL (sadly) sends us the EXTRA_CALL_RAT_TYPE as a string extra, rather than an // integer extra, so we need to parse it. int radioTechnology; try { radioTechnology = Integer.parseInt(extras.getString( ImsCallProfile.EXTRA_CALL_RAT_TYPE)); } catch (NumberFormatException nfe) { radioTechnology = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN; } // We've received the extra indicating the radio technology, so we will continue to // prefer the radio technology received via this extra going forward. mIsWifiStateFromExtras = true; boolean isWifi = radioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN; // Report any changes if (isWifi() != isWifi) { setWifi(isWifi); } } } /** * Check for a change in call extras of {@link ImsCall}, and * update the {@link ImsPhoneConnection} accordingly. Loading @@ -847,6 +895,8 @@ public class ImsPhoneConnection extends Connection { final boolean changed = !areBundlesEqual(extras, mExtras); if (changed) { updateWifiStateFromExtras(extras); mExtras.clear(); mExtras.putAll(extras); setConnectionExtras(mExtras); Loading