[Provider Model] Add new API to detect
1. current connection is mobile data - remove the SubscriptionsPreferenceController#activeNetworkIsCellular() and move into MobileNetworkUtils 2. isProviderModel API - Add it in Util for Provider Model 3. isWiFiCallingEnabled - remove WifiCallingPreferenceController#isWifiCallingEnabled() and move into MobileNetworkUtils 4. Add nes test case for MobileNetworkUtils Bug: 171873895 Test: atest -c MobileNetworkUtilsTest Change-Id: I4bfdf0537fe07d064d6c0ba4a2c44b4a4f158d91
This commit is contained in:
@@ -71,7 +71,7 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
||||
@Override
|
||||
public int getAvailabilityStatus(int subId) {
|
||||
return SubscriptionManager.isValidSubscriptionId(subId)
|
||||
&& isWifiCallingEnabled(mContext, subId)
|
||||
&& MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, null, null)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
@@ -221,23 +221,4 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
||||
mTelephonyManager.listen(this, PhoneStateListener.LISTEN_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isWifiCallingEnabled(Context context, int subId) {
|
||||
final PhoneAccountHandle simCallManager =
|
||||
context.getSystemService(TelecomManager.class)
|
||||
.getSimCallManagerForSubscription(subId);
|
||||
final int phoneId = SubscriptionManager.getSlotIndex(subId);
|
||||
|
||||
boolean isWifiCallingEnabled;
|
||||
if (simCallManager != null) {
|
||||
final Intent intent = MobileNetworkUtils.buildPhoneAccountConfigureIntent(
|
||||
context, simCallManager);
|
||||
|
||||
isWifiCallingEnabled = intent != null;
|
||||
} else {
|
||||
isWifiCallingEnabled = queryImsState(subId).isReadyToWifiCalling();
|
||||
}
|
||||
|
||||
return isWifiCallingEnabled;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user