diff options
author | 2025-03-19 13:13:23 -0700 | |
---|---|---|
committer | 2025-03-19 13:13:23 -0700 | |
commit | cac60f008826804106328af1c8b404ca98df5800 (patch) | |
tree | bec3a9b080ccaf4f1da63cef084feadac50b51a5 /src | |
parent | e1db9bd79e67728db50262912b620f9f61c1d125 (diff) |
Only do performance-based switch for HOME
Upon offline discussion, to minimize the risk for users who are roaming with data plans with different rate, enforce switching only for HOME registration.
Fix: 404875440
Test: basic voice call + data browsing
Flag: EXEMPT bugfix
Change-Id: Id0d33bfb9b62c912a62784baf2e8f6fb52cc8077
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/android/internal/telephony/data/AutoDataSwitchController.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/java/com/android/internal/telephony/data/AutoDataSwitchController.java b/src/java/com/android/internal/telephony/data/AutoDataSwitchController.java index ddc5eda237..9c224dcbc5 100644 --- a/src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +++ b/src/java/com/android/internal/telephony/data/AutoDataSwitchController.java @@ -639,7 +639,12 @@ public class AutoDataSwitchController extends Handler { int currentScore = mPhonesSignalStatus[preferredPhoneId].getRatSignalScore(); for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) { if (phoneId == preferredPhoneId) continue; - int candidateScore = mPhonesSignalStatus[phoneId].getRatSignalScore(); + PhoneSignalStatus candidateStatus = mPhonesSignalStatus[phoneId]; + // Ignore non-home phone. + if (candidateStatus.getUsableState() != PhoneSignalStatus.UsableState.HOME) { + continue; + } + int candidateScore = candidateStatus.getRatSignalScore(); if ((candidateScore - currentScore) > mScoreTolerance // Also reevaluate if DDS has the same score as the current phone. || (candidateScore >= currentScore && phoneId == ddsPhoneId)) { @@ -715,6 +720,7 @@ public class AutoDataSwitchController extends Handler { mSelectedTargetPhoneId = INVALID_PHONE_INDEX; mPhoneSwitcherCallback.onRequireImmediatelySwitchToPhone(DEFAULT_PHONE_INDEX, EVALUATION_REASON_DATA_SETTINGS_CHANGED); + cancelAnyPendingSwitch(); log(debugMessage.append( ", immediately back to default as user turns off default").toString()); return; @@ -723,6 +729,7 @@ public class AutoDataSwitchController extends Handler { mSelectedTargetPhoneId = INVALID_PHONE_INDEX; mPhoneSwitcherCallback.onRequireImmediatelySwitchToPhone( DEFAULT_PHONE_INDEX, EVALUATION_REASON_DATA_SETTINGS_CHANGED); + cancelAnyPendingSwitch(); log(debugMessage.append( ", immediately back to default because backup ") .append(internetEvaluation).toString()); @@ -762,7 +769,9 @@ public class AutoDataSwitchController extends Handler { if (isCurrentUsable) { // Both phones are usable. - if (isRatSignalStrengthBasedSwitchEnabled()) { + if (isRatSignalStrengthBasedSwitchEnabled() + && currentUsableState == PhoneSignalStatus.UsableState.HOME + && defaultUsableState == PhoneSignalStatus.UsableState.HOME) { int defaultScore = mPhonesSignalStatus[defaultDataPhoneId] .getRatSignalScore(); int currentScore = mPhonesSignalStatus[preferredPhoneId] @@ -854,8 +863,9 @@ public class AutoDataSwitchController extends Handler { if (candidateUsableState.mScore > currentUsableState.mScore) { secondaryDataPhone = PhoneFactory.getPhone(phoneId); } else if (isRatSignalStrengthBasedSwitchEnabled() - && currentUsableState.mScore == candidateUsableState.mScore) { - // Both phones are home or both roaming enabled, so compare RAT/signal score. + && currentUsableState == PhoneSignalStatus.UsableState.HOME + && candidateUsableState == PhoneSignalStatus.UsableState.HOME) { + // Both phones are home, so compare RAT/signal score. int defaultScore = defaultPhoneStatus.getRatSignalScore(); int candidateScore = candidatePhoneStatus.getRatSignalScore(); |