Merge "Rename get/setRetryInterval to get/setRetryIntervalsMs"

This commit is contained in:
Benedict Wong
2021-04-21 17:06:45 +00:00
committed by Gerrit Code Review
4 changed files with 10 additions and 24 deletions

View File

@@ -25711,7 +25711,7 @@ package android.net.vcn {
method @NonNull public int[] getExposedCapabilities(); method @NonNull public int[] getExposedCapabilities();
method @NonNull public String getGatewayConnectionName(); method @NonNull public String getGatewayConnectionName();
method @IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) public int getMaxMtu(); method @IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) public int getMaxMtu();
method @NonNull public long[] getRetryInterval(); method @NonNull public long[] getRetryIntervalsMs();
} }
public static final class VcnGatewayConnectionConfig.Builder { public static final class VcnGatewayConnectionConfig.Builder {
@@ -25720,7 +25720,7 @@ package android.net.vcn {
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig build(); 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 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 setMaxMtu(@IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) int);
method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryInterval(@NonNull long[]); method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryIntervalsMs(@NonNull long[]);
} }
public class VcnManager { public class VcnManager {

View File

@@ -134,7 +134,7 @@ public final class VcnGatewayConnectionConfig {
* <p>To ensure the device is not constantly being woken up, this retry interval MUST be greater * <p>To ensure the device is not constantly being woken up, this retry interval MUST be greater
* than this value. * than this value.
* *
* @see {@link Builder#setRetryInterval()} * @see {@link Builder#setRetryIntervalsMs()}
*/ */
private static final long MINIMUM_REPEATING_RETRY_INTERVAL_MS = TimeUnit.MINUTES.toMillis(15); private static final long MINIMUM_REPEATING_RETRY_INTERVAL_MS = TimeUnit.MINUTES.toMillis(15);
@@ -333,25 +333,11 @@ public final class VcnGatewayConnectionConfig {
/** /**
* Retrieves the configured retry intervals. * Retrieves the configured retry intervals.
* *
* @see Builder#setRetryInterval(long[]) * @see Builder#setRetryIntervalsMs(long[])
*/ */
@NonNull @NonNull
public long[] getRetryInterval() {
return Arrays.copyOf(mRetryIntervalsMs, mRetryIntervalsMs.length);
}
/**
* Retrieves the configured retry intervals.
*
* <p>Left to prevent the need to make major changes while changes are actively in flight.
*
* @deprecated use getRetryInterval() instead
* @hide
*/
@Deprecated
@NonNull
public long[] getRetryIntervalsMs() { public long[] getRetryIntervalsMs() {
return getRetryInterval(); return Arrays.copyOf(mRetryIntervalsMs, mRetryIntervalsMs.length);
} }
/** /**
@@ -559,7 +545,7 @@ public final class VcnGatewayConnectionConfig {
* @see VcnManager for additional discussion on fail-safe mode * @see VcnManager for additional discussion on fail-safe mode
*/ */
@NonNull @NonNull
public Builder setRetryInterval(@NonNull long[] retryIntervalsMs) { public Builder setRetryIntervalsMs(@NonNull long[] retryIntervalsMs) {
validateRetryInterval(retryIntervalsMs); validateRetryInterval(retryIntervalsMs);
mRetryIntervalsMs = retryIntervalsMs; mRetryIntervalsMs = retryIntervalsMs;

View File

@@ -81,7 +81,7 @@ public class VcnGatewayConnectionConfigTest {
// Public for use in VcnGatewayConnectionTest // Public for use in VcnGatewayConnectionTest
public static VcnGatewayConnectionConfig buildTestConfigWithExposedCaps(int... exposedCaps) { public static VcnGatewayConnectionConfig buildTestConfigWithExposedCaps(int... exposedCaps) {
final VcnGatewayConnectionConfig.Builder builder = final VcnGatewayConnectionConfig.Builder builder =
newBuilder().setRetryInterval(RETRY_INTERVALS_MS).setMaxMtu(MAX_MTU); newBuilder().setRetryIntervalsMs(RETRY_INTERVALS_MS).setMaxMtu(MAX_MTU);
for (int caps : exposedCaps) { for (int caps : exposedCaps) {
builder.addExposedCapability(caps); builder.addExposedCapability(caps);
@@ -133,7 +133,7 @@ public class VcnGatewayConnectionConfigTest {
@Test @Test
public void testBuilderRequiresNonNullRetryInterval() { public void testBuilderRequiresNonNullRetryInterval() {
try { try {
newBuilder().setRetryInterval(null); newBuilder().setRetryIntervalsMs(null);
fail("Expected exception due to invalid retryIntervalMs"); fail("Expected exception due to invalid retryIntervalMs");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
} }
@@ -142,7 +142,7 @@ public class VcnGatewayConnectionConfigTest {
@Test @Test
public void testBuilderRequiresNonEmptyRetryInterval() { public void testBuilderRequiresNonEmptyRetryInterval() {
try { try {
newBuilder().setRetryInterval(new long[0]); newBuilder().setRetryIntervalsMs(new long[0]);
fail("Expected exception due to invalid retryIntervalMs"); fail("Expected exception due to invalid retryIntervalMs");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
} }

View File

@@ -38,7 +38,7 @@ public class VcnGatewayConnectionRetryTimeoutStateTest extends VcnGatewayConnect
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
mFirstRetryInterval = mConfig.getRetryInterval()[0]; mFirstRetryInterval = mConfig.getRetryIntervalsMs()[0];
mGatewayConnection.setUnderlyingNetwork(TEST_UNDERLYING_NETWORK_RECORD_1); mGatewayConnection.setUnderlyingNetwork(TEST_UNDERLYING_NETWORK_RECORD_1);
mGatewayConnection.transitionTo(mGatewayConnection.mRetryTimeoutState); mGatewayConnection.transitionTo(mGatewayConnection.mRetryTimeoutState);