[DK5]Add debugging information for automaticOnOff keepalive
Print state and keepalive information in the dump.
Also update ConnectivityService and the corresponding test to
create AutomaticOnOffKeepaliveTracker from a Dependencies class.
ConnectivityService#dump() will require READ_DEVICE_CONFIG
permission because of the new dump() in AutomaticOnOffKeepaliveTreacker.
ConnectivityServiceTest should focus on verifying design in
ConnectivityService, so skipping the DeviceConfig check via a fake
Dependencies class in the unit test.
Sample dump:
AutomaticOnOff enabled: true
AutomaticOnOffKeepalive [KeepaliveInfo [ type=1 network=100 startedS ... ], state=STATE_ENABLED ]
Bug: 259000745
Test: m ; atest FrameworksNetTests CtsNetTestCases
Change-Id: I9ac725bcef7daec1d1a12bad592b7fa6856a1707
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index 24dcf28..1332f32 100755
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -1316,6 +1316,14 @@
}
/**
+ * @see AutomaticOnOffKeepaliveTracker
+ */
+ public AutomaticOnOffKeepaliveTracker makeAutomaticOnOffKeepaliveTracker(
+ @NonNull Context c, @NonNull Handler h) {
+ return new AutomaticOnOffKeepaliveTracker(c, h);
+ }
+
+ /**
* @see BatteryStatsManager
*/
public void reportNetworkInterfaceForTransports(Context context, String iface,
@@ -1578,7 +1586,7 @@
mSettingsObserver = new SettingsObserver(mContext, mHandler);
registerSettingsCallbacks();
- mKeepaliveTracker = new AutomaticOnOffKeepaliveTracker(mContext, mHandler);
+ mKeepaliveTracker = mDeps.makeAutomaticOnOffKeepaliveTracker(mContext, mHandler);
mNotifier = new NetworkNotificationManager(mContext, mTelephonyManager);
mQosCallbackTracker = new QosCallbackTracker(mHandler, mNetworkRequestCounter);