Merge "[Settings] Can not launch SIMs page correctly"

This commit is contained in:
TreeHugger Robot
2021-12-23 11:07:24 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 7 deletions

View File

@@ -118,15 +118,19 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
Intent intent = getIntent();
if (intent != null) {
mSubId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
MobileNetworkUtils.getSearchableSubscriptionId(context));
Log.i(LOG_TAG, "display subId from intent: " + mSubId);
if (getArguments() == null) {
Intent intent = getIntent();
if (intent != null) {
mSubId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
MobileNetworkUtils.getSearchableSubscriptionId(context));
Log.d(LOG_TAG, "display subId from intent: " + mSubId);
} else {
Log.d(LOG_TAG, "intent is null, can not get the subId from intent.");
}
} else {
mSubId = getArguments().getInt(Settings.EXTRA_SUB_ID,
MobileNetworkUtils.getSearchableSubscriptionId(context));
Log.i(LOG_TAG, "display subId from getArguments(): " + mSubId);
Log.d(LOG_TAG, "display subId from getArguments(): " + mSubId);
}
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {

View File

@@ -1014,10 +1014,11 @@ public class MobileNetworkUtils {
public static void launchMobileNetworkSettings(Context context, SubscriptionInfo info) {
final int subId = info.getSubscriptionId();
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.d(TAG, "launchMobileNetworkSettings fail, subId is invalid");
Log.d(TAG, "launchMobileNetworkSettings fail, subId is invalid.");
return;
}
Log.d(TAG, "launchMobileNetworkSettings for subId: " + subId);
final Bundle extra = new Bundle();
extra.putInt(Settings.EXTRA_SUB_ID, subId);
new SubSettingLauncher(context)