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
This commit is contained in:
Mill Chen
2023-06-29 17:49:33 +08:00
parent 3411c09fa9
commit fbe8e9f571
3 changed files with 26 additions and 7 deletions

View File

@@ -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();
}
}

View File

@@ -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))