Merge "[Settings] Performance tuning for intent ACTION_ENHANCED_4G_LTE_CHANGED"

This commit is contained in:
Bonian Chen
2020-02-13 04:59:15 +00:00
committed by Android (Google) Code Review

View File

@@ -163,20 +163,31 @@ public class Enhanced4gLteSliceHelper {
* @param intent action performed * @param intent action performed
*/ */
public void handleEnhanced4gLteChanged(Intent intent) { public void handleEnhanced4gLteChanged(Intent intent) {
final int subId = getDefaultVoiceSubId(); // skip checking when no toggle state update contained within Intent
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, false);
if (newValue != intent.getBooleanExtra(EXTRA_TOGGLE_STATE, true)) {
notifyEnhanced4gLteUpdate();
return;
}
final int subId = getDefaultVoiceSubId();
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
notifyEnhanced4gLteUpdate();
return;
}
if (SubscriptionManager.isValidSubscriptionId(subId)) {
final VolteQueryImsState queryState = queryImsState(subId); final VolteQueryImsState queryState = queryImsState(subId);
if (queryState.isVoLteProvisioned()) {
final boolean currentValue = queryState.isEnabledByUser() final boolean currentValue = queryState.isEnabledByUser()
&& queryState.isAllowUserControl(); && queryState.isAllowUserControl();
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, if (newValue == currentValue) {
currentValue); notifyEnhanced4gLteUpdate();
if (newValue != currentValue) { return;
}
// isVoLteProvisioned() is the last item to check since it might block the main thread
if (queryState.isVoLteProvisioned()) {
setEnhanced4gLteModeSetting(subId, newValue); setEnhanced4gLteModeSetting(subId, newValue);
} }
}
}
notifyEnhanced4gLteUpdate(); notifyEnhanced4gLteUpdate();
} }