Make taps on subscriptions in multi-network header go to mobile page
This CL does 2 things: -Makes the MobileNetworkActivity class capable of showing details for "available" in addition to just "active" networks. This is useful for dual-standby devices where one subscription is active and another is registered but not currently active. It also changes the title of this screen to be the network display name (defaults to the carrier name but can be customized by the user) instead of the generic "Mobile network". -Wires up the subscription entries in the multi-network header (which only appears when a device has multiple subscriptions) so that taps on a subscription preference bring you to the MobileNetworkActivity screen to show details for that network. Bug: 116349402 Test: make RunSettingsRoboTests Change-Id: I0e985652c1d8ec3c597b6b6e4426d222e2ad5352
This commit is contained in:
@@ -20,10 +20,13 @@ import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.telephony.MobileNetworkActivity;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -125,7 +128,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
mSubscriptionPreferences = new ArrayMap<>();
|
||||
|
||||
int order = mStartOrder;
|
||||
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(mManager) ) {
|
||||
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(mManager)) {
|
||||
final int subId = info.getSubscriptionId();
|
||||
Preference pref = existingPrefs.remove(subId);
|
||||
if (pref == null) {
|
||||
@@ -139,8 +142,9 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
// TODO(asargent) - set summary here to indicate default for calls/sms and data
|
||||
|
||||
pref.setOnPreferenceClickListener(clickedPref -> {
|
||||
// TODO(asargent) - make this start MobileNetworkActivity once we've
|
||||
// added support for it to take a subscription id
|
||||
final Intent intent = new Intent(mContext, MobileNetworkActivity.class);
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, subId);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user