Merge "Make wifi calling slice consistent" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
b3b27451a3
@@ -131,12 +131,7 @@ public class WifiCallingSliceHelper {
|
|||||||
public Slice createWifiCallingSlice(Uri sliceUri) {
|
public Slice createWifiCallingSlice(Uri sliceUri) {
|
||||||
final int subId = getDefaultVoiceSubId();
|
final int subId = getDefaultVoiceSubId();
|
||||||
|
|
||||||
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
if (!queryImsState(subId).isReadyToWifiCalling()) {
|
||||||
Log.d(TAG, "Invalid subscription Id");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!queryImsState(subId).isWifiCallingProvisioned()) {
|
|
||||||
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by Platform");
|
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by Platform");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -223,7 +218,7 @@ public class WifiCallingSliceHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!queryImsState(subId).isWifiCallingProvisioned()) {
|
if (!queryImsState(subId).isReadyToWifiCalling()) {
|
||||||
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
|
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ public class MockWifiCallingQueryImsState extends WifiCallingQueryImsState {
|
|||||||
private Boolean mIsProvisionedOnDevice;
|
private Boolean mIsProvisionedOnDevice;
|
||||||
private Boolean mIsServiceStateReady;
|
private Boolean mIsServiceStateReady;
|
||||||
private Boolean mIsEnabledByUser;
|
private Boolean mIsEnabledByUser;
|
||||||
|
private Boolean mIsReadyToWifiCalling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -103,4 +104,16 @@ public class MockWifiCallingQueryImsState extends WifiCallingQueryImsState {
|
|||||||
return super.isEnabledByUser(subId);
|
return super.isEnabledByUser(subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsReadyToWifiCalling(boolean isReady) {
|
||||||
|
mIsReadyToWifiCalling = isReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReadyToWifiCalling() {
|
||||||
|
if (mIsReadyToWifiCalling != null) {
|
||||||
|
return mIsReadyToWifiCalling;
|
||||||
|
}
|
||||||
|
return super.isReadyToWifiCalling();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -112,6 +112,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsEnabledByPlatform(true);
|
mQueryImsState.setIsEnabledByPlatform(true);
|
||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
|
|
||||||
mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
|
mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
|
||||||
doReturn(mQueryImsState).when(mWfcSliceHelper).queryImsState(anyInt());
|
doReturn(mQueryImsState).when(mWfcSliceHelper).queryImsState(anyInt());
|
||||||
@@ -125,6 +126,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsProvisionedOnDevice(false);
|
mQueryImsState.setIsProvisionedOnDevice(false);
|
||||||
mWfcSliceHelper.setDefaultVoiceSubId(-1);
|
mWfcSliceHelper.setDefaultVoiceSubId(-1);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
|
|
||||||
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
||||||
CustomSliceRegistry.WIFI_CALLING_URI);
|
CustomSliceRegistry.WIFI_CALLING_URI);
|
||||||
@@ -135,6 +137,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_CreateWifiCallingSlice_wfcNotSupported() {
|
public void test_CreateWifiCallingSlice_wfcNotSupported() {
|
||||||
mQueryImsState.setIsProvisionedOnDevice(false);
|
mQueryImsState.setIsProvisionedOnDevice(false);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(false);
|
||||||
|
|
||||||
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
||||||
CustomSliceRegistry.WIFI_CALLING_URI);
|
CustomSliceRegistry.WIFI_CALLING_URI);
|
||||||
@@ -153,6 +156,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(false);
|
mQueryImsState.setIsEnabledByUser(false);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(false);
|
mQueryImsState.setIsTtyOnVolteEnabled(false);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
mWfcSliceHelper.setActivationAppIntent(new Intent()); // unused Intent
|
mWfcSliceHelper.setActivationAppIntent(new Intent()); // unused Intent
|
||||||
|
|
||||||
@@ -170,6 +174,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
|
|
||||||
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
|
||||||
@@ -184,6 +189,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
||||||
.thenReturn(mWfcSliceHelper);
|
.thenReturn(mWfcSliceHelper);
|
||||||
@@ -200,6 +206,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(false);
|
mQueryImsState.setIsEnabledByUser(false);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
||||||
.thenReturn(mWfcSliceHelper);
|
.thenReturn(mWfcSliceHelper);
|
||||||
mWfcSliceHelper.setActivationAppIntent(null);
|
mWfcSliceHelper.setActivationAppIntent(null);
|
||||||
@@ -225,6 +232,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
|
mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(false);
|
||||||
|
|
||||||
final Slice slice = mWfcSliceHelper.createWifiCallingPreferenceSlice(
|
final Slice slice = mWfcSliceHelper.createWifiCallingPreferenceSlice(
|
||||||
CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI);
|
CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI);
|
||||||
@@ -254,6 +262,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
||||||
mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
|
mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
|
||||||
@@ -271,6 +280,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
||||||
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
||||||
@@ -289,6 +299,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
mQueryImsState.setIsTtyOnVolteEnabled(true);
|
||||||
|
mQueryImsState.setIsReadyToWifiCalling(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED);
|
||||||
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
||||||
|
Reference in New Issue
Block a user