Merge "Correct nullability and add extra check for underpinnedNetwork"
This commit is contained in:
@@ -470,7 +470,7 @@ package android.net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract class SocketKeepalive implements java.lang.AutoCloseable {
|
public abstract class SocketKeepalive implements java.lang.AutoCloseable {
|
||||||
method public final void start(@IntRange(from=0xa, to=0xe10) int, int, @NonNull android.net.Network);
|
method public final void start(@IntRange(from=0xa, to=0xe10) int, int, @Nullable android.net.Network);
|
||||||
field public static final int ERROR_NO_SUCH_SLOT = -33; // 0xffffffdf
|
field public static final int ERROR_NO_SUCH_SLOT = -33; // 0xffffffdf
|
||||||
field public static final int FLAG_AUTOMATIC_ON_OFF = 1; // 0x1
|
field public static final int FLAG_AUTOMATIC_ON_OFF = 1; // 0x1
|
||||||
field public static final int SUCCESS = 0; // 0x0
|
field public static final int SUCCESS = 0; // 0x0
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.annotation.SystemApi.Client.PRIVILEGED_APPS;
|
|||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.annotation.IntRange;
|
import android.annotation.IntRange;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
@@ -374,12 +375,14 @@ public abstract class SocketKeepalive implements AutoCloseable {
|
|||||||
* the supplied {@link Callback} will see a call to
|
* the supplied {@link Callback} will see a call to
|
||||||
* {@link Callback#onError(int)} with {@link #ERROR_INVALID_INTERVAL}.
|
* {@link Callback#onError(int)} with {@link #ERROR_INVALID_INTERVAL}.
|
||||||
* @param flags Flags to enable/disable available options on this keepalive.
|
* @param flags Flags to enable/disable available options on this keepalive.
|
||||||
* @param underpinnedNetwork The underpinned network of this keepalive.
|
* @param underpinnedNetwork an optional network running over mNetwork that this
|
||||||
|
* keepalive is intended to keep up, e.g. an IPSec
|
||||||
|
* tunnel running over mNetwork.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = PRIVILEGED_APPS)
|
@SystemApi(client = PRIVILEGED_APPS)
|
||||||
public final void start(@IntRange(from = MIN_INTERVAL_SEC, to = MAX_INTERVAL_SEC)
|
public final void start(@IntRange(from = MIN_INTERVAL_SEC, to = MAX_INTERVAL_SEC)
|
||||||
int intervalSec, @StartFlags int flags, @NonNull Network underpinnedNetwork) {
|
int intervalSec, @StartFlags int flags, @Nullable Network underpinnedNetwork) {
|
||||||
startImpl(intervalSec, flags, underpinnedNetwork);
|
startImpl(intervalSec, flags, underpinnedNetwork);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ public final class TcpSocketKeepalive extends SocketKeepalive {
|
|||||||
throw new IllegalArgumentException("Illegal flag value for "
|
throw new IllegalArgumentException("Illegal flag value for "
|
||||||
+ this.getClass().getSimpleName() + " : " + flags);
|
+ this.getClass().getSimpleName() + " : " + flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (underpinnedNetwork != null) {
|
||||||
|
throw new IllegalArgumentException("Illegal underpinned network for "
|
||||||
|
+ this.getClass().getSimpleName() + " : " + underpinnedNetwork);
|
||||||
|
}
|
||||||
|
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
try {
|
try {
|
||||||
mService.startTcpKeepalive(mNetwork, mPfd, intervalSec, mCallback);
|
mService.startTcpKeepalive(mNetwork, mPfd, intervalSec, mCallback);
|
||||||
|
|||||||
Reference in New Issue
Block a user