Merge "Update set|getRetryIntervalsMs to Millis"
This commit is contained in:
@@ -25710,7 +25710,7 @@ package android.net.vcn {
|
||||
method @NonNull public int[] getExposedCapabilities();
|
||||
method @NonNull public String getGatewayConnectionName();
|
||||
method @IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) public int getMaxMtu();
|
||||
method @NonNull public long[] getRetryIntervalsMs();
|
||||
method @NonNull public long[] getRetryIntervalsMillis();
|
||||
}
|
||||
|
||||
public static final class VcnGatewayConnectionConfig.Builder {
|
||||
@@ -25719,7 +25719,7 @@ package android.net.vcn {
|
||||
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig build();
|
||||
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder removeExposedCapability(int);
|
||||
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setMaxMtu(@IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) int);
|
||||
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryIntervalsMs(@NonNull long[]);
|
||||
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryIntervalsMillis(@NonNull long[]);
|
||||
}
|
||||
|
||||
public class VcnManager {
|
||||
|
||||
@@ -136,7 +136,7 @@ public final class VcnGatewayConnectionConfig {
|
||||
* <p>To ensure the device is not constantly being woken up, this retry interval MUST be greater
|
||||
* than this value.
|
||||
*
|
||||
* @see {@link Builder#setRetryIntervalsMs()}
|
||||
* @see {@link Builder#setRetryIntervalsMillis()}
|
||||
*/
|
||||
private static final long MINIMUM_REPEATING_RETRY_INTERVAL_MS = TimeUnit.MINUTES.toMillis(15);
|
||||
|
||||
@@ -337,10 +337,10 @@ public final class VcnGatewayConnectionConfig {
|
||||
/**
|
||||
* Retrieves the configured retry intervals.
|
||||
*
|
||||
* @see Builder#setRetryIntervalsMs(long[])
|
||||
* @see Builder#setRetryIntervalsMillis(long[])
|
||||
*/
|
||||
@NonNull
|
||||
public long[] getRetryIntervalsMs() {
|
||||
public long[] getRetryIntervalsMillis() {
|
||||
return Arrays.copyOf(mRetryIntervalsMs, mRetryIntervalsMs.length);
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ public final class VcnGatewayConnectionConfig {
|
||||
* @see VcnManager for additional discussion on fail-safe mode
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setRetryIntervalsMs(@NonNull long[] retryIntervalsMs) {
|
||||
public Builder setRetryIntervalsMillis(@NonNull long[] retryIntervalsMs) {
|
||||
validateRetryInterval(retryIntervalsMs);
|
||||
|
||||
mRetryIntervalsMs = retryIntervalsMs;
|
||||
|
||||
@@ -1851,7 +1851,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
|
||||
private long getNextRetryIntervalsMs() {
|
||||
final int retryDelayIndex = mFailedAttempts - 1;
|
||||
final long[] retryIntervalsMs = mConnectionConfig.getRetryIntervalsMs();
|
||||
final long[] retryIntervalsMs = mConnectionConfig.getRetryIntervalsMillis();
|
||||
|
||||
// Repeatedly use last item in retry timeout list.
|
||||
if (retryDelayIndex >= retryIntervalsMs.length) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class VcnGatewayConnectionConfigTest {
|
||||
// Public for use in VcnGatewayConnectionTest
|
||||
public static VcnGatewayConnectionConfig buildTestConfigWithExposedCaps(int... exposedCaps) {
|
||||
final VcnGatewayConnectionConfig.Builder builder =
|
||||
newBuilder().setRetryIntervalsMs(RETRY_INTERVALS_MS).setMaxMtu(MAX_MTU);
|
||||
newBuilder().setRetryIntervalsMillis(RETRY_INTERVALS_MS).setMaxMtu(MAX_MTU);
|
||||
|
||||
for (int caps : exposedCaps) {
|
||||
builder.addExposedCapability(caps);
|
||||
@@ -134,7 +134,7 @@ public class VcnGatewayConnectionConfigTest {
|
||||
@Test
|
||||
public void testBuilderRequiresNonNullRetryInterval() {
|
||||
try {
|
||||
newBuilder().setRetryIntervalsMs(null);
|
||||
newBuilder().setRetryIntervalsMillis(null);
|
||||
fail("Expected exception due to invalid retryIntervalMs");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class VcnGatewayConnectionConfigTest {
|
||||
@Test
|
||||
public void testBuilderRequiresNonEmptyRetryInterval() {
|
||||
try {
|
||||
newBuilder().setRetryIntervalsMs(new long[0]);
|
||||
newBuilder().setRetryIntervalsMillis(new long[0]);
|
||||
fail("Expected exception due to invalid retryIntervalMs");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class VcnGatewayConnectionConfigTest {
|
||||
|
||||
assertEquals(TUNNEL_CONNECTION_PARAMS, config.getTunnelConnectionParams());
|
||||
|
||||
assertArrayEquals(RETRY_INTERVALS_MS, config.getRetryIntervalsMs());
|
||||
assertArrayEquals(RETRY_INTERVALS_MS, config.getRetryIntervalsMillis());
|
||||
assertEquals(MAX_MTU, config.getMaxMtu());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class VcnGatewayConnectionRetryTimeoutStateTest extends VcnGatewayConnect
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
mFirstRetryInterval = mConfig.getRetryIntervalsMs()[0];
|
||||
mFirstRetryInterval = mConfig.getRetryIntervalsMillis()[0];
|
||||
|
||||
mGatewayConnection.setUnderlyingNetwork(TEST_UNDERLYING_NETWORK_RECORD_1);
|
||||
mGatewayConnection.transitionTo(mGatewayConnection.mRetryTimeoutState);
|
||||
|
||||
Reference in New Issue
Block a user