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

Commit fbe8e9f5 authored by Mill Chen's avatar Mill Chen
Browse files

Make wifi calling slice consistent

The wifi calling search result is grayed out if it is not using
carrier WFC. In order to ensure the search result is aligned with the
corresponding settings, the checker of wifi calling slice will be the
same with wifi calling preference.

Bug: 285594611
Test: manual test
Change-Id: I22d794332a0cc2ecbcb8b5e8836364e926400cbf
parent 3411c09f
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -131,12 +131,7 @@ public class WifiCallingSliceHelper {
    public Slice createWifiCallingSlice(Uri sliceUri) {
        final int subId = getDefaultVoiceSubId();

        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            Log.d(TAG, "Invalid subscription Id");
            return null;
        }

        if (!queryImsState(subId).isWifiCallingProvisioned()) {
        if (!queryImsState(subId).isReadyToWifiCalling()) {
            Log.d(TAG, "Wifi calling is either not provisioned or not enabled by Platform");
            return null;
        }
@@ -223,7 +218,7 @@ public class WifiCallingSliceHelper {
            return null;
        }

        if (!queryImsState(subId).isWifiCallingProvisioned()) {
        if (!queryImsState(subId).isReadyToWifiCalling()) {
            Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
            return null;
        }
+13 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ public class MockWifiCallingQueryImsState extends WifiCallingQueryImsState {
    private Boolean mIsProvisionedOnDevice;
    private Boolean mIsServiceStateReady;
    private Boolean mIsEnabledByUser;
    private Boolean mIsReadyToWifiCalling;

    /**
     * Constructor
@@ -103,4 +104,16 @@ public class MockWifiCallingQueryImsState extends WifiCallingQueryImsState {
        return super.isEnabledByUser(subId);
    }

    public void setIsReadyToWifiCalling(boolean isReady) {
        mIsReadyToWifiCalling = isReady;
    }

    @Override
    public boolean isReadyToWifiCalling() {
        if (mIsReadyToWifiCalling != null) {
            return mIsReadyToWifiCalling;
        }
        return super.isReadyToWifiCalling();
    }

}
+11 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsEnabledByPlatform(true);
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsReadyToWifiCalling(true);

        mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
        doReturn(mQueryImsState).when(mWfcSliceHelper).queryImsState(anyInt());
@@ -125,6 +126,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsProvisionedOnDevice(false);
        mWfcSliceHelper.setDefaultVoiceSubId(-1);
        mQueryImsState.setIsReadyToWifiCalling(true);

        final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
                CustomSliceRegistry.WIFI_CALLING_URI);
@@ -135,6 +137,7 @@ public class WifiCallingSliceHelperTest {
    @Test
    public void test_CreateWifiCallingSlice_wfcNotSupported() {
        mQueryImsState.setIsProvisionedOnDevice(false);
        mQueryImsState.setIsReadyToWifiCalling(false);

        final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
                CustomSliceRegistry.WIFI_CALLING_URI);
@@ -153,6 +156,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(false);
        mQueryImsState.setIsTtyOnVolteEnabled(false);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
        mWfcSliceHelper.setActivationAppIntent(new Intent()); // unused Intent

@@ -170,6 +174,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);

        final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
@@ -184,6 +189,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
        when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
                .thenReturn(mWfcSliceHelper);
@@ -200,6 +206,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(false);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
                .thenReturn(mWfcSliceHelper);
        mWfcSliceHelper.setActivationAppIntent(null);
@@ -225,6 +232,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
        mQueryImsState.setIsReadyToWifiCalling(false);

        final Slice slice = mWfcSliceHelper.createWifiCallingPreferenceSlice(
                CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI);
@@ -254,6 +262,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
                ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
        mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
@@ -271,6 +280,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
                ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
        when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
@@ -289,6 +299,7 @@ public class WifiCallingSliceHelperTest {
        mQueryImsState.setIsProvisionedOnDevice(true);
        mQueryImsState.setIsEnabledByUser(true);
        mQueryImsState.setIsTtyOnVolteEnabled(true);
        mQueryImsState.setIsReadyToWifiCalling(true);
        when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
                ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
        when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))