Merge "Add network created callback support"
This commit is contained in:
@@ -217,6 +217,7 @@ package android.net {
|
||||
method public void markConnected();
|
||||
method public void onAddKeepalivePacketFilter(int, @NonNull android.net.KeepalivePacketData);
|
||||
method public void onAutomaticReconnectDisabled();
|
||||
method public void onNetworkCreated();
|
||||
method public void onNetworkUnwanted();
|
||||
method public void onQosCallbackRegistered(int, @NonNull android.net.QosFilter);
|
||||
method public void onQosCallbackUnregistered(int);
|
||||
|
||||
@@ -46,4 +46,5 @@ oneway interface INetworkAgent {
|
||||
void onRemoveKeepalivePacketFilter(int slot);
|
||||
void onQosFilterCallbackRegistered(int qosCallbackId, in QosFilterParcelable filterParcel);
|
||||
void onQosCallbackUnregistered(int qosCallbackId);
|
||||
void onNetworkCreated();
|
||||
}
|
||||
|
||||
@@ -362,6 +362,14 @@ public abstract class NetworkAgent {
|
||||
*/
|
||||
public static final int CMD_UNREGISTER_QOS_CALLBACK = BASE + 21;
|
||||
|
||||
/**
|
||||
* Sent by ConnectivityService to {@link NetworkAgent} to inform the agent that its native
|
||||
* network was created and the Network object is now valid.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int CMD_NETWORK_CREATED = BASE + 22;
|
||||
|
||||
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.
|
||||
@@ -562,6 +570,10 @@ public abstract class NetworkAgent {
|
||||
msg.arg1 /* QoS callback id */);
|
||||
break;
|
||||
}
|
||||
case CMD_NETWORK_CREATED: {
|
||||
onNetworkCreated();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -702,6 +714,11 @@ public abstract class NetworkAgent {
|
||||
mHandler.sendMessage(mHandler.obtainMessage(
|
||||
CMD_UNREGISTER_QOS_CALLBACK, qosCallbackId, 0, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkCreated() {
|
||||
mHandler.sendMessage(mHandler.obtainMessage(CMD_NETWORK_CREATED));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1009,6 +1026,11 @@ public abstract class NetworkAgent {
|
||||
protected void saveAcceptUnvalidated(boolean accept) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when ConnectivityService has successfully created this NetworkAgent's native network.
|
||||
*/
|
||||
public void onNetworkCreated() {}
|
||||
|
||||
/**
|
||||
* Requests that the network hardware send the specified packet at the specified interval.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user