Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05814988 authored by Benedict Wong's avatar Benedict Wong Committed by Automerger Merge Worker
Browse files

Merge "Update set|getRetryIntervalsMs to Millis" am: c6fe3006

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1688783

Change-Id: I0ddfd92b8d08c58b2318a5bbd2a8a4bb6edbc8f9
parents f965ffe0 c6fe3006
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 {
+4 −4
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+4 −4
Original line number Diff line number Diff line
@@ -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());
    }

+1 −1
Original line number Diff line number Diff line
@@ -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);