[Settings] Performance tuning for intent ACTION_ENHANCED_4G_LTE_CHANGED
Adjust the ordering of accessing to avoid the rule checks isVoLteProvisioned() when not required. Bug: 140542283 Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=Enhanced4gLteSliceHelperTest Change-Id: I8604a27d211895a6b33e0f6d0d78f5772912ee01
This commit is contained in:
@@ -163,19 +163,30 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
if (SubscriptionManager.isValidSubscriptionId(subId)) {
|
final int subId = getDefaultVoiceSubId();
|
||||||
final VolteQueryImsState queryState = queryImsState(subId);
|
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||||
if (queryState.isVoLteProvisioned()) {
|
notifyEnhanced4gLteUpdate();
|
||||||
final boolean currentValue = queryState.isEnabledByUser()
|
return;
|
||||||
&& queryState.isAllowUserControl();
|
}
|
||||||
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
|
|
||||||
currentValue);
|
final VolteQueryImsState queryState = queryImsState(subId);
|
||||||
if (newValue != currentValue) {
|
final boolean currentValue = queryState.isEnabledByUser()
|
||||||
setEnhanced4gLteModeSetting(subId, newValue);
|
&& queryState.isAllowUserControl();
|
||||||
}
|
if (newValue == currentValue) {
|
||||||
}
|
notifyEnhanced4gLteUpdate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// isVoLteProvisioned() is the last item to check since it might block the main thread
|
||||||
|
if (queryState.isVoLteProvisioned()) {
|
||||||
|
setEnhanced4gLteModeSetting(subId, newValue);
|
||||||
}
|
}
|
||||||
notifyEnhanced4gLteUpdate();
|
notifyEnhanced4gLteUpdate();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user