Merge "[IT4.2] Update argument type of interfaceClassDataActivityChanged"

This commit is contained in:
Chiachang Wang 2020-12-28 01:05:28 +00:00 committed by Gerrit Code Review
commit dcb4051101
5 changed files with 9 additions and 10 deletions

View File

@ -85,14 +85,14 @@ oneway interface INetworkManagementEventObserver {
/**
* Interface data activity status is changed.
*
* @param label Unique identifier indicates the network type of the data activity change.
* @param networkType The legacy network type of the data activity change.
* @param active True if the interface is actively transmitting data, false if it is idle.
* @param tsNanos Elapsed realtime in nanos when the state of the network interface changed.
* @param uid Uid of this event. It represents the uid that was responsible for waking the
* radio. For those events that are reported by system itself, not from specific uid,
* use -1 for the events which means no uid.
*/
void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos, int uid);
void interfaceClassDataActivityChanged(int networkType, boolean active, long tsNanos, int uid);
/**
* Information about available DNS servers has been received.

View File

@ -64,7 +64,7 @@ public class BaseNetworkObserver extends INetworkManagementEventObserver.Stub {
}
@Override
public void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos,
public void interfaceClassDataActivityChanged(int networkType, boolean active, long tsNanos,
int uid) {
// default no-op
}

View File

@ -1792,10 +1792,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
private INetworkManagementEventObserver mDataActivityObserver = new BaseNetworkObserver() {
@Override
public void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos,
public void interfaceClassDataActivityChanged(int networkType, boolean active, long tsNanos,
int uid) {
int deviceType = Integer.parseInt(label);
sendDataActivityBroadcast(deviceType, active, tsNanos);
sendDataActivityBroadcast(networkType, active, tsNanos);
}
};

View File

@ -423,7 +423,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
final boolean active = isActive;
invokeForAllObservers(o -> o.interfaceClassDataActivityChanged(
Integer.toString(type), active, tsNanos, uid));
type, active, tsNanos, uid));
boolean report = false;
synchronized (mIdleTimerLock) {

View File

@ -167,13 +167,13 @@ public class NetworkManagementServiceTest {
* Interface class activity.
*/
unsolListener.onInterfaceClassActivityChanged(true, 1, 1234, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged("1", true, 1234, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged(1, true, 1234, TEST_UID);
unsolListener.onInterfaceClassActivityChanged(false, 9, 5678, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged("9", false, 5678, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged(9, false, 5678, TEST_UID);
unsolListener.onInterfaceClassActivityChanged(false, 9, 4321, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged("9", false, 4321, TEST_UID);
expectSoon(observer).interfaceClassDataActivityChanged(9, false, 4321, TEST_UID);
/**
* IP address changes.