Merge "Add underpinned Network parameter in SocketKeepalive.start()"
This commit is contained in:
@@ -188,7 +188,7 @@ interface IConnectivityManager
|
||||
|
||||
void startNattKeepaliveWithFd(in Network network, in ParcelFileDescriptor pfd, int resourceId,
|
||||
int intervalSeconds, in ISocketKeepaliveCallback cb, String srcAddr,
|
||||
String dstAddr, boolean automaticOnOffKeepalives);
|
||||
String dstAddr, boolean automaticOnOffKeepalives, in Network underpinnedNetwork);
|
||||
|
||||
void startTcpKeepalive(in Network network, in ParcelFileDescriptor pfd, int intervalSeconds,
|
||||
in ISocketKeepaliveCallback cb);
|
||||
|
||||
@@ -66,10 +66,12 @@ public final class NattSocketKeepalive extends SocketKeepalive {
|
||||
* the supplied {@link Callback} will see a call to
|
||||
* {@link Callback#onError(int)} with {@link #ERROR_INVALID_INTERVAL}.
|
||||
* @param flags Flags to enable/disable available options on this keepalive.
|
||||
* @param underpinnedNetwork The underpinned network of this keepalive.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Override
|
||||
protected void startImpl(int intervalSec, int flags) {
|
||||
protected void startImpl(int intervalSec, int flags, Network underpinnedNetwork) {
|
||||
if (0 != (flags & ~FLAG_AUTOMATIC_ON_OFF)) {
|
||||
throw new IllegalArgumentException("Illegal flag value for "
|
||||
+ this.getClass().getSimpleName() + " : " + flags);
|
||||
@@ -79,7 +81,8 @@ public final class NattSocketKeepalive extends SocketKeepalive {
|
||||
try {
|
||||
mService.startNattKeepaliveWithFd(mNetwork, mPfd, mResourceId,
|
||||
intervalSec, mCallback, mSource.getHostAddress(),
|
||||
mDestination.getHostAddress(), automaticOnOffKeepalives);
|
||||
mDestination.getHostAddress(), automaticOnOffKeepalives,
|
||||
underpinnedNetwork);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error starting socket keepalive: ", e);
|
||||
throw e.rethrowFromSystemServer();
|
||||
|
||||
@@ -355,7 +355,7 @@ public abstract class SocketKeepalive implements AutoCloseable {
|
||||
*/
|
||||
public final void start(@IntRange(from = MIN_INTERVAL_SEC, to = MAX_INTERVAL_SEC)
|
||||
int intervalSec) {
|
||||
startImpl(intervalSec, 0 /* flags */);
|
||||
startImpl(intervalSec, 0 /* flags */, null /* underpinnedNetwork */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,16 +374,18 @@ public abstract class SocketKeepalive implements AutoCloseable {
|
||||
* the supplied {@link Callback} will see a call to
|
||||
* {@link Callback#onError(int)} with {@link #ERROR_INVALID_INTERVAL}.
|
||||
* @param flags Flags to enable/disable available options on this keepalive.
|
||||
* @param underpinnedNetwork The underpinned network of this keepalive.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = PRIVILEGED_APPS)
|
||||
public final void start(@IntRange(from = MIN_INTERVAL_SEC, to = MAX_INTERVAL_SEC)
|
||||
int intervalSec, @StartFlags int flags) {
|
||||
startImpl(intervalSec, flags);
|
||||
int intervalSec, @StartFlags int flags, @NonNull Network underpinnedNetwork) {
|
||||
startImpl(intervalSec, flags, underpinnedNetwork);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
protected abstract void startImpl(int intervalSec, @StartFlags int flags);
|
||||
protected abstract void startImpl(int intervalSec, @StartFlags int flags,
|
||||
Network underpinnedNetwork);
|
||||
|
||||
/**
|
||||
* Requests that keepalive be stopped. The application must wait for {@link Callback#onStopped}
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class TcpSocketKeepalive extends SocketKeepalive {
|
||||
* acknowledgement.
|
||||
*/
|
||||
@Override
|
||||
protected void startImpl(int intervalSec, int flags) {
|
||||
protected void startImpl(int intervalSec, int flags, Network underpinnedNetwork) {
|
||||
if (0 != flags) {
|
||||
throw new IllegalArgumentException("Illegal flag value for "
|
||||
+ this.getClass().getSimpleName() + " : " + flags);
|
||||
|
||||
Reference in New Issue
Block a user