summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lorenzo Colitti <lorenzo@google.com> 2019-01-24 16:00:25 +0900
committer Lorenzo Colitti <lorenzo@google.com> 2019-01-25 00:33:02 +0900
commit943619d506a3f80aa7a90b6f0e3c9bb37e0841b7 (patch)
tree9b95b502fd80a310289644e1cdde49ee048df2d8
parent0d4002db35fc6dd5976176b468597e8a65d8d895 (diff)
Change the signature of notifyInterfaceClassActivity.
This simplifies an upcoming refactoring of the notification code. There is no change in functionality because DC_POWER_STAET_MEDIUM was never actually used. Bug: 112869080 Test: builds, boots Test: atest FrameworksNetTests Change-Id: Ie7bd145961bbd7f2a424be4299e2085da9cddc38
-rw-r--r--services/core/java/com/android/server/NetworkManagementService.java26
1 files changed, 10 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index 7f61dd120c7f..8592491b5e06 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -46,11 +46,11 @@ import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.Context;
import android.net.ConnectivityManager;
-import android.net.InetAddresses;
import android.net.INetd;
import android.net.INetdUnsolicitedEventListener;
import android.net.INetworkManagementEventObserver;
import android.net.ITetheringStatsProvider;
+import android.net.InetAddresses;
import android.net.InterfaceConfiguration;
import android.net.InterfaceConfigurationParcel;
import android.net.IpPrefix;
@@ -465,9 +465,12 @@ public class NetworkManagementService extends INetworkManagementService.Stub
/**
* Notify our observers of a change in the data activity state of the interface
*/
- private void notifyInterfaceClassActivity(int type, int powerState, long tsNanos,
+ private void notifyInterfaceClassActivity(int type, boolean isActive, long tsNanos,
int uid, boolean fromRadio) {
final boolean isMobile = ConnectivityManager.isNetworkTypeMobile(type);
+ int powerState = isActive
+ ? DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH
+ : DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
if (isMobile) {
if (!fromRadio) {
if (mMobileActivityFromRadio) {
@@ -498,9 +501,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
}
- boolean isActive = powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM
- || powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH;
-
if (!isMobile || fromRadio || !mMobileActivityFromRadio) {
// Report the change in data activity. We don't do this if this is a change
// on the mobile network, that is not coming from the radio itself, and we
@@ -734,10 +734,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub
} else {
timestampNanos = timestamp;
}
- mDaemonHandler.post(() -> notifyInterfaceClassActivity(label,
- isActive ? DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH
- : DataConnectionRealTimeInfo.DC_POWER_STATE_LOW,
- timestampNanos, uid, false));
+ mDaemonHandler.post(() ->
+ notifyInterfaceClassActivity(label, isActive, timestampNanos, uid, false));
}
@Override
@@ -904,9 +902,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
boolean isActive = cooked[2].equals("active");
notifyInterfaceClassActivity(Integer.parseInt(cooked[3]),
- isActive ? DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH
- : DataConnectionRealTimeInfo.DC_POWER_STATE_LOW,
- timestampNanos, processUid, false);
+ isActive, timestampNanos, processUid, false);
return true;
// break;
case NetdResponseCode.InterfaceAddressChange:
@@ -1456,8 +1452,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
if (ConnectivityManager.isNetworkTypeMobile(type)) {
mNetworkActive = false;
}
- mDaemonHandler.post(() -> notifyInterfaceClassActivity(type,
- DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH,
+ mDaemonHandler.post(() -> notifyInterfaceClassActivity(type, true,
SystemClock.elapsedRealtimeNanos(), -1, false));
}
}
@@ -1481,8 +1476,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
throw new IllegalStateException(e);
}
mActiveIdleTimers.remove(iface);
- mDaemonHandler.post(() -> notifyInterfaceClassActivity(params.type,
- DataConnectionRealTimeInfo.DC_POWER_STATE_LOW,
+ mDaemonHandler.post(() -> notifyInterfaceClassActivity(params.type, false,
SystemClock.elapsedRealtimeNanos(), -1, false));
}
}