Loading src/com/android/settings/network/telephony/MobileNetworkUtils.java +4 −21 Original line number Diff line number Diff line Loading @@ -940,28 +940,11 @@ public class MobileNetworkUtils { * Copied from WifiCallingPreferenceController#isWifiCallingEnabled() */ public static boolean isWifiCallingEnabled(Context context, int subId, @Nullable WifiCallingQueryImsState queryImsState, @Nullable PhoneAccountHandle phoneAccountHandle) { if (phoneAccountHandle == null){ phoneAccountHandle = context.getSystemService(TelecomManager.class) .getSimCallManagerForSubscription(subId); } boolean isWifiCallingEnabled; if (phoneAccountHandle != null) { final Intent intent = buildPhoneAccountConfigureIntent(context, phoneAccountHandle); if (intent == null) { Log.d(TAG, "Can not get phoneAccount configure intent."); isWifiCallingEnabled = false; } else { isWifiCallingEnabled = true; } } else { @Nullable WifiCallingQueryImsState queryImsState) { if (queryImsState == null) { queryImsState = new WifiCallingQueryImsState(context, subId); } isWifiCallingEnabled = queryImsState.isReadyToWifiCalling(); } return isWifiCallingEnabled; return queryImsState.isReadyToWifiCalling(); } /** Loading src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroup.java +1 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.PersistableBundle; import android.provider.Settings; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; Loading Loading @@ -314,8 +313,7 @@ public class NetworkProviderWifiCallingGroup extends @VisibleForTesting protected boolean shouldShowWifiCallingForSub(int subId) { if (SubscriptionManager.isValidSubscriptionId(subId) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId), null)) { && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId))) { return true; } return false; Loading src/com/android/settings/network/telephony/WifiCallingPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont @Override public int getAvailabilityStatus(int subId) { return SubscriptionManager.isValidSubscriptionId(subId) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, null, null) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, null) ? AVAILABLE : UNSUPPORTED_ON_DEVICE; } Loading src/com/android/settings/wifi/calling/WifiCallingSettings.java +4 −2 Original line number Diff line number Diff line Loading @@ -257,8 +257,10 @@ public class WifiCallingSettings extends SettingsPreferenceFragment for (SubscriptionInfo subInfo : subInfoList) { int subId = subInfo.getSubscriptionId(); try { if (MobileNetworkUtils.isWifiCallingEnabled(getContext(), subId, queryImsState(subId), null)) { if (MobileNetworkUtils.isWifiCallingEnabled( getContext(), subId, queryImsState(subId))) { selectedList.add(subInfo); } } catch (Exception exception) {} Loading tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java +4 −20 Original line number Diff line number Diff line Loading @@ -385,35 +385,19 @@ public class MobileNetworkUtilsTest { } @Test public void isWifiCallingEnabled_hasPhoneAccountHandleAndHasActivityHandleIntent_returnTrue() { buildPhoneAccountConfigureIntent(true); assertTrue(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, null, mPhoneAccountHandle)); } @Test public void isWifiCallingEnabled_hasPhoneAccountHandleAndNoActivityHandleIntent_returnFalse() { buildPhoneAccountConfigureIntent(false); assertFalse(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, null, mPhoneAccountHandle)); } @Test public void isWifiCallingEnabled_noPhoneAccountHandleAndWifiCallingIsReady_returnTrue() { public void isWifiCallingEnabled_wifiCallingIsReady_returnTrue() { setWifiCallingEnabled(true); assertTrue(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, mMockQueryWfcState, null)); mMockQueryWfcState)); } @Test public void isWifiCallingEnabled_noPhoneAccountHandleAndWifiCallingNotReady_returnFalse() { public void isWifiCallingEnabled_wifiCallingNotReady_returnFalse() { setWifiCallingEnabled(false); assertFalse(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, mMockQueryWfcState, null)); mMockQueryWfcState)); } private void setWifiCallingEnabled(boolean enabled){ Loading Loading
src/com/android/settings/network/telephony/MobileNetworkUtils.java +4 −21 Original line number Diff line number Diff line Loading @@ -940,28 +940,11 @@ public class MobileNetworkUtils { * Copied from WifiCallingPreferenceController#isWifiCallingEnabled() */ public static boolean isWifiCallingEnabled(Context context, int subId, @Nullable WifiCallingQueryImsState queryImsState, @Nullable PhoneAccountHandle phoneAccountHandle) { if (phoneAccountHandle == null){ phoneAccountHandle = context.getSystemService(TelecomManager.class) .getSimCallManagerForSubscription(subId); } boolean isWifiCallingEnabled; if (phoneAccountHandle != null) { final Intent intent = buildPhoneAccountConfigureIntent(context, phoneAccountHandle); if (intent == null) { Log.d(TAG, "Can not get phoneAccount configure intent."); isWifiCallingEnabled = false; } else { isWifiCallingEnabled = true; } } else { @Nullable WifiCallingQueryImsState queryImsState) { if (queryImsState == null) { queryImsState = new WifiCallingQueryImsState(context, subId); } isWifiCallingEnabled = queryImsState.isReadyToWifiCalling(); } return isWifiCallingEnabled; return queryImsState.isReadyToWifiCalling(); } /** Loading
src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroup.java +1 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.PersistableBundle; import android.provider.Settings; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; Loading Loading @@ -314,8 +313,7 @@ public class NetworkProviderWifiCallingGroup extends @VisibleForTesting protected boolean shouldShowWifiCallingForSub(int subId) { if (SubscriptionManager.isValidSubscriptionId(subId) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId), null)) { && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, queryImsState(subId))) { return true; } return false; Loading
src/com/android/settings/network/telephony/WifiCallingPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont @Override public int getAvailabilityStatus(int subId) { return SubscriptionManager.isValidSubscriptionId(subId) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, null, null) && MobileNetworkUtils.isWifiCallingEnabled(mContext, subId, null) ? AVAILABLE : UNSUPPORTED_ON_DEVICE; } Loading
src/com/android/settings/wifi/calling/WifiCallingSettings.java +4 −2 Original line number Diff line number Diff line Loading @@ -257,8 +257,10 @@ public class WifiCallingSettings extends SettingsPreferenceFragment for (SubscriptionInfo subInfo : subInfoList) { int subId = subInfo.getSubscriptionId(); try { if (MobileNetworkUtils.isWifiCallingEnabled(getContext(), subId, queryImsState(subId), null)) { if (MobileNetworkUtils.isWifiCallingEnabled( getContext(), subId, queryImsState(subId))) { selectedList.add(subInfo); } } catch (Exception exception) {} Loading
tests/unit/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java +4 −20 Original line number Diff line number Diff line Loading @@ -385,35 +385,19 @@ public class MobileNetworkUtilsTest { } @Test public void isWifiCallingEnabled_hasPhoneAccountHandleAndHasActivityHandleIntent_returnTrue() { buildPhoneAccountConfigureIntent(true); assertTrue(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, null, mPhoneAccountHandle)); } @Test public void isWifiCallingEnabled_hasPhoneAccountHandleAndNoActivityHandleIntent_returnFalse() { buildPhoneAccountConfigureIntent(false); assertFalse(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, null, mPhoneAccountHandle)); } @Test public void isWifiCallingEnabled_noPhoneAccountHandleAndWifiCallingIsReady_returnTrue() { public void isWifiCallingEnabled_wifiCallingIsReady_returnTrue() { setWifiCallingEnabled(true); assertTrue(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, mMockQueryWfcState, null)); mMockQueryWfcState)); } @Test public void isWifiCallingEnabled_noPhoneAccountHandleAndWifiCallingNotReady_returnFalse() { public void isWifiCallingEnabled_wifiCallingNotReady_returnFalse() { setWifiCallingEnabled(false); assertFalse(MobileNetworkUtils.isWifiCallingEnabled(mContext, SUB_ID_1, mMockQueryWfcState, null)); mMockQueryWfcState)); } private void setWifiCallingEnabled(boolean enabled){ Loading