Fix bug of phoneListener always listens to default subId in WFC.
In WiFi calling settings, although each WifiCallingSettingsForSub instance has its mSubId, the mPhoneStateListener always listens to state of default subId, which is incorrect. This is to fix that. Bug: 109787945 Test: In DSDS device, open WFC settings. Make phone call using default voice phone, and check that WFC setting tab of the other phone is not greyed out. Change-Id: I126047c6099bf156b40e0145aa55df0fdf8ef882
This commit is contained in:
committed by
Xiangyu/Malcolm Chen
parent
de290a50c2
commit
c68e6b3d90
@@ -88,6 +88,7 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
private ImsManager mImsManager;
|
private ImsManager mImsManager;
|
||||||
|
private TelephonyManager mTelephonyManager;
|
||||||
|
|
||||||
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||||
/*
|
/*
|
||||||
@@ -237,6 +238,9 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
mImsManager = ImsManager.getInstance(
|
mImsManager = ImsManager.getInstance(
|
||||||
getActivity(), SubscriptionManager.getPhoneId(mSubId));
|
getActivity(), SubscriptionManager.getPhoneId(mSubId));
|
||||||
|
|
||||||
|
mTelephonyManager = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
|
||||||
|
.createForSubscriptionId(mSubId);
|
||||||
|
|
||||||
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
|
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
|
||||||
mButtonWfcMode.setOnPreferenceChangeListener(this);
|
mButtonWfcMode.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
@@ -318,9 +322,7 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
updateBody();
|
updateBody();
|
||||||
|
|
||||||
if (mImsManager.isWfcEnabledByPlatform()) {
|
if (mImsManager.isWfcEnabledByPlatform()) {
|
||||||
TelephonyManager tm =
|
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
|
|
||||||
|
|
||||||
mSwitchBar.addOnSwitchChangeListener(this);
|
mSwitchBar.addOnSwitchChangeListener(this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user