Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 136a0f53 authored by Antony Sargent's avatar Antony Sargent Committed by android-build-merger
Browse files

Merge "Make MobileNetworkActivity support onNewIntent" into qt-r1-dev am: 20ec6a4b

am: f61428cf

Change-Id: I21991a0d06bf861d6a0fd6906b455a36d8b10c55
parents 5d1c65e3 f61428cf
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -76,6 +76,13 @@ public class MobileNetworkActivity extends SettingsBaseActivity {
        }
    };

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        updateSubscriptions(null);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
+17 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ import android.view.View;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.view.menu.ContextMenuBuilder;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.development.featureflags.FeatureFlagPersistent;
import com.android.settings.network.SubscriptionUtil;

import com.google.android.material.bottomnavigation.BottomNavigationView;
@@ -207,4 +209,19 @@ public class MobileNetworkActivityTest {

        assertThat(bundle.getInt(Settings.EXTRA_SUB_ID)).isEqualTo(PREV_SUB_ID);
    }

    @Test
    public void onNewIntent_newSubscriptionId_fragmentReplaced() {
        FeatureFlagPersistent.setEnabled(mContext, FeatureFlags.NETWORK_INTERNET_V2, true);

        mSubscriptionInfos.add(mSubscriptionInfo);
        mSubscriptionInfos.add(mSubscriptionInfo2);
        SubscriptionUtil.setAvailableSubscriptionsForTesting(mSubscriptionInfos);
        mMobileNetworkActivity.mCurSubscriptionId = PREV_SUB_ID;

        final Intent newIntent = new Intent();
        newIntent.putExtra(Settings.EXTRA_SUB_ID, CURRENT_SUB_ID);
        mMobileNetworkActivity.onNewIntent(newIntent);
        assertThat(mMobileNetworkActivity.mCurSubscriptionId).isEqualTo(CURRENT_SUB_ID);
    }
}