[Settings] Remove isWfcProvisionedOnDevice API
Replace isWfcProvisionedOnDevice() by IMS's ProvisioningManager. Bug: 140542283 Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSettingsTest make RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSettingsForSubTest make RunSettingsRoboTests -j ROBOTEST_FILTER=WifiCallingSliceHelperTest make RunSettingsRoboTests -j ROBOTEST_FILTER=MobileNetworkUtilsTest Change-Id: Idb063bdab3d3b11c348804c1c0ecb268cca3068e
This commit is contained in:
@@ -38,7 +38,10 @@ import android.telephony.SubscriptionInfo;
|
|||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.euicc.EuiccManager;
|
import android.telephony.euicc.EuiccManager;
|
||||||
|
import android.telephony.ims.ProvisioningManager;
|
||||||
import android.telephony.ims.feature.ImsFeature;
|
import android.telephony.ims.feature.ImsFeature;
|
||||||
|
import android.telephony.ims.feature.MmTelFeature;
|
||||||
|
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -96,7 +99,7 @@ public class MobileNetworkUtils {
|
|||||||
* Returns true if Wifi calling is enabled for at least one subscription.
|
* Returns true if Wifi calling is enabled for at least one subscription.
|
||||||
*/
|
*/
|
||||||
public static boolean isWifiCallingEnabled(Context context) {
|
public static boolean isWifiCallingEnabled(Context context) {
|
||||||
SubscriptionManager subManager = context.getSystemService(SubscriptionManager.class);
|
final SubscriptionManager subManager = context.getSystemService(SubscriptionManager.class);
|
||||||
if (subManager == null) {
|
if (subManager == null) {
|
||||||
Log.e(TAG, "isWifiCallingEnabled: couldn't get system service.");
|
Log.e(TAG, "isWifiCallingEnabled: couldn't get system service.");
|
||||||
return false;
|
return false;
|
||||||
@@ -109,6 +112,22 @@ public class MobileNetworkUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if Wifi calling is provisioned for the specific subscription with id
|
||||||
|
* {@code subId}.
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
public static boolean isWfcProvisionedOnDevice(int subId) {
|
||||||
|
final ProvisioningManager provisioningMgr =
|
||||||
|
ProvisioningManager.createForSubscriptionId(subId);
|
||||||
|
if (provisioningMgr == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return provisioningMgr.getProvisioningStatusForCapability(
|
||||||
|
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
|
||||||
|
ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if Wifi calling is enabled for the specific subscription with id {@code subId}.
|
* Returns true if Wifi calling is enabled for the specific subscription with id {@code subId}.
|
||||||
*/
|
*/
|
||||||
@@ -119,15 +138,15 @@ public class MobileNetworkUtils {
|
|||||||
|
|
||||||
boolean isWifiCallingEnabled;
|
boolean isWifiCallingEnabled;
|
||||||
if (simCallManager != null) {
|
if (simCallManager != null) {
|
||||||
Intent intent = buildPhoneAccountConfigureIntent(
|
final Intent intent = buildPhoneAccountConfigureIntent(
|
||||||
context, simCallManager);
|
context, simCallManager);
|
||||||
|
|
||||||
isWifiCallingEnabled = intent != null;
|
isWifiCallingEnabled = intent != null;
|
||||||
} else {
|
} else {
|
||||||
ImsManager imsMgr = ImsManager.getInstance(context, phoneId);
|
final ImsManager imsMgr = ImsManager.getInstance(context, phoneId);
|
||||||
isWifiCallingEnabled = imsMgr != null
|
isWifiCallingEnabled = imsMgr != null
|
||||||
&& imsMgr.isWfcEnabledByPlatform()
|
&& imsMgr.isWfcEnabledByPlatform()
|
||||||
&& imsMgr.isWfcProvisionedOnDevice()
|
&& isWfcProvisionedOnDevice(subId)
|
||||||
&& isImsServiceStateReady(imsMgr);
|
&& isImsServiceStateReady(imsMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +181,8 @@ public class MobileNetworkUtils {
|
|||||||
intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);
|
intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);
|
||||||
|
|
||||||
// Check to see that the phone account package can handle the setting intent.
|
// Check to see that the phone account package can handle the setting intent.
|
||||||
PackageManager pm = context.getPackageManager();
|
final PackageManager pm = context.getPackageManager();
|
||||||
List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
|
final List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
|
||||||
if (resolutions.size() == 0) {
|
if (resolutions.size() == 0) {
|
||||||
intent = null; // set no intent if the package cannot handle it.
|
intent = null; // set no intent if the package cannot handle it.
|
||||||
}
|
}
|
||||||
@@ -194,7 +213,7 @@ public class MobileNetworkUtils {
|
|||||||
* the user has enabled development mode.
|
* the user has enabled development mode.
|
||||||
*/
|
*/
|
||||||
public static boolean showEuiccSettings(Context context) {
|
public static boolean showEuiccSettings(Context context) {
|
||||||
EuiccManager euiccManager =
|
final EuiccManager euiccManager =
|
||||||
(EuiccManager) context.getSystemService(EuiccManager.class);
|
(EuiccManager) context.getSystemService(EuiccManager.class);
|
||||||
if (!euiccManager.isEnabled()) {
|
if (!euiccManager.isEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -202,16 +221,16 @@ public class MobileNetworkUtils {
|
|||||||
|
|
||||||
final ContentResolver cr = context.getContentResolver();
|
final ContentResolver cr = context.getContentResolver();
|
||||||
|
|
||||||
TelephonyManager tm =
|
final TelephonyManager tm =
|
||||||
(TelephonyManager) context.getSystemService(TelephonyManager.class);
|
(TelephonyManager) context.getSystemService(TelephonyManager.class);
|
||||||
String currentCountry = tm.getNetworkCountryIso().toLowerCase();
|
final String currentCountry = tm.getNetworkCountryIso().toLowerCase();
|
||||||
String supportedCountries =
|
final String supportedCountries =
|
||||||
Settings.Global.getString(cr, Settings.Global.EUICC_SUPPORTED_COUNTRIES);
|
Settings.Global.getString(cr, Settings.Global.EUICC_SUPPORTED_COUNTRIES);
|
||||||
boolean inEsimSupportedCountries = false;
|
boolean inEsimSupportedCountries = false;
|
||||||
if (TextUtils.isEmpty(currentCountry)) {
|
if (TextUtils.isEmpty(currentCountry)) {
|
||||||
inEsimSupportedCountries = true;
|
inEsimSupportedCountries = true;
|
||||||
} else if (!TextUtils.isEmpty(supportedCountries)) {
|
} else if (!TextUtils.isEmpty(supportedCountries)) {
|
||||||
List<String> supportedCountryList =
|
final List<String> supportedCountryList =
|
||||||
Arrays.asList(TextUtils.split(supportedCountries.toLowerCase(), ","));
|
Arrays.asList(TextUtils.split(supportedCountries.toLowerCase(), ","));
|
||||||
if (supportedCountryList.contains(currentCountry)) {
|
if (supportedCountryList.contains(currentCountry)) {
|
||||||
inEsimSupportedCountries = true;
|
inEsimSupportedCountries = true;
|
||||||
@@ -244,7 +263,7 @@ public class MobileNetworkUtils {
|
|||||||
telephonyManager.setDataEnabled(enabled);
|
telephonyManager.setDataEnabled(enabled);
|
||||||
|
|
||||||
if (disableOtherSubscriptions) {
|
if (disableOtherSubscriptions) {
|
||||||
List<SubscriptionInfo> subInfoList =
|
final List<SubscriptionInfo> subInfoList =
|
||||||
subscriptionManager.getActiveSubscriptionInfoList(true);
|
subscriptionManager.getActiveSubscriptionInfoList(true);
|
||||||
if (subInfoList != null) {
|
if (subInfoList != null) {
|
||||||
for (SubscriptionInfo subInfo : subInfoList) {
|
for (SubscriptionInfo subInfo : subInfoList) {
|
||||||
@@ -358,7 +377,7 @@ public class MobileNetworkUtils {
|
|||||||
* Return {@code true} if we need show settings for network selection(i.e. Verizon)
|
* Return {@code true} if we need show settings for network selection(i.e. Verizon)
|
||||||
*/
|
*/
|
||||||
public static boolean shouldDisplayNetworkSelectOptions(Context context, int subId) {
|
public static boolean shouldDisplayNetworkSelectOptions(Context context, int subId) {
|
||||||
final TelephonyManager telephonyManager = TelephonyManager.from(context)
|
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
|
||||||
.createForSubscriptionId(subId);
|
.createForSubscriptionId(subId);
|
||||||
final PersistableBundle carrierConfig = context.getSystemService(
|
final PersistableBundle carrierConfig = context.getSystemService(
|
||||||
CarrierConfigManager.class).getConfigForSubId(subId);
|
CarrierConfigManager.class).getConfigForSubId(subId);
|
||||||
@@ -419,8 +438,8 @@ public class MobileNetworkUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String operatorNumeric = telephonyManager.getServiceState().getOperatorNumeric();
|
final String operatorNumeric = telephonyManager.getServiceState().getOperatorNumeric();
|
||||||
String[] numericArray = carrierConfig.getStringArray(
|
final String[] numericArray = carrierConfig.getStringArray(
|
||||||
CarrierConfigManager.KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY);
|
CarrierConfigManager.KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY);
|
||||||
if (numericArray == null || operatorNumeric == null) {
|
if (numericArray == null || operatorNumeric == null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -511,12 +530,12 @@ public class MobileNetworkUtils {
|
|||||||
|
|
||||||
public static Drawable getSignalStrengthIcon(Context context, int level, int numLevels,
|
public static Drawable getSignalStrengthIcon(Context context, int level, int numLevels,
|
||||||
int iconType, boolean cutOut) {
|
int iconType, boolean cutOut) {
|
||||||
SignalDrawable signalDrawable = new SignalDrawable(context);
|
final SignalDrawable signalDrawable = new SignalDrawable(context);
|
||||||
signalDrawable.setLevel(
|
signalDrawable.setLevel(
|
||||||
SignalDrawable.getState(level, numLevels, cutOut));
|
SignalDrawable.getState(level, numLevels, cutOut));
|
||||||
|
|
||||||
// Make the network type drawable
|
// Make the network type drawable
|
||||||
Drawable networkDrawable =
|
final Drawable networkDrawable =
|
||||||
iconType == NO_CELL_DATA_TYPE_ICON
|
iconType == NO_CELL_DATA_TYPE_ICON
|
||||||
? EMPTY_DRAWABLE
|
? EMPTY_DRAWABLE
|
||||||
: context
|
: context
|
||||||
@@ -527,7 +546,7 @@ public class MobileNetworkUtils {
|
|||||||
final int iconSize =
|
final int iconSize =
|
||||||
context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
|
context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
|
||||||
|
|
||||||
LayerDrawable icons = new LayerDrawable(layers);
|
final LayerDrawable icons = new LayerDrawable(layers);
|
||||||
// Set the network type icon at the top left
|
// Set the network type icon at the top left
|
||||||
icons.setLayerGravity(0 /* index of networkDrawable */, Gravity.TOP | Gravity.LEFT);
|
icons.setLayerGravity(0 /* index of networkDrawable */, Gravity.TOP | Gravity.LEFT);
|
||||||
// Set the signal strength icon at the bottom right
|
// Set the signal strength icon at the bottom right
|
||||||
@@ -545,9 +564,9 @@ public class MobileNetworkUtils {
|
|||||||
* 2. Similar design which aligned with operator name displayed in status bar
|
* 2. Similar design which aligned with operator name displayed in status bar
|
||||||
*/
|
*/
|
||||||
public static CharSequence getCurrentCarrierNameForDisplay(Context context, int subId) {
|
public static CharSequence getCurrentCarrierNameForDisplay(Context context, int subId) {
|
||||||
SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
final SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
SubscriptionInfo subInfo = getSubscriptionInfo(sm, subId);
|
final SubscriptionInfo subInfo = getSubscriptionInfo(sm, subId);
|
||||||
if (subInfo != null) {
|
if (subInfo != null) {
|
||||||
return subInfo.getCarrierName();
|
return subInfo.getCarrierName();
|
||||||
}
|
}
|
||||||
@@ -556,10 +575,10 @@ public class MobileNetworkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CharSequence getCurrentCarrierNameForDisplay(Context context) {
|
public static CharSequence getCurrentCarrierNameForDisplay(Context context) {
|
||||||
SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
final SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
int subId = sm.getDefaultSubscriptionId();
|
final int subId = sm.getDefaultSubscriptionId();
|
||||||
SubscriptionInfo subInfo = getSubscriptionInfo(sm, subId);
|
final SubscriptionInfo subInfo = getSubscriptionInfo(sm, subId);
|
||||||
if (subInfo != null) {
|
if (subInfo != null) {
|
||||||
return subInfo.getCarrierName();
|
return subInfo.getCarrierName();
|
||||||
}
|
}
|
||||||
@@ -585,7 +604,7 @@ public class MobileNetworkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getOperatorNameFromTelephonyManager(Context context) {
|
private static String getOperatorNameFromTelephonyManager(Context context) {
|
||||||
TelephonyManager tm =
|
final TelephonyManager tm =
|
||||||
(TelephonyManager) context.getSystemService(TelephonyManager.class);
|
(TelephonyManager) context.getSystemService(TelephonyManager.class);
|
||||||
if (tm == null) {
|
if (tm == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@@ -179,7 +179,7 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void register(int subId) {
|
public void register(int subId) {
|
||||||
mSubId = subId;
|
WifiCallingPreferenceController.this.mSubId = subId;
|
||||||
mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
|
mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@ import android.os.Bundle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.telephony.ims.ProvisioningManager;
|
||||||
|
import android.telephony.ims.feature.MmTelFeature;
|
||||||
|
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -100,11 +103,11 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
|||||||
if (mSil == null) {
|
if (mSil == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent intent = getActivity().getIntent();
|
final Intent intent = getActivity().getIntent();
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int subId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
final int subId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
||||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
if (SubscriptionManager.isValidSubscriptionId(subId)) {
|
if (SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||||
for (SubscriptionInfo subInfo : mSil) {
|
for (SubscriptionInfo subInfo : mSil) {
|
||||||
@@ -168,7 +171,7 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
|||||||
args.putBoolean(SearchMenuController.NEED_SEARCH_ICON_IN_ACTION_BAR, false);
|
args.putBoolean(SearchMenuController.NEED_SEARCH_ICON_IN_ACTION_BAR, false);
|
||||||
args.putInt(WifiCallingSettingsForSub.FRAGMENT_BUNDLE_SUBID,
|
args.putInt(WifiCallingSettingsForSub.FRAGMENT_BUNDLE_SUBID,
|
||||||
mSil.get(position).getSubscriptionId());
|
mSil.get(position).getSubscriptionId());
|
||||||
WifiCallingSettingsForSub fragment = new WifiCallingSettingsForSub();
|
final WifiCallingSettingsForSub fragment = new WifiCallingSettingsForSub();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
|
|
||||||
return fragment;
|
return fragment;
|
||||||
@@ -195,14 +198,21 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean isWfcEnabledByPlatform(SubscriptionInfo info) {
|
boolean isWfcEnabledByPlatform(SubscriptionInfo info) {
|
||||||
ImsManager imsManager = ImsManager.getInstance(getActivity(), info.getSimSlotIndex());
|
final ImsManager imsManager = ImsManager.getInstance(getActivity(),
|
||||||
|
info.getSimSlotIndex());
|
||||||
return imsManager.isWfcEnabledByPlatform();
|
return imsManager.isWfcEnabledByPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean isWfcProvisionedOnDevice(SubscriptionInfo info) {
|
boolean isWfcProvisionedOnDevice(SubscriptionInfo info) {
|
||||||
ImsManager imsManager = ImsManager.getInstance(getActivity(), info.getSimSlotIndex());
|
final ProvisioningManager provisioningMgr =
|
||||||
return imsManager.isWfcProvisionedOnDevice();
|
ProvisioningManager.createForSubscriptionId(info.getSubscriptionId());
|
||||||
|
if (provisioningMgr == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return provisioningMgr.getProvisioningStatusForCapability(
|
||||||
|
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
|
||||||
|
ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSubList() {
|
private void updateSubList() {
|
||||||
|
@@ -55,6 +55,7 @@ import com.android.settings.SettingsActivity;
|
|||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
|
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,8 +308,13 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean isWfcProvisionedOnDevice() {
|
||||||
|
return MobileNetworkUtils.isWfcProvisionedOnDevice(mSubId);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateBody() {
|
private void updateBody() {
|
||||||
if (!mImsManager.isWfcProvisionedOnDevice()) {
|
if (!isWfcProvisionedOnDevice()) {
|
||||||
// This screen is not allowed to be shown due to provisioning policy and should
|
// This screen is not allowed to be shown due to provisioning policy and should
|
||||||
// therefore be closed.
|
// therefore be closed.
|
||||||
finish();
|
finish();
|
||||||
|
@@ -45,6 +45,7 @@ import com.android.ims.ImsConfig;
|
|||||||
import com.android.ims.ImsManager;
|
import com.android.ims.ImsManager;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||||
import com.android.settings.slices.SliceBroadcastReceiver;
|
import com.android.settings.slices.SliceBroadcastReceiver;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -139,7 +140,7 @@ public class WifiCallingSliceHelper {
|
|||||||
final ImsManager imsManager = getImsManager(subId);
|
final ImsManager imsManager = getImsManager(subId);
|
||||||
|
|
||||||
if (!imsManager.isWfcEnabledByPlatform()
|
if (!imsManager.isWfcEnabledByPlatform()
|
||||||
|| !imsManager.isWfcProvisionedOnDevice()) {
|
|| !isWfcProvisionedOnDevice(subId)) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -237,7 +238,7 @@ public class WifiCallingSliceHelper {
|
|||||||
final ImsMmTelManager imsMmTelManager = getImsMmTelManager(subId);
|
final ImsMmTelManager imsMmTelManager = getImsMmTelManager(subId);
|
||||||
|
|
||||||
if (!imsManager.isWfcEnabledByPlatform()
|
if (!imsManager.isWfcEnabledByPlatform()
|
||||||
|| !imsManager.isWfcProvisionedOnDevice()) {
|
|| !isWfcProvisionedOnDevice(subId)) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -386,7 +387,7 @@ public class WifiCallingSliceHelper {
|
|||||||
if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||||
final ImsManager imsManager = getImsManager(subId);
|
final ImsManager imsManager = getImsManager(subId);
|
||||||
if (imsManager.isWfcEnabledByPlatform()
|
if (imsManager.isWfcEnabledByPlatform()
|
||||||
&& imsManager.isWfcProvisionedOnDevice()) {
|
&& isWfcProvisionedOnDevice(subId)) {
|
||||||
final boolean currentValue = imsManager.isWfcEnabledByUser()
|
final boolean currentValue = imsManager.isWfcEnabledByUser()
|
||||||
&& imsManager.isNonTtyOrTtyOnVolteEnabled();
|
&& imsManager.isNonTtyOrTtyOnVolteEnabled();
|
||||||
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
||||||
@@ -429,7 +430,7 @@ public class WifiCallingSliceHelper {
|
|||||||
final ImsManager imsManager = getImsManager(subId);
|
final ImsManager imsManager = getImsManager(subId);
|
||||||
if (isWifiCallingPrefEditable
|
if (isWifiCallingPrefEditable
|
||||||
&& imsManager.isWfcEnabledByPlatform()
|
&& imsManager.isWfcEnabledByPlatform()
|
||||||
&& imsManager.isWfcProvisionedOnDevice()
|
&& isWfcProvisionedOnDevice(subId)
|
||||||
&& imsManager.isWfcEnabledByUser()
|
&& imsManager.isWfcEnabledByUser()
|
||||||
&& imsManager.isNonTtyOrTtyOnVolteEnabled()) {
|
&& imsManager.isNonTtyOrTtyOnVolteEnabled()) {
|
||||||
// Change the preference only when wifi calling is enabled
|
// Change the preference only when wifi calling is enabled
|
||||||
@@ -512,6 +513,11 @@ public class WifiCallingSliceHelper {
|
|||||||
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean isWfcProvisionedOnDevice(int subId) {
|
||||||
|
return MobileNetworkUtils.isWfcProvisionedOnDevice(subId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Intent of the activation app required to activate wifi calling or null if there is no
|
* Returns Intent of the activation app required to activate wifi calling or null if there is no
|
||||||
* need for activation.
|
* need for activation.
|
||||||
|
@@ -17,15 +17,18 @@
|
|||||||
package com.android.settings.wifi.calling;
|
package com.android.settings.wifi.calling;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.telephony.SubscriptionManager;
|
||||||
|
|
||||||
import com.android.ims.ImsManager;
|
import com.android.ims.ImsManager;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
|
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||||
|
|
||||||
public class WifiCallingSuggestionActivity extends SettingsActivity {
|
public class WifiCallingSuggestionActivity extends SettingsActivity {
|
||||||
|
|
||||||
public static boolean isSuggestionComplete(Context context) {
|
public static boolean isSuggestionComplete(Context context) {
|
||||||
if (!ImsManager.isWfcEnabledByPlatform(context) ||
|
if (!ImsManager.isWfcEnabledByPlatform(context) ||
|
||||||
!ImsManager.isWfcProvisionedOnDevice(context)) {
|
!MobileNetworkUtils.isWfcProvisionedOnDevice(
|
||||||
|
SubscriptionManager.getDefaultVoiceSubscriptionId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ImsManager.isWfcEnabledByUser(context)
|
return ImsManager.isWfcEnabledByUser(context)
|
||||||
|
@@ -130,7 +130,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
doReturn(mImsManager).when(mFragment).getImsManager();
|
doReturn(mImsManager).when(mFragment).getImsManager();
|
||||||
doReturn(mImsMmTelManager).when(mFragment).getImsMmTelManager();
|
doReturn(mImsMmTelManager).when(mFragment).getImsMmTelManager();
|
||||||
doReturn(mImsConfig).when(mImsManager).getConfigInterface();
|
doReturn(mImsConfig).when(mImsManager).getConfigInterface();
|
||||||
doReturn(true).when(mImsManager).isWfcProvisionedOnDevice();
|
doReturn(true).when(mFragment).isWfcProvisionedOnDevice();
|
||||||
doReturn(true).when(mImsManager).isWfcEnabledByUser();
|
doReturn(true).when(mImsManager).isWfcEnabledByUser();
|
||||||
doReturn(true).when(mImsManager).isNonTtyOrTtyOnVolteEnabled();
|
doReturn(true).when(mImsManager).isNonTtyOrTtyOnVolteEnabled();
|
||||||
doReturn(ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED)
|
doReturn(ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED)
|
||||||
@@ -178,7 +178,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
@Test
|
@Test
|
||||||
public void onResume_provisioningDisallowed_shouldFinish() {
|
public void onResume_provisioningDisallowed_shouldFinish() {
|
||||||
// Call onResume while provisioning is disallowed.
|
// Call onResume while provisioning is disallowed.
|
||||||
doReturn(false).when(mImsManager).isWfcProvisionedOnDevice();
|
doReturn(false).when(mFragment).isWfcProvisionedOnDevice();
|
||||||
mFragment.onResume();
|
mFragment.onResume();
|
||||||
|
|
||||||
// Verify that finish() is called
|
// Verify that finish() is called
|
||||||
|
@@ -64,72 +64,75 @@ public class WifiCallingSettingsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupFragment_oneSubscription_noCrash() {
|
public void setupFragment_oneSubscription_noCrash() {
|
||||||
SubscriptionInfo info = mock(SubscriptionInfo.class);
|
final SubscriptionInfo info = mock(SubscriptionInfo.class);
|
||||||
when(info.getSubscriptionId()).thenReturn(111);
|
when(info.getSubscriptionId()).thenReturn(111);
|
||||||
|
|
||||||
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
||||||
Collections.singletonList(info)));
|
Collections.singletonList(info)));
|
||||||
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
||||||
|
doReturn(true).when(mFragment).isWfcProvisionedOnDevice(any(SubscriptionInfo.class));
|
||||||
|
|
||||||
Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
|
intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
|
||||||
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
||||||
null /* bundle */).start().resume().visible().get();
|
null /* bundle */).start().resume().visible().get();
|
||||||
|
|
||||||
View view = mFragment.getView();
|
final View view = mFragment.getView();
|
||||||
RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
final RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
||||||
WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
final WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
||||||
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
||||||
assertThat(adapter.getCount()).isEqualTo(1);
|
assertThat(adapter.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupFragment_twoSubscriptions_correctSelection() {
|
public void setupFragment_twoSubscriptions_correctSelection() {
|
||||||
SubscriptionInfo info1 = mock(SubscriptionInfo.class);
|
final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
|
||||||
SubscriptionInfo info2 = mock(SubscriptionInfo.class);
|
final SubscriptionInfo info2 = mock(SubscriptionInfo.class);
|
||||||
when(info1.getSubscriptionId()).thenReturn(111);
|
when(info1.getSubscriptionId()).thenReturn(111);
|
||||||
when(info2.getSubscriptionId()).thenReturn(222);
|
when(info2.getSubscriptionId()).thenReturn(222);
|
||||||
|
|
||||||
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
||||||
Arrays.asList(info1, info2)));
|
Arrays.asList(info1, info2)));
|
||||||
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
||||||
|
doReturn(true).when(mFragment).isWfcProvisionedOnDevice(any(SubscriptionInfo.class));
|
||||||
|
|
||||||
Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra(Settings.EXTRA_SUB_ID, info2.getSubscriptionId());
|
intent.putExtra(Settings.EXTRA_SUB_ID, info2.getSubscriptionId());
|
||||||
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
||||||
null /* bundle */).start().resume().visible().get();
|
null /* bundle */).start().resume().visible().get();
|
||||||
|
|
||||||
View view = mFragment.getView();
|
final View view = mFragment.getView();
|
||||||
RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
final RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
||||||
assertThat(pager.getCurrentItem()).isEqualTo(1);
|
assertThat(pager.getCurrentItem()).isEqualTo(1);
|
||||||
|
|
||||||
WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
final WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
||||||
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
||||||
assertThat(adapter.getCount()).isEqualTo(2);
|
assertThat(adapter.getCount()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupFragment_twoSubscriptionsOneNotProvisionedOnDevice_oneResult() {
|
public void setupFragment_twoSubscriptionsOneNotProvisionedOnDevice_oneResult() {
|
||||||
SubscriptionInfo info1 = mock(SubscriptionInfo.class);
|
final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
|
||||||
SubscriptionInfo info2 = mock(SubscriptionInfo.class);
|
final SubscriptionInfo info2 = mock(SubscriptionInfo.class);
|
||||||
when(info1.getSubscriptionId()).thenReturn(111);
|
when(info1.getSubscriptionId()).thenReturn(111);
|
||||||
when(info2.getSubscriptionId()).thenReturn(222);
|
when(info2.getSubscriptionId()).thenReturn(222);
|
||||||
|
|
||||||
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
|
||||||
Arrays.asList(info1, info2)));
|
Arrays.asList(info1, info2)));
|
||||||
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
doReturn(true).when(mFragment).isWfcEnabledByPlatform(any(SubscriptionInfo.class));
|
||||||
|
doReturn(true).when(mFragment).isWfcProvisionedOnDevice(eq(info1));
|
||||||
doReturn(false).when(mFragment).isWfcProvisionedOnDevice(eq(info2));
|
doReturn(false).when(mFragment).isWfcProvisionedOnDevice(eq(info2));
|
||||||
|
|
||||||
Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra(Settings.EXTRA_SUB_ID, info1.getSubscriptionId());
|
intent.putExtra(Settings.EXTRA_SUB_ID, info1.getSubscriptionId());
|
||||||
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
FragmentController.of(mFragment, intent).create(0 /* containerViewId*/,
|
||||||
null /* bundle */).start().resume().visible().get();
|
null /* bundle */).start().resume().visible().get();
|
||||||
|
|
||||||
View view = mFragment.getView();
|
final View view = mFragment.getView();
|
||||||
RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
final RtlCompatibleViewPager pager = view.findViewById(R.id.view_pager);
|
||||||
assertThat(pager.getCurrentItem()).isEqualTo(0);
|
assertThat(pager.getCurrentItem()).isEqualTo(0);
|
||||||
|
|
||||||
WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
final WifiCallingSettings.WifiCallingViewPagerAdapter adapter =
|
||||||
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
(WifiCallingSettings.WifiCallingViewPagerAdapter) pager.getAdapter();
|
||||||
assertThat(adapter.getCount()).isEqualTo(1);
|
assertThat(adapter.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@ import static android.app.slice.SliceItem.FORMAT_TEXT;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@@ -100,7 +101,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||||
mSlicesFeatureProvider = mFeatureFactory.getSlicesFeatureProvider();
|
mSlicesFeatureProvider = mFeatureFactory.getSlicesFeatureProvider();
|
||||||
|
|
||||||
mWfcSliceHelper = new FakeWifiCallingSliceHelper(mContext);
|
mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
|
||||||
|
|
||||||
// Set-up specs for SliceMetadata.
|
// Set-up specs for SliceMetadata.
|
||||||
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
|
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
|
||||||
@@ -135,7 +136,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
activity so the user can perform the activation there.(PrimaryAction)
|
activity so the user can perform the activation there.(PrimaryAction)
|
||||||
*/
|
*/
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(false);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(false);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
@@ -153,7 +154,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_CreateWifiCallingSlice_success() {
|
public void test_CreateWifiCallingSlice_success() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
@@ -168,7 +169,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_SettingSliceProvider_getsRightSliceWifiCalling() {
|
public void test_SettingSliceProvider_getsRightSliceWifiCalling() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
|
||||||
@@ -184,7 +185,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_SliceBroadcastReceiver_toggleOnWifiCalling() {
|
public void test_SliceBroadcastReceiver_toggleOnWifiCalling() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
|
||||||
@@ -209,7 +210,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_CreateWifiCallingPreferenceSlice_prefNotEditable() {
|
public void test_CreateWifiCallingPreferenceSlice_prefNotEditable() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
|
mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
|
||||||
@@ -224,7 +225,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_CreateWifiCallingPreferenceSlice_wfcOff() {
|
public void test_CreateWifiCallingPreferenceSlice_wfcOff() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
|
mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
|
||||||
@@ -241,7 +242,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_CreateWifiCallingPreferenceSlice_success() {
|
public void test_CreateWifiCallingPreferenceSlice_success() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
@@ -259,7 +260,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_SettingsSliceProvider_getWfcPreferenceSlice() {
|
public void test_SettingsSliceProvider_getWfcPreferenceSlice() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
@@ -278,7 +279,7 @@ public class WifiCallingSliceHelperTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_SliceBroadcastReceiver_setWfcPrefCellularPref() {
|
public void test_SliceBroadcastReceiver_setWfcPrefCellularPref() {
|
||||||
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
|
when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
|
||||||
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
|
||||||
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
|
||||||
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
|
||||||
@@ -450,6 +451,10 @@ public class WifiCallingSliceHelperTest {
|
|||||||
mSubId = id;
|
mSubId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isWfcProvisionedOnDevice(int subId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Intent getWifiCallingCarrierActivityIntent(int subId) {
|
protected Intent getWifiCallingCarrierActivityIntent(int subId) {
|
||||||
return mActivationAppIntent;
|
return mActivationAppIntent;
|
||||||
|
Reference in New Issue
Block a user