Fix Calls/SMS default SIM selector

In cases where a SIM is initially disabled, even after you turn it on
the ListPreference's for selecting the default SIM for Calls and SMS
weren't working because the preference change listener wasn't getting
registered. This CL fixes that for these controllers by always
registering a change listener whenever we make the preference visible.

Fixes: 134472294
Bug: 135142209
Test: make RunSettingsRoboTests
Change-Id: Ia9362b7f26309bdbd6c5e8140fb606b28e2b34d8
This commit is contained in:
Antony Sargent
2019-06-12 15:33:33 -07:00
parent 102d43b5c1
commit 22b827db55
2 changed files with 27 additions and 0 deletions

View File

@@ -121,6 +121,11 @@ public abstract class DefaultSubscriptionController extends BasePreferenceContro
}
mPreference.setVisible(true);
// TODO(b/135142209) - for now we need to manually ensure we're registered as a change
// listener, because this might not have happened during displayPreference if
// getAvailabilityStatus returned CONDITIONALLY_UNAVAILABLE at the time.
mPreference.setOnPreferenceChangeListener(this);
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(mManager);
// We'll have one entry for each available subscription, plus one for a "ask me every