Loading res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -793,4 +793,8 @@ <!-- Whether to display pSIM conversion menu in Settings.--> <bool name="config_psim_conversion_menu_enabled">false</bool> <!-- Array of carrier id to allow the pSIM conversion--> <integer-array name="config_psim_conversion_menu_enabled_carrier" translatable="false"> </integer-array> </resources> src/com/android/settings/network/telephony/ConvertToEsimPreferenceController.java +15 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceController implements Loading Loading @@ -111,7 +112,8 @@ public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceCo * To avoid showing users dialogs that can cause confusion, * add conditions to allow conversion in the absence of active eSIM. */ if (!mContext.getResources().getBoolean(R.bool.config_psim_conversion_menu_enabled)) { if (!mContext.getResources().getBoolean(R.bool.config_psim_conversion_menu_enabled) || !isPsimConversionSupport(subId)) { return CONDITIONALLY_UNAVAILABLE; } if (findConversionSupportComponent()) { Loading Loading @@ -238,4 +240,16 @@ public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceCo } return true; } private boolean isPsimConversionSupport(int subId) { SubscriptionManager subscriptionManager = mContext.getSystemService( SubscriptionManager.class); SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId); if (subInfo == null) { return false; } final int[] supportedCarriers = mContext.getResources().getIntArray( R.array.config_psim_conversion_menu_enabled_carrier); return Arrays.stream(supportedCarriers).anyMatch(id -> id == subInfo.getCarrierId()); } } Loading
res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -793,4 +793,8 @@ <!-- Whether to display pSIM conversion menu in Settings.--> <bool name="config_psim_conversion_menu_enabled">false</bool> <!-- Array of carrier id to allow the pSIM conversion--> <integer-array name="config_psim_conversion_menu_enabled_carrier" translatable="false"> </integer-array> </resources>
src/com/android/settings/network/telephony/ConvertToEsimPreferenceController.java +15 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceController implements Loading Loading @@ -111,7 +112,8 @@ public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceCo * To avoid showing users dialogs that can cause confusion, * add conditions to allow conversion in the absence of active eSIM. */ if (!mContext.getResources().getBoolean(R.bool.config_psim_conversion_menu_enabled)) { if (!mContext.getResources().getBoolean(R.bool.config_psim_conversion_menu_enabled) || !isPsimConversionSupport(subId)) { return CONDITIONALLY_UNAVAILABLE; } if (findConversionSupportComponent()) { Loading Loading @@ -238,4 +240,16 @@ public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceCo } return true; } private boolean isPsimConversionSupport(int subId) { SubscriptionManager subscriptionManager = mContext.getSystemService( SubscriptionManager.class); SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId); if (subInfo == null) { return false; } final int[] supportedCarriers = mContext.getResources().getIntArray( R.array.config_psim_conversion_menu_enabled_carrier); return Arrays.stream(supportedCarriers).anyMatch(id -> id == subInfo.getCarrierId()); } }