Loading src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java +17 −5 Original line number Diff line number Diff line Loading @@ -119,8 +119,9 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment queryImsState(WifiCallingSettingsForSub.this.mSubId).isAllowUserControl(); final boolean isWfcEnabled = mSwitchBar.isChecked() && isNonTtyOrTtyOnVolteEnabled; boolean isCallStateIdle = mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE; boolean isCallStateIdle = getTelephonyManagerForSub( WifiCallingSettingsForSub.this.mSubId).getCallState() == TelephonyManager.CALL_STATE_IDLE; mSwitchBar.setEnabled(isCallStateIdle && isNonTtyOrTtyOnVolteEnabled); Loading Loading @@ -201,7 +202,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment mSwitchBar.hide(); } private void showAlert(Intent intent) { @VisibleForTesting void showAlert(Intent intent) { final Context context = getActivity(); final CharSequence title = intent.getCharSequenceExtra(Phone.EXTRA_KEY_ALERT_TITLE); Loading Loading @@ -247,6 +249,14 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment return 0; } @VisibleForTesting TelephonyManager getTelephonyManagerForSub(int subId) { if (mTelephonyManager == null) { mTelephonyManager = getContext().getSystemService(TelephonyManager.class); } return mTelephonyManager.createForSubscriptionId(subId); } @VisibleForTesting WifiCallingQueryImsState queryImsState(int subId) { return new WifiCallingQueryImsState(getContext(), subId); Loading Loading @@ -420,7 +430,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment updateBody(); if (queryImsState(mSubId).isWifiCallingSupported()) { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); getTelephonyManagerForSub(mSubId).listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); mSwitchBar.addOnSwitchChangeListener(this); Loading Loading @@ -448,7 +459,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment if (mValidListener) { mValidListener = false; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); getTelephonyManagerForSub(mSubId).listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mSwitchBar.removeOnSwitchChangeListener(this); } Loading tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -351,5 +351,13 @@ public class WifiCallingSettingsForSubTest { return null; } } @Override TelephonyManager getTelephonyManagerForSub(int subId) { return mTelephonyManager; } @Override void showAlert(Intent intent) {} } } Loading
src/com/android/settings/wifi/calling/WifiCallingSettingsForSub.java +17 −5 Original line number Diff line number Diff line Loading @@ -119,8 +119,9 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment queryImsState(WifiCallingSettingsForSub.this.mSubId).isAllowUserControl(); final boolean isWfcEnabled = mSwitchBar.isChecked() && isNonTtyOrTtyOnVolteEnabled; boolean isCallStateIdle = mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE; boolean isCallStateIdle = getTelephonyManagerForSub( WifiCallingSettingsForSub.this.mSubId).getCallState() == TelephonyManager.CALL_STATE_IDLE; mSwitchBar.setEnabled(isCallStateIdle && isNonTtyOrTtyOnVolteEnabled); Loading Loading @@ -201,7 +202,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment mSwitchBar.hide(); } private void showAlert(Intent intent) { @VisibleForTesting void showAlert(Intent intent) { final Context context = getActivity(); final CharSequence title = intent.getCharSequenceExtra(Phone.EXTRA_KEY_ALERT_TITLE); Loading Loading @@ -247,6 +249,14 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment return 0; } @VisibleForTesting TelephonyManager getTelephonyManagerForSub(int subId) { if (mTelephonyManager == null) { mTelephonyManager = getContext().getSystemService(TelephonyManager.class); } return mTelephonyManager.createForSubscriptionId(subId); } @VisibleForTesting WifiCallingQueryImsState queryImsState(int subId) { return new WifiCallingQueryImsState(getContext(), subId); Loading Loading @@ -420,7 +430,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment updateBody(); if (queryImsState(mSubId).isWifiCallingSupported()) { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); getTelephonyManagerForSub(mSubId).listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); mSwitchBar.addOnSwitchChangeListener(this); Loading Loading @@ -448,7 +459,8 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment if (mValidListener) { mValidListener = false; mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); getTelephonyManagerForSub(mSubId).listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mSwitchBar.removeOnSwitchChangeListener(this); } Loading
tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsForSubTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -351,5 +351,13 @@ public class WifiCallingSettingsForSubTest { return null; } } @Override TelephonyManager getTelephonyManagerForSub(int subId) { return mTelephonyManager; } @Override void showAlert(Intent intent) {} } }