Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3c2042b authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Only get WiFi status based on RAT extras

am: 75f96a40

Change-Id: I61e3c7d48e4549ddc5f190990a8748c5b08b4dbd
parents 90d82a2c 75f96a40
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -2170,16 +2170,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    mPhone.notifyForVideoCapabilityChanged(isVideoCallEnabled());
                }

                // TODO: Use the ImsCallSession or ImsCallProfile to tell the initial Wifi state and
                // {@link ImsCallSession.Listener#callSessionHandover} to listen for changes to
                // wifi capability caused by a handover.
                if (DBG) log("onFeatureCapabilityChanged: isVolteEnabled=" + isVolteEnabled()
                            + ", isVideoCallEnabled=" + isVideoCallEnabled()
                            + ", isVowifiEnabled=" + isVowifiEnabled()
                            + ", isUtEnabled=" + isUtEnabled());
                for (ImsPhoneConnection connection : mConnections) {
                    connection.updateWifiState();
                }

                mPhone.onFeatureCapabilityChanged();

+1 −41
Original line number Diff line number Diff line
@@ -100,16 +100,6 @@ public class ImsPhoneConnection extends Connection implements
     */
    private boolean mShouldIgnoreVideoStateChanges = 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;
@@ -179,8 +169,6 @@ public class ImsPhoneConnection extends Connection implements
        mCreateTime = System.currentTimeMillis();
        mUusInfo = null;

        updateWifiState();

        // Ensure any extras set on the ImsCallProfile at the start of the call are cached locally
        // in the ImsPhoneConnection.  This isn't going to inform any listeners (since the original
        // connection is not likely to be associated with a TelephonyConnection yet).
@@ -684,13 +672,11 @@ public class ImsPhoneConnection extends Connection implements
        }

        boolean updateParent = mParent.update(this, imsCall, state);
        boolean updateWifiState = updateWifiState();
        boolean updateAddressDisplay = updateAddressDisplay(imsCall);
        boolean updateMediaCapabilities = updateMediaCapabilities(imsCall);
        boolean updateExtras = updateExtras(imsCall);

        return updateParent || updateWifiState || updateAddressDisplay || updateMediaCapabilities
                || updateExtras;
        return updateParent || updateAddressDisplay || updateMediaCapabilities || updateExtras;
    }

    @Override
@@ -888,28 +874,6 @@ public class ImsPhoneConnection extends Connection implements
        return changed;
    }

    /**
     * Check for a change in the wifi state of the ImsPhoneCallTracker and update the
     * {@link ImsPhoneConnection} with this information.
     *
     * @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());
            return true;
        }
        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
@@ -921,10 +885,6 @@ public class ImsPhoneConnection extends Connection implements
        if (extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE) ||
                extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {

            // 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;

            ImsCall call = getImsCall();
            boolean isWifi = false;
            if (call != null) {
+0 −4
Original line number Diff line number Diff line
@@ -248,8 +248,6 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
                ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
        assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
        assertTrue(mConnectionUT.isWifi());
        //keep using the wifi state from extra, not update
        assertFalse(mConnectionUT.updateWifiState());
    }

    @Test
@@ -265,7 +263,5 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
                ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
        assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
        assertTrue(mConnectionUT.isWifi());
        //keep using the wifi state from extra, not update
        assertFalse(mConnectionUT.updateWifiState());
    }
}