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:
@@ -86,7 +86,11 @@ public class WifiTetherMaximizeCompatibilityPreferenceController extends
|
|||||||
if (mWifiManager.isBridgedApConcurrencySupported()) {
|
if (mWifiManager.isBridgedApConcurrencySupported()) {
|
||||||
final boolean isEnabled = config.isBridgedModeOpportunisticShutdownEnabled();
|
final boolean isEnabled = config.isBridgedModeOpportunisticShutdownEnabled();
|
||||||
Log.d(TAG, "isBridgedModeOpportunisticShutdownEnabled:" + isEnabled);
|
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),
|
// 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};
|
SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ};
|
||||||
builder.setBands(bands);
|
builder.setBands(bands);
|
||||||
Log.d(TAG, "setBridgedModeOpportunisticShutdownEnabled:" + enabled);
|
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 {
|
} else {
|
||||||
int band = enabled
|
int band = enabled
|
||||||
? SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ
|
? SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ
|
||||||
|
@@ -121,20 +121,20 @@ public class WifiTetherMaximizeCompatibilityPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isMaximizeCompatibilityEnabled_concurrencySupportedAndEnabled_returnTure() {
|
public void isMaximizeCompatibilityEnabled_concurrencySupportedAndEnabled_returnFalse() {
|
||||||
// The preconditions are ready in setup().
|
// The preconditions are ready in setup().
|
||||||
|
|
||||||
assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(true);
|
assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isMaximizeCompatibilityEnabled_concurrencySupportedAndDisabled_returnFalse() {
|
public void isMaximizeCompatibilityEnabled_concurrencySupportedAndDisabled_returnTrue() {
|
||||||
SoftApConfiguration config = new SoftApConfiguration.Builder()
|
SoftApConfiguration config = new SoftApConfiguration.Builder()
|
||||||
.setBridgedModeOpportunisticShutdownEnabled(false)
|
.setBridgedModeOpportunisticShutdownEnabled(false)
|
||||||
.build();
|
.build();
|
||||||
doReturn(config).when(mWifiManager).getSoftApConfiguration();
|
doReturn(config).when(mWifiManager).getSoftApConfiguration();
|
||||||
|
|
||||||
assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(false);
|
assertThat(mController.isMaximizeCompatibilityEnabled()).isEqualTo(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -171,25 +171,25 @@ public class WifiTetherMaximizeCompatibilityPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupMaximizeCompatibility_concurrencySupportedAndDisabled_setDisabled() {
|
public void setupMaximizeCompatibility_concurrencySupportedAndDisabled_setEnabled() {
|
||||||
// The precondition of the concurrency supported is ready in setup().
|
// The precondition of the concurrency supported is ready in setup().
|
||||||
mController.onPreferenceChange(mPreference, false);
|
mController.onPreferenceChange(mPreference, false);
|
||||||
|
|
||||||
SoftApConfiguration.Builder builder = new SoftApConfiguration.Builder();
|
SoftApConfiguration.Builder builder = new SoftApConfiguration.Builder();
|
||||||
mController.setupMaximizeCompatibility(builder);
|
mController.setupMaximizeCompatibility(builder);
|
||||||
|
|
||||||
assertThat(builder.build().isBridgedModeOpportunisticShutdownEnabled()).isEqualTo(false);
|
assertThat(builder.build().isBridgedModeOpportunisticShutdownEnabled()).isEqualTo(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setupMaximizeCompatibility_concurrencySupportedAndEnabled_setEnabled() {
|
public void setupMaximizeCompatibility_concurrencySupportedAndEnabled_setDisabled() {
|
||||||
// The precondition of the concurrency supported is ready in setup().
|
// The precondition of the concurrency supported is ready in setup().
|
||||||
mController.onPreferenceChange(mPreference, true);
|
mController.onPreferenceChange(mPreference, true);
|
||||||
|
|
||||||
SoftApConfiguration.Builder builder = new SoftApConfiguration.Builder();
|
SoftApConfiguration.Builder builder = new SoftApConfiguration.Builder();
|
||||||
mController.setupMaximizeCompatibility(builder);
|
mController.setupMaximizeCompatibility(builder);
|
||||||
|
|
||||||
assertThat(builder.build().isBridgedModeOpportunisticShutdownEnabled()).isEqualTo(true);
|
assertThat(builder.build().isBridgedModeOpportunisticShutdownEnabled()).isEqualTo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user