Go to the correct subscription in WifiCallingSettings

For subscriptions that support wifi calling, we have a preference on the
mobile network details page which leads to a Wifi Calling page. That
page already supports the concept of multiple subscriptions with a
header strip containing a tab for each subscription that supports wifi
calling. However, we were not necessarily selecting the *correct* tab
when going to this page. So you might be viewing the mobile network
details for subscription B and click on "Wifi Calling", only to land on
the page with the tab for subscription A selected.

This CL fixes the problem by adding an extra with the current
subscription id to the Preference's intent in
WifiCallingPreferenceController, and then reads that extra in
WifiCallingSettings and uses it to select the appropriate tab.

Fixes: 117135894
Test: make RunSettingsRoboTests
Change-Id: I3aec30072712247d14fe0fb6b61207535f9e981c
This commit is contained in:
Antony Sargent
2019-04-09 15:32:39 -07:00
parent f078971771
commit 02db2ef9b6
4 changed files with 163 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Looper;
import android.os.PersistableBundle;
import android.provider.Settings;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
@@ -96,6 +97,10 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
Intent intent = mPreference.getIntent();
if (intent != null) {
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
}
if (!isAvailable()) {
// Set category as invisible
final Preference preferenceCateogry = screen.findPreference(KEY_PREFERENCE_CATEGORY);