Merge "Add network disconnected callback" am: c1657fb7f8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652259 Change-Id: I75bd112821c42c16d7ed91ecbb4f21104c95204b
This commit is contained in:
@@ -218,6 +218,7 @@ package android.net {
|
||||
method public void onAddKeepalivePacketFilter(int, @NonNull android.net.KeepalivePacketData);
|
||||
method public void onAutomaticReconnectDisabled();
|
||||
method public void onNetworkCreated();
|
||||
method public void onNetworkDisconnected();
|
||||
method public void onNetworkUnwanted();
|
||||
method public void onQosCallbackRegistered(int, @NonNull android.net.QosFilter);
|
||||
method public void onQosCallbackUnregistered(int);
|
||||
|
||||
@@ -47,4 +47,5 @@ oneway interface INetworkAgent {
|
||||
void onQosFilterCallbackRegistered(int qosCallbackId, in QosFilterParcelable filterParcel);
|
||||
void onQosCallbackUnregistered(int qosCallbackId);
|
||||
void onNetworkCreated();
|
||||
void onNetworkDisconnected();
|
||||
}
|
||||
|
||||
@@ -370,6 +370,14 @@ public abstract class NetworkAgent {
|
||||
*/
|
||||
public static final int CMD_NETWORK_CREATED = BASE + 22;
|
||||
|
||||
/**
|
||||
* Sent by ConnectivityService to {@link NetworkAgent} to inform the agent that its native
|
||||
* network was destroyed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int CMD_NETWORK_DISCONNECTED = BASE + 23;
|
||||
|
||||
private static NetworkInfo getLegacyNetworkInfo(final NetworkAgentConfig config) {
|
||||
// The subtype can be changed with (TODO) setLegacySubtype, but it starts
|
||||
// with 0 (TelephonyManager.NETWORK_TYPE_UNKNOWN) and an empty description.
|
||||
@@ -574,6 +582,10 @@ public abstract class NetworkAgent {
|
||||
onNetworkCreated();
|
||||
break;
|
||||
}
|
||||
case CMD_NETWORK_DISCONNECTED: {
|
||||
onNetworkDisconnected();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -719,6 +731,11 @@ public abstract class NetworkAgent {
|
||||
public void onNetworkCreated() {
|
||||
mHandler.sendMessage(mHandler.obtainMessage(CMD_NETWORK_CREATED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkDisconnected() {
|
||||
mHandler.sendMessage(mHandler.obtainMessage(CMD_NETWORK_DISCONNECTED));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1031,6 +1048,12 @@ public abstract class NetworkAgent {
|
||||
*/
|
||||
public void onNetworkCreated() {}
|
||||
|
||||
|
||||
/**
|
||||
* Called when ConnectivityService has successfully destroy this NetworkAgent's native network.
|
||||
*/
|
||||
public void onNetworkDisconnected() {}
|
||||
|
||||
/**
|
||||
* Requests that the network hardware send the specified packet at the specified interval.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user