Skip to content

Commit 91c6a64

Browse files
committed
Event logging for lockdown VPN state changes.
Bug: 7079350 Change-Id: I3670efe7f09c0fca55552b6a04a2be159b9beb3c
1 parent f56e243 commit 91c6a64

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

services/java/com/android/server/EventLogTags.logtags

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,11 @@ option java_package com.android.server
148148
# ---------------------------
149149
51100 netstats_mobile_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3)
150150
51101 netstats_wifi_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3)
151+
152+
153+
# ---------------------------
154+
# LockdownVpnTracker.java
155+
# ---------------------------
156+
51200 lockdown_vpn_connecting (egress_net|1)
157+
51201 lockdown_vpn_connected (egress_net|1)
158+
51202 lockdown_vpn_error (egress_net|1)

services/java/com/android/server/net/LockdownVpnTracker.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.android.internal.net.VpnProfile;
4242
import com.android.internal.util.Preconditions;
4343
import com.android.server.ConnectivityService;
44+
import com.android.server.EventLogTags;
4445
import com.android.server.connectivity.Vpn;
4546

4647
/**
@@ -122,12 +123,18 @@ private void handleStateChangedLocked() {
122123
}
123124
if (egressDisconnected) return;
124125

126+
final int egressType = egressInfo.getType();
127+
if (vpnInfo.getDetailedState() == DetailedState.FAILED) {
128+
EventLogTags.writeLockdownVpnError(egressType);
129+
}
130+
125131
if (mErrorCount > MAX_ERROR_COUNT) {
126132
showNotification(R.string.vpn_lockdown_error, R.drawable.vpn_disconnected);
127133

128134
} else if (egressInfo.isConnected() && !vpnInfo.isConnectedOrConnecting()) {
129135
if (mProfile.isValidLockdownProfile()) {
130136
Slog.d(TAG, "Active network connected; starting VPN");
137+
EventLogTags.writeLockdownVpnConnecting(egressType);
131138
showNotification(R.string.vpn_lockdown_connecting, R.drawable.vpn_disconnected);
132139

133140
mAcceptedEgressIface = egressProp.getInterfaceName();
@@ -148,6 +155,7 @@ private void handleStateChangedLocked() {
148155
}
149156

150157
Slog.d(TAG, "VPN connected using iface=" + iface + ", sourceAddr=" + sourceAddr);
158+
EventLogTags.writeLockdownVpnConnected(egressType);
151159
showNotification(R.string.vpn_lockdown_connected, R.drawable.vpn_connected);
152160

153161
try {

0 commit comments

Comments
 (0)