Fix Text of VoLTE setting cannot be updated when SIM state is changed

Text of setting menu for VoLTE should be changed from "VoLTE" to
"4G Calling" if "show_4g_for_lte_data_icon_bool" is true. However, it
is not changed in the following steps.
1. Turn Use SIM off on Mobile Network Setting and close Mobile Network
   Setting screen.
2. Open Mobile Network Setting screen again and turn Use SIM on.

Root cause is that the carrier config value is loaded only when SIM's
subid is changed. So, remove checking subId so that the carrier config
value is updated.

Additional fix:
Removed checking #isModeMatched in # onStart because "4G calling"
Setting was grayed out. It needs to listen to call state change
regardless of display status of the preference because Preference may
be switched even after the screen is displayed.

Test: manual
Test: make RunSettingsRoboTests \
      ROBOTEST_FILTER=Enhanced4gBasePreferenceControllerTest
Bug: 196030198
Change-Id: Ibf4d17aa493f69a3f00e35ae0e9d1419bd9e0d77
This commit is contained in:
Ting Yu
2020-08-26 14:34:22 +08:00
committed by Bonian Chen
parent 7d646a5182
commit f56682808e

View File

@@ -77,9 +77,6 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
mTelephonyCallback = new PhoneCallStateTelephonyCallback(); mTelephonyCallback = new PhoneCallStateTelephonyCallback();
} }
if (mSubId == subId) {
return this;
}
mSubId = subId; mSubId = subId;
final PersistableBundle carrierConfig = getCarrierConfigForSubId(subId); final PersistableBundle carrierConfig = getCarrierConfigForSubId(subId);
if (carrierConfig == null) { if (carrierConfig == null) {
@@ -136,7 +133,7 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
@Override @Override
public void onStart() { public void onStart() {
if (!isModeMatched() || (mTelephonyCallback == null)) { if (mTelephonyCallback == null) {
return; return;
} }
mTelephonyCallback.register(mContext, mSubId); mTelephonyCallback.register(mContext, mSubId);