Merge "Extract and fix logic for showing rac dialog." into 24D1-dev am: 958b737fcc

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/27072479

Change-Id: I9f5c4c8dea3c7aebc73b5121d6ace7aca22c1dfc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Rafael Higuera Silva
2024-04-25 19:07:24 +00:00
committed by Automerger Merge Worker
5 changed files with 87 additions and 13 deletions

View File

@@ -543,9 +543,7 @@ public class SubscriptionUtil {
return;
}
if (isCarrierRac(context, carrierId)
&& (!isConnectedToWifi(context)
|| isConnectedToMobileDataWithDifferentSubId(context, subId))) {
if (shouldShowRacDialogWhenErasingEsim(context, subId, carrierId)) {
context.startActivity(EuiccRacConnectivityDialogActivity.getIntent(context, subId));
} else {
context.startActivity(DeleteEuiccSubscriptionDialogActivity.getIntent(context, subId));
@@ -884,18 +882,35 @@ public class SubscriptionUtil {
}
/**
* Check if warning dialog should be presented when erasing all eSIMS.
* Check if warning dialog should be presented when erasing all eSIMs.
*
* @param context Context to check if any sim carrier use RAC and device Wi-Fi connection.
* @return {@code true} if dialog should be presented to the user.
*/
public static boolean shouldShowRacDialog(@NonNull Context context) {
public static boolean shouldShowRacDialogWhenErasingAllEsims(@NonNull Context context) {
if (sEnableRacDialogForTesting != null) {
return sEnableRacDialogForTesting;
}
return !isConnectedToWifi(context) && hasSubscriptionWithRacCarrier(context);
}
/**
* Check if warning dialog should be presented when erasing eSIM.
*
* @param context Context to check if any sim carrier use RAC and device Wi-Fi connection.
* @param subId Subscription ID for the single eSIM.
* @param carrierId Carrier ID for the single eSIM.
* @return {@code true} if dialog should be presented to the user.
*/
@VisibleForTesting
static boolean shouldShowRacDialogWhenErasingEsim(
@NonNull Context context, int subId, int carrierId) {
return isCarrierRac(context, carrierId)
&& !isConnectedToWifi(context)
&& !isConnectedToMobileDataWithDifferentSubId(context, subId);
}
/**
* Retrieves NetworkCapabilities for the active network.
*