Skip to content

Commit c50c136

Browse files
OmniLab Teamcopybara-github
authored andcommitted
Align MobileHarness wifi decorator behavior with Tradefed (attempts, timeout, retry behavior).
PiperOrigin-RevId: 943661039
1 parent 6417ab8 commit c50c136

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/java/com/google/wireless/qa/mobileharness/shared/api/decorator/AndroidSetWifiDecorator.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@
4040
@DecoratorAnnotation(help = "For setting the device wifi ssid before the test is run.")
4141
public class AndroidSetWifiDecorator extends LifecycleDecorator
4242
implements SpecConfigable<AndroidSetWifiDecoratorSpec> {
43-
/** The waiting time of timeout to connect to the ssid. */
44-
protected static final Duration TIMEOUT_SSID_CONNECTION_TIME = Duration.ofMinutes(2);
43+
/**
44+
* The waiting time of timeout to connect to the ssid. 5 mins are useful when using 6G WiFi AP
45+
* because it has multiple frequency bands.
46+
*/
47+
protected static final Duration TIMEOUT_SSID_CONNECTION_TIME = Duration.ofMinutes(5);
4548

4649
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
4750

@@ -67,7 +70,7 @@ protected void setUp(SetupContext context) throws MobileHarnessException, Interr
6770
String wifiSsid;
6871
String wifiPsk;
6972
boolean wifiScanSsid = false;
70-
int retryNum = spec.hasWifiRetryNum() ? spec.getWifiRetryNum() : 0;
73+
int retryNum = spec.getWifiRetryNum();
7174
boolean wifiSsidOptional = spec.getWifiSsidOptional();
7275
if (spec.getUseDefaultSsid()) {
7376
// Get the wifi config from the device property.

src/java/com/google/wireless/qa/mobileharness/shared/proto/spec/decorator/android_set_wifi_decorator_spec.proto

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ message AndroidSetWifiDecoratorSpec {
4848
[(field_detail) = { help: "Whether to scan for hidden SSID" }];
4949

5050
optional int32 wifi_retry_num = 5 [
51-
default = 0,
51+
default = 3,
5252
(field_detail) = {
53-
help: "Nums of retrying to connect to the wifi. Default value is 0. 5 is "
54-
"max allowed. For normal usage, we do suggest not to set it larger "
55-
"than 2 to save waiting time."
53+
help: "Nums of retrying to connect to the wifi. Default value is 3. 5 is "
54+
"max allowed."
5655
}
5756
];
5857

src/javatests/com/google/wireless/qa/mobileharness/shared/api/decorator/AndroidSetWifiDecoratorTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void testSetWifi_specifySsidAndPsk() throws MobileHarnessException, Inter
9999
.setWifiSsid(WIFI_SSID)
100100
.setWifiPsk(WIFI_PSK)
101101
.setScanSsid(false)
102-
.setWaitTimeout(Duration.ofMinutes(2))
103-
.setRetryNum(0)
102+
.setWaitTimeout(Duration.ofMinutes(5))
103+
.setRetryNum(3)
104104
.build(),
105105
log);
106106
verify(decoratedDriver).run(testInfo);
@@ -126,8 +126,8 @@ public void testSetWifi_specifySsidAndScanSsid()
126126
.setWifiSsid(WIFI_SSID)
127127
.setWifiPsk(WIFI_PSK)
128128
.setScanSsid(true)
129-
.setWaitTimeout(Duration.ofMinutes(2))
130-
.setRetryNum(0)
129+
.setWaitTimeout(Duration.ofMinutes(5))
130+
.setRetryNum(3)
131131
.build(),
132132
log);
133133
verify(decoratedDriver).run(testInfo);
@@ -170,8 +170,8 @@ public void testSetWifi_defaultConfig_success()
170170
.setWifiSsid("ssid1")
171171
.setWifiPsk("psk1")
172172
.setScanSsid(false)
173-
.setWaitTimeout(Duration.ofMinutes(2))
174-
.setRetryNum(0)
173+
.setWaitTimeout(Duration.ofMinutes(5))
174+
.setRetryNum(3)
175175
.build(),
176176
log);
177177
verify(decoratedDriver).run(testInfo);
@@ -210,7 +210,7 @@ public void testSetWifi_specifyRetryNum() throws MobileHarnessException, Interru
210210
.setWifiSsid(WIFI_SSID)
211211
.setWifiPsk(WIFI_PSK)
212212
.setScanSsid(false)
213-
.setWaitTimeout(Duration.ofMinutes(2))
213+
.setWaitTimeout(Duration.ofMinutes(5))
214214
.setRetryNum(WIFI_RETRY_NUM)
215215
.build(),
216216
log);

0 commit comments

Comments
 (0)