blob: 3d71ecb50d9ffeb50ff494f2e5c45e70b6d56522 [file] [log] [blame]
Hugo Benichi50a84c62016-09-02 09:00:59 +09001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.connectivity;
18
Hugo Benichi73fd4d12017-03-15 23:05:01 +090019import static android.net.NetworkCapabilities.MAX_TRANSPORT;
20import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
21import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
22import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
Hugo Benichi27a51172017-07-18 11:35:18 +090023import static android.net.NetworkCapabilities.TRANSPORT_LOWPAN;
Hugo Benichi73fd4d12017-03-15 23:05:01 +090024import static android.net.NetworkCapabilities.TRANSPORT_VPN;
25import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
26import static android.net.NetworkCapabilities.TRANSPORT_WIFI_AWARE;
Hugo Benichi73fd4d12017-03-15 23:05:01 +090027
Hugo Benichi50a84c62016-09-02 09:00:59 +090028import android.net.ConnectivityMetricsEvent;
29import android.net.metrics.ApfProgramEvent;
30import android.net.metrics.ApfStats;
31import android.net.metrics.DefaultNetworkEvent;
32import android.net.metrics.DhcpClientEvent;
33import android.net.metrics.DhcpErrorEvent;
34import android.net.metrics.DnsEvent;
Hugo Benichi5eb90532017-03-23 18:38:22 +090035import android.net.metrics.ConnectStats;
Hugo Benichi50a84c62016-09-02 09:00:59 +090036import android.net.metrics.IpManagerEvent;
37import android.net.metrics.IpReachabilityEvent;
38import android.net.metrics.NetworkEvent;
39import android.net.metrics.RaEvent;
40import android.net.metrics.ValidationProbeEvent;
Hugo Benichi60c9f632017-09-05 13:34:48 +090041import android.net.metrics.WakeupStats;
Hugo Benichi50a84c62016-09-02 09:00:59 +090042import android.os.Parcelable;
Hugo Benichi73fd4d12017-03-15 23:05:01 +090043import android.util.SparseArray;
Hugo Benichi5eb90532017-03-23 18:38:22 +090044import android.util.SparseIntArray;
Tamas Berghammer383db5eb2016-06-22 15:21:38 +010045import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass;
Hugo Benichi5eb90532017-03-23 18:38:22 +090046import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityEvent;
47import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.IpConnectivityLog;
48import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.NetworkId;
49import com.android.server.connectivity.metrics.nano.IpConnectivityLogClass.Pair;
Hugo Benichi50a84c62016-09-02 09:00:59 +090050import java.io.IOException;
51import java.util.ArrayList;
52import java.util.List;
53
Hugo Benichi50a84c62016-09-02 09:00:59 +090054
55/** {@hide} */
56final public class IpConnectivityEventBuilder {
57 private IpConnectivityEventBuilder() {
58 }
59
Hugo Benichi0d4a3982016-11-25 11:24:22 +090060 public static byte[] serialize(int dropped, List<IpConnectivityEvent> events)
Hugo Benichi50a84c62016-09-02 09:00:59 +090061 throws IOException {
62 final IpConnectivityLog log = new IpConnectivityLog();
Hugo Benichi0d4a3982016-11-25 11:24:22 +090063 log.events = events.toArray(new IpConnectivityEvent[events.size()]);
Hugo Benichi50a84c62016-09-02 09:00:59 +090064 log.droppedEvents = dropped;
Hugo Benichid680d4c2016-10-13 13:16:16 +090065 if ((log.events.length > 0) || (dropped > 0)) {
66 // Only write version number if log has some information at all.
67 log.version = IpConnectivityMetrics.VERSION;
68 }
Hugo Benichi50a84c62016-09-02 09:00:59 +090069 return IpConnectivityLog.toByteArray(log);
70 }
71
Hugo Benichi0d4a3982016-11-25 11:24:22 +090072 public static List<IpConnectivityEvent> toProto(List<ConnectivityMetricsEvent> eventsIn) {
Hugo Benichi50a84c62016-09-02 09:00:59 +090073 final ArrayList<IpConnectivityEvent> eventsOut = new ArrayList<>(eventsIn.size());
74 for (ConnectivityMetricsEvent in : eventsIn) {
75 final IpConnectivityEvent out = toProto(in);
76 if (out == null) {
77 continue;
78 }
79 eventsOut.add(out);
80 }
Hugo Benichi0d4a3982016-11-25 11:24:22 +090081 return eventsOut;
Hugo Benichi50a84c62016-09-02 09:00:59 +090082 }
83
84 public static IpConnectivityEvent toProto(ConnectivityMetricsEvent ev) {
Hugo Benichi5eb90532017-03-23 18:38:22 +090085 final IpConnectivityEvent out = buildEvent(ev.netId, ev.transports, ev.ifname);
86 out.timeMs = ev.timestamp;
Hugo Benichi50a84c62016-09-02 09:00:59 +090087 if (!setEvent(out, ev.data)) {
88 return null;
89 }
Hugo Benichi50a84c62016-09-02 09:00:59 +090090 return out;
91 }
92
Hugo Benichi5eb90532017-03-23 18:38:22 +090093 public static IpConnectivityEvent toProto(ConnectStats in) {
94 IpConnectivityLogClass.ConnectStatistics stats =
95 new IpConnectivityLogClass.ConnectStatistics();
96 stats.connectCount = in.connectCount;
97 stats.connectBlockingCount = in.connectBlockingCount;
98 stats.ipv6AddrCount = in.ipv6ConnectCount;
99 stats.latenciesMs = in.latencies.toArray();
100 stats.errnosCounters = toPairArray(in.errnos);
101 final IpConnectivityEvent out = buildEvent(in.netId, in.transports, null);
102 out.setConnectStatistics(stats);
103 return out;
104 }
105
106
Hugo Benichi2a5cfb92017-03-22 22:21:44 +0900107 public static IpConnectivityEvent toProto(DnsEvent in) {
Hugo Benichi2a5cfb92017-03-22 22:21:44 +0900108 IpConnectivityLogClass.DNSLookupBatch dnsLookupBatch =
109 new IpConnectivityLogClass.DNSLookupBatch();
110 in.resize(in.eventCount);
111 dnsLookupBatch.eventTypes = bytesToInts(in.eventTypes);
112 dnsLookupBatch.returnCodes = bytesToInts(in.returnCodes);
113 dnsLookupBatch.latenciesMs = in.latenciesMs;
Hugo Benichi5eb90532017-03-23 18:38:22 +0900114 final IpConnectivityEvent out = buildEvent(in.netId, in.transports, null);
Hugo Benichi2a5cfb92017-03-22 22:21:44 +0900115 out.setDnsLookupBatch(dnsLookupBatch);
Hugo Benichi2a5cfb92017-03-22 22:21:44 +0900116 return out;
117 }
118
Hugo Benichi60c9f632017-09-05 13:34:48 +0900119 public static IpConnectivityEvent toProto(WakeupStats in) {
120 IpConnectivityLogClass.WakeupStats wakeupStats =
121 new IpConnectivityLogClass.WakeupStats();
122 in.updateDuration();
123 wakeupStats.durationSec = in.durationSec;
124 wakeupStats.totalWakeups = in.totalWakeups;
125 wakeupStats.rootWakeups = in.rootWakeups;
126 wakeupStats.systemWakeups = in.systemWakeups;
127 wakeupStats.nonApplicationWakeups = in.nonApplicationWakeups;
128 wakeupStats.applicationWakeups = in.applicationWakeups;
Hugo Benichi175b5742017-09-19 13:15:26 +0900129 wakeupStats.noUidWakeups = in.noUidWakeups;
Hugo Benichi60c9f632017-09-05 13:34:48 +0900130 final IpConnectivityEvent out = buildEvent(0, 0, in.iface);
131 out.setWakeupStats(wakeupStats);
132 return out;
133 }
134
Hugo Benichi1193a9c2017-10-19 14:58:15 +0900135 public static IpConnectivityEvent toProto(DefaultNetworkEvent in) {
136 IpConnectivityLogClass.DefaultNetworkEvent ev =
137 new IpConnectivityLogClass.DefaultNetworkEvent();
138 ev.networkId = netIdOf(in.netId);
139 ev.previousNetworkId = netIdOf(in.prevNetId);
140 ev.transportTypes = in.transportTypes;
141 ev.previousNetworkIpSupport = ipSupportOf(in);
142 final IpConnectivityEvent out = buildEvent(in.netId, 0, null);
143 out.setDefaultNetworkEvent(ev);
144 return out;
145 }
146
Hugo Benichi5eb90532017-03-23 18:38:22 +0900147 private static IpConnectivityEvent buildEvent(int netId, long transports, String ifname) {
148 final IpConnectivityEvent ev = new IpConnectivityEvent();
149 ev.networkId = netId;
150 ev.transports = transports;
151 if (ifname != null) {
152 ev.ifName = ifname;
153 }
154 inferLinkLayer(ev);
155 return ev;
156 }
157
Hugo Benichi50a84c62016-09-02 09:00:59 +0900158 private static boolean setEvent(IpConnectivityEvent out, Parcelable in) {
159 if (in instanceof DhcpErrorEvent) {
160 setDhcpErrorEvent(out, (DhcpErrorEvent) in);
161 return true;
162 }
163
164 if (in instanceof DhcpClientEvent) {
165 setDhcpClientEvent(out, (DhcpClientEvent) in);
166 return true;
167 }
168
Hugo Benichi50a84c62016-09-02 09:00:59 +0900169 if (in instanceof IpManagerEvent) {
170 setIpManagerEvent(out, (IpManagerEvent) in);
171 return true;
172 }
173
174 if (in instanceof IpReachabilityEvent) {
175 setIpReachabilityEvent(out, (IpReachabilityEvent) in);
176 return true;
177 }
178
Hugo Benichi50a84c62016-09-02 09:00:59 +0900179 if (in instanceof NetworkEvent) {
180 setNetworkEvent(out, (NetworkEvent) in);
181 return true;
182 }
183
184 if (in instanceof ValidationProbeEvent) {
185 setValidationProbeEvent(out, (ValidationProbeEvent) in);
186 return true;
187 }
188
189 if (in instanceof ApfProgramEvent) {
190 setApfProgramEvent(out, (ApfProgramEvent) in);
191 return true;
192 }
193
194 if (in instanceof ApfStats) {
195 setApfStats(out, (ApfStats) in);
196 return true;
197 }
198
199 if (in instanceof RaEvent) {
200 setRaEvent(out, (RaEvent) in);
201 return true;
202 }
203
204 return false;
205 }
206
207 private static void setDhcpErrorEvent(IpConnectivityEvent out, DhcpErrorEvent in) {
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100208 IpConnectivityLogClass.DHCPEvent dhcpEvent = new IpConnectivityLogClass.DHCPEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100209 dhcpEvent.setErrorCode(in.errorCode);
210 out.setDhcpEvent(dhcpEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900211 }
212
213 private static void setDhcpClientEvent(IpConnectivityEvent out, DhcpClientEvent in) {
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100214 IpConnectivityLogClass.DHCPEvent dhcpEvent = new IpConnectivityLogClass.DHCPEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100215 dhcpEvent.setStateTransition(in.msg);
216 dhcpEvent.durationMs = in.durationMs;
217 out.setDhcpEvent(dhcpEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900218 }
219
Hugo Benichi50a84c62016-09-02 09:00:59 +0900220 private static void setIpManagerEvent(IpConnectivityEvent out, IpManagerEvent in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900221 IpConnectivityLogClass.IpProvisioningEvent ipProvisioningEvent =
222 new IpConnectivityLogClass.IpProvisioningEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100223 ipProvisioningEvent.eventType = in.eventType;
224 ipProvisioningEvent.latencyMs = (int) in.durationMs;
225 out.setIpProvisioningEvent(ipProvisioningEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900226 }
227
228 private static void setIpReachabilityEvent(IpConnectivityEvent out, IpReachabilityEvent in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900229 IpConnectivityLogClass.IpReachabilityEvent ipReachabilityEvent =
230 new IpConnectivityLogClass.IpReachabilityEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100231 ipReachabilityEvent.eventType = in.eventType;
232 out.setIpReachabilityEvent(ipReachabilityEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900233 }
234
Hugo Benichi50a84c62016-09-02 09:00:59 +0900235 private static void setNetworkEvent(IpConnectivityEvent out, NetworkEvent in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900236 IpConnectivityLogClass.NetworkEvent networkEvent =
237 new IpConnectivityLogClass.NetworkEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100238 networkEvent.networkId = netIdOf(in.netId);
239 networkEvent.eventType = in.eventType;
240 networkEvent.latencyMs = (int) in.durationMs;
241 out.setNetworkEvent(networkEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900242 }
243
244 private static void setValidationProbeEvent(IpConnectivityEvent out, ValidationProbeEvent in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900245 IpConnectivityLogClass.ValidationProbeEvent validationProbeEvent =
246 new IpConnectivityLogClass.ValidationProbeEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100247 validationProbeEvent.latencyMs = (int) in.durationMs;
248 validationProbeEvent.probeType = in.probeType;
249 validationProbeEvent.probeResult = in.returnCode;
250 out.setValidationProbeEvent(validationProbeEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900251 }
252
253 private static void setApfProgramEvent(IpConnectivityEvent out, ApfProgramEvent in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900254 IpConnectivityLogClass.ApfProgramEvent apfProgramEvent =
255 new IpConnectivityLogClass.ApfProgramEvent();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100256 apfProgramEvent.lifetime = in.lifetime;
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900257 apfProgramEvent.effectiveLifetime = in.actualLifetime;
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100258 apfProgramEvent.filteredRas = in.filteredRas;
259 apfProgramEvent.currentRas = in.currentRas;
260 apfProgramEvent.programLength = in.programLength;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900261 if (isBitSet(in.flags, ApfProgramEvent.FLAG_MULTICAST_FILTER_ON)) {
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100262 apfProgramEvent.dropMulticast = true;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900263 }
264 if (isBitSet(in.flags, ApfProgramEvent.FLAG_HAS_IPV4_ADDRESS)) {
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100265 apfProgramEvent.hasIpv4Addr = true;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900266 }
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100267 out.setApfProgramEvent(apfProgramEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900268 }
269
270 private static void setApfStats(IpConnectivityEvent out, ApfStats in) {
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900271 IpConnectivityLogClass.ApfStatistics apfStatistics =
272 new IpConnectivityLogClass.ApfStatistics();
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100273 apfStatistics.durationMs = in.durationMs;
274 apfStatistics.receivedRas = in.receivedRas;
275 apfStatistics.matchingRas = in.matchingRas;
276 apfStatistics.droppedRas = in.droppedRas;
277 apfStatistics.zeroLifetimeRas = in.zeroLifetimeRas;
278 apfStatistics.parseErrors = in.parseErrors;
279 apfStatistics.programUpdates = in.programUpdates;
Hugo Benichi22d9b2d2017-02-22 13:02:27 +0900280 apfStatistics.programUpdatesAll = in.programUpdatesAll;
281 apfStatistics.programUpdatesAllowingMulticast = in.programUpdatesAllowingMulticast;
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100282 apfStatistics.maxProgramSize = in.maxProgramSize;
283 out.setApfStatistics(apfStatistics);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900284 }
285
286 private static void setRaEvent(IpConnectivityEvent out, RaEvent in) {
Tamas Berghammer383db5eb2016-06-22 15:21:38 +0100287 IpConnectivityLogClass.RaEvent raEvent = new IpConnectivityLogClass.RaEvent();
288 raEvent.routerLifetime = in.routerLifetime;
289 raEvent.prefixValidLifetime = in.prefixValidLifetime;
290 raEvent.prefixPreferredLifetime = in.prefixPreferredLifetime;
291 raEvent.routeInfoLifetime = in.routeInfoLifetime;
292 raEvent.rdnssLifetime = in.rdnssLifetime;
293 raEvent.dnsslLifetime = in.dnsslLifetime;
294 out.setRaEvent(raEvent);
Hugo Benichi50a84c62016-09-02 09:00:59 +0900295 }
296
297 private static int[] bytesToInts(byte[] in) {
298 final int[] out = new int[in.length];
299 for (int i = 0; i < in.length; i++) {
300 out[i] = in[i] & 0xFF;
301 }
302 return out;
303 }
304
Hugo Benichi5eb90532017-03-23 18:38:22 +0900305 private static Pair[] toPairArray(SparseIntArray counts) {
306 final int s = counts.size();
307 Pair[] pairs = new Pair[s];
308 for (int i = 0; i < s; i++) {
309 Pair p = new Pair();
310 p.key = counts.keyAt(i);
311 p.value = counts.valueAt(i);
312 pairs[i] = p;
313 }
314 return pairs;
315 }
316
Hugo Benichi50a84c62016-09-02 09:00:59 +0900317 private static NetworkId netIdOf(int netid) {
318 final NetworkId ni = new NetworkId();
319 ni.networkId = netid;
320 return ni;
321 }
322
323 private static int ipSupportOf(DefaultNetworkEvent in) {
324 if (in.prevIPv4 && in.prevIPv6) {
325 return IpConnectivityLogClass.DefaultNetworkEvent.DUAL;
326 }
327 if (in.prevIPv6) {
328 return IpConnectivityLogClass.DefaultNetworkEvent.IPV6;
329 }
330 if (in.prevIPv4) {
331 return IpConnectivityLogClass.DefaultNetworkEvent.IPV4;
332 }
333 return IpConnectivityLogClass.DefaultNetworkEvent.NONE;
334 }
335
336 private static boolean isBitSet(int flags, int bit) {
337 return (flags & (1 << bit)) != 0;
338 }
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900339
340 private static void inferLinkLayer(IpConnectivityEvent ev) {
341 int linkLayer = IpConnectivityLogClass.UNKNOWN;
342 if (ev.transports != 0) {
343 linkLayer = transportsToLinkLayer(ev.transports);
344 } else if (ev.ifName != null) {
345 linkLayer = ifnameToLinkLayer(ev.ifName);
346 }
347 if (linkLayer == IpConnectivityLogClass.UNKNOWN) {
348 return;
349 }
350 ev.linkLayer = linkLayer;
351 ev.ifName = "";
352 }
353
354 private static int transportsToLinkLayer(long transports) {
355 switch (Long.bitCount(transports)) {
356 case 0:
357 return IpConnectivityLogClass.UNKNOWN;
358 case 1:
359 int t = Long.numberOfTrailingZeros(transports);
360 return transportToLinkLayer(t);
361 default:
362 return IpConnectivityLogClass.MULTIPLE;
363 }
364 }
365
366 private static int transportToLinkLayer(int transport) {
367 if (0 <= transport && transport < TRANSPORT_LINKLAYER_MAP.length) {
368 return TRANSPORT_LINKLAYER_MAP[transport];
369 }
370 return IpConnectivityLogClass.UNKNOWN;
371 }
372
373 private static final int[] TRANSPORT_LINKLAYER_MAP = new int[MAX_TRANSPORT + 1];
374 static {
375 TRANSPORT_LINKLAYER_MAP[TRANSPORT_CELLULAR] = IpConnectivityLogClass.CELLULAR;
376 TRANSPORT_LINKLAYER_MAP[TRANSPORT_WIFI] = IpConnectivityLogClass.WIFI;
377 TRANSPORT_LINKLAYER_MAP[TRANSPORT_BLUETOOTH] = IpConnectivityLogClass.BLUETOOTH;
378 TRANSPORT_LINKLAYER_MAP[TRANSPORT_ETHERNET] = IpConnectivityLogClass.ETHERNET;
379 TRANSPORT_LINKLAYER_MAP[TRANSPORT_VPN] = IpConnectivityLogClass.UNKNOWN;
Hugo Benichi27a51172017-07-18 11:35:18 +0900380 TRANSPORT_LINKLAYER_MAP[TRANSPORT_WIFI_AWARE] = IpConnectivityLogClass.WIFI_NAN;
381 TRANSPORT_LINKLAYER_MAP[TRANSPORT_LOWPAN] = IpConnectivityLogClass.LOWPAN;
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900382 };
383
384 private static int ifnameToLinkLayer(String ifname) {
385 // Do not try to catch all interface names with regexes, instead only catch patterns that
386 // are cheap to check, and otherwise fallback on postprocessing in aggregation layer.
Hugo Benichi27a51172017-07-18 11:35:18 +0900387 for (int i = 0; i < KNOWN_PREFIX; i++) {
388 String pattern = IFNAME_PREFIXES[i];
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900389 if (ifname.startsWith(pattern)) {
Hugo Benichi27a51172017-07-18 11:35:18 +0900390 return IFNAME_LINKLAYERS[i];
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900391 }
392 }
393 return IpConnectivityLogClass.UNKNOWN;
394 }
395
Hugo Benichi27a51172017-07-18 11:35:18 +0900396 private static final int KNOWN_PREFIX = 7;
397 private static final String[] IFNAME_PREFIXES = new String[KNOWN_PREFIX];
398 private static final int[] IFNAME_LINKLAYERS = new int[KNOWN_PREFIX];
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900399 static {
Hugo Benichi27a51172017-07-18 11:35:18 +0900400 // Ordered from most likely link layer to least likely.
401 IFNAME_PREFIXES[0] = "rmnet";
402 IFNAME_LINKLAYERS[0] = IpConnectivityLogClass.CELLULAR;
403
404 IFNAME_PREFIXES[1] = "wlan";
405 IFNAME_LINKLAYERS[1] = IpConnectivityLogClass.WIFI;
406
407 IFNAME_PREFIXES[2] = "bt-pan";
408 IFNAME_LINKLAYERS[2] = IpConnectivityLogClass.BLUETOOTH;
409
410 IFNAME_PREFIXES[3] = "p2p";
411 IFNAME_LINKLAYERS[3] = IpConnectivityLogClass.WIFI_P2P;
412
413 IFNAME_PREFIXES[4] = "aware";
414 IFNAME_LINKLAYERS[4] = IpConnectivityLogClass.WIFI_NAN;
415
416 IFNAME_PREFIXES[5] = "eth";
417 IFNAME_LINKLAYERS[5] = IpConnectivityLogClass.ETHERNET;
418
419 IFNAME_PREFIXES[6] = "wpan";
420 IFNAME_LINKLAYERS[6] = IpConnectivityLogClass.LOWPAN;
Hugo Benichi73fd4d12017-03-15 23:05:01 +0900421 }
Hugo Benichi50a84c62016-09-02 09:00:59 +0900422}