Correct the defined value of Maximize compatibility

- The return value defined by the Wi-Fi framework API is opposite to the
UI
  Compatibility on:  isBridgedModeOpportunisticShutdownEnabled() = false
  Compatibility off: isBridgedModeOpportunisticShutdownEnabled() = true

- Need to use the reverse value from Settings UI to the Wi-Fi framework API.

Bug: 183576049
Test: manual test
atest -c WifiTetherMaximizeCompatibilityPreferenceControllerTest

Change-Id: I731156806661bfbca14e7eaaa648a205a3d77b74
This commit is contained in:
Weng Su
2021-03-24 21:52:56 +08:00
parent 74d2ec5c2d
commit f50e9c24c1
2 changed files with 18 additions and 10 deletions

View File

@@ -86,7 +86,11 @@ public class WifiTetherMaximizeCompatibilityPreferenceController extends
if (mWifiManager.isBridgedApConcurrencySupported()) {
final boolean isEnabled = config.isBridgedModeOpportunisticShutdownEnabled();
Log.d(TAG, "isBridgedModeOpportunisticShutdownEnabled:" + isEnabled);
return isEnabled;
// Because the return value defined by the Wi-Fi framework API is opposite to the UI.
// Compatibility on: isBridgedModeOpportunisticShutdownEnabled() = false
// Compatibility off: isBridgedModeOpportunisticShutdownEnabled() = true
// Need to return the reverse value.
return !isEnabled;
}
// If the BridgedAp Concurrency is not supported in early Pixel devices (e.g. Pixel 2~5),
@@ -112,7 +116,11 @@ public class WifiTetherMaximizeCompatibilityPreferenceController extends
SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ};
builder.setBands(bands);
Log.d(TAG, "setBridgedModeOpportunisticShutdownEnabled:" + enabled);
builder.setBridgedModeOpportunisticShutdownEnabled(enabled);
// Because the defined value by the Wi-Fi framework API is opposite to the UI.
// Compatibility on: setBridgedModeOpportunisticShutdownEnabled(false)
// Compatibility off: setBridgedModeOpportunisticShutdownEnabled(true)
// Need to set the reverse value.
builder.setBridgedModeOpportunisticShutdownEnabled(!enabled);
} else {
int band = enabled
? SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ