Merge "IP connectivity metrics: cleanup obsolete code"
This commit is contained in:
@@ -213,7 +213,6 @@ LOCAL_SRC_FILES += \
|
||||
core/java/android/hardware/usb/IUsbManager.aidl \
|
||||
core/java/android/net/ICaptivePortal.aidl \
|
||||
core/java/android/net/IConnectivityManager.aidl \
|
||||
core/java/android/net/IConnectivityMetricsLogger.aidl \
|
||||
core/java/android/net/IIpConnectivityMetrics.aidl \
|
||||
core/java/android/net/IEthernetManager.aidl \
|
||||
core/java/android/net/IEthernetServiceListener.aidl \
|
||||
|
||||
@@ -26831,44 +26831,6 @@ package android.net {
|
||||
method public void onTetheringStarted();
|
||||
}
|
||||
|
||||
public final class ConnectivityMetricsEvent implements android.os.Parcelable {
|
||||
ctor public ConnectivityMetricsEvent(long, int, int, android.os.Parcelable);
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.ConnectivityMetricsEvent> CREATOR;
|
||||
field public final int componentTag;
|
||||
field public final android.os.Parcelable data;
|
||||
field public final int eventTag;
|
||||
field public final long timestamp;
|
||||
}
|
||||
|
||||
public static final class ConnectivityMetricsEvent.Reference implements android.os.Parcelable {
|
||||
ctor public ConnectivityMetricsEvent.Reference(long);
|
||||
method public int describeContents();
|
||||
method public long getValue();
|
||||
method public void readFromParcel(android.os.Parcel);
|
||||
method public void setValue(long);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.ConnectivityMetricsEvent.Reference> CREATOR;
|
||||
}
|
||||
|
||||
public class ConnectivityMetricsLogger {
|
||||
ctor public ConnectivityMetricsLogger();
|
||||
method public android.net.ConnectivityMetricsEvent[] getEvents(android.net.ConnectivityMetricsEvent.Reference);
|
||||
method public void logEvent(long, int, int, android.os.Parcelable);
|
||||
method public boolean register(android.app.PendingIntent);
|
||||
method public boolean unregister(android.app.PendingIntent);
|
||||
field public static final int COMPONENT_TAG_BLUETOOTH = 1; // 0x1
|
||||
field public static final int COMPONENT_TAG_CONNECTIVITY = 0; // 0x0
|
||||
field public static final int COMPONENT_TAG_TELECOM = 3; // 0x3
|
||||
field public static final int COMPONENT_TAG_TELEPHONY = 4; // 0x4
|
||||
field public static final int COMPONENT_TAG_WIFI = 2; // 0x2
|
||||
field public static final java.lang.String CONNECTIVITY_METRICS_LOGGER_SERVICE = "connectivity_metrics_logger";
|
||||
field public static final java.lang.String DATA_KEY_EVENTS_COUNT = "count";
|
||||
field public static final int NUMBER_OF_COMPONENTS = 5; // 0x5
|
||||
field public static final int TAG_SKIPPED_EVENTS = -1; // 0xffffffff
|
||||
}
|
||||
|
||||
public class Credentials {
|
||||
ctor public Credentials(int, int, int);
|
||||
method public int getGid();
|
||||
@@ -27580,175 +27542,6 @@ package android.net.http {
|
||||
|
||||
}
|
||||
|
||||
package android.net.metrics {
|
||||
|
||||
public final class ApfProgramEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.ApfProgramEvent> CREATOR;
|
||||
field public static final int FLAG_HAS_IPV4_ADDRESS = 1; // 0x1
|
||||
field public static final int FLAG_MULTICAST_FILTER_ON = 0; // 0x0
|
||||
field public final int currentRas;
|
||||
field public final int filteredRas;
|
||||
field public final int flags;
|
||||
field public final long lifetime;
|
||||
field public final int programLength;
|
||||
}
|
||||
|
||||
public final class ApfStats implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.ApfStats> CREATOR;
|
||||
field public final int droppedRas;
|
||||
field public final long durationMs;
|
||||
field public final int matchingRas;
|
||||
field public final int maxProgramSize;
|
||||
field public final int parseErrors;
|
||||
field public final int programUpdates;
|
||||
field public final int receivedRas;
|
||||
field public final int zeroLifetimeRas;
|
||||
}
|
||||
|
||||
public final class DefaultNetworkEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logEvent(int, int[], int, boolean, boolean);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.DefaultNetworkEvent> CREATOR;
|
||||
field public final int netId;
|
||||
field public final boolean prevIPv4;
|
||||
field public final boolean prevIPv6;
|
||||
field public final int prevNetId;
|
||||
field public final int[] transportTypes;
|
||||
}
|
||||
|
||||
public final class DhcpClientEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logStateEvent(java.lang.String, java.lang.String);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.DhcpClientEvent> CREATOR;
|
||||
field public final int durationMs;
|
||||
field public final java.lang.String ifName;
|
||||
field public final java.lang.String msg;
|
||||
}
|
||||
|
||||
public final class DhcpErrorEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static int errorCodeWithOption(int, int);
|
||||
method public static void logParseError(java.lang.String, int);
|
||||
method public static void logReceiveError(java.lang.String);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final int BOOTP_TOO_SHORT;
|
||||
field public static final int BUFFER_UNDERFLOW;
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.DhcpErrorEvent> CREATOR;
|
||||
field public static final int DHCP_BAD_MAGIC_COOKIE;
|
||||
field public static final int DHCP_ERROR = 4; // 0x4
|
||||
field public static final int DHCP_INVALID_OPTION_LENGTH;
|
||||
field public static final int DHCP_NO_MSG_TYPE;
|
||||
field public static final int DHCP_UNKNOWN_MSG_TYPE;
|
||||
field public static final int L2_ERROR = 1; // 0x1
|
||||
field public static final int L2_TOO_SHORT;
|
||||
field public static final int L2_WRONG_ETH_TYPE;
|
||||
field public static final int L3_ERROR = 2; // 0x2
|
||||
field public static final int L3_INVALID_IP;
|
||||
field public static final int L3_NOT_IPV4;
|
||||
field public static final int L3_TOO_SHORT;
|
||||
field public static final int L4_ERROR = 3; // 0x3
|
||||
field public static final int L4_NOT_UDP;
|
||||
field public static final int L4_WRONG_PORT;
|
||||
field public static final int MISC_ERROR = 5; // 0x5
|
||||
field public static final int RECEIVE_ERROR;
|
||||
field public final int errorCode;
|
||||
field public final java.lang.String ifName;
|
||||
}
|
||||
|
||||
public final class DnsEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logEvent(int, byte[], byte[], int[]);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.DnsEvent> CREATOR;
|
||||
field public final byte[] eventTypes;
|
||||
field public final int[] latenciesMs;
|
||||
field public final int netId;
|
||||
field public final byte[] returnCodes;
|
||||
}
|
||||
|
||||
public final class IpManagerEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logEvent(int, java.lang.String, long);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final int COMPLETE_LIFECYCLE = 3; // 0x3
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.IpManagerEvent> CREATOR;
|
||||
field public static final int PROVISIONING_FAIL = 2; // 0x2
|
||||
field public static final int PROVISIONING_OK = 1; // 0x1
|
||||
field public final long durationMs;
|
||||
field public final int eventType;
|
||||
field public final java.lang.String ifName;
|
||||
}
|
||||
|
||||
public final class IpReachabilityEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logNudFailed(java.lang.String);
|
||||
method public static void logProbeEvent(java.lang.String, int);
|
||||
method public static void logProvisioningLost(java.lang.String);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.IpReachabilityEvent> CREATOR;
|
||||
field public static final int NUD_FAILED = 512; // 0x200
|
||||
field public static final int PROBE = 256; // 0x100
|
||||
field public static final int PROVISIONING_LOST = 768; // 0x300
|
||||
field public final int eventType;
|
||||
field public final java.lang.String ifName;
|
||||
}
|
||||
|
||||
public final class NetworkEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logCaptivePortalFound(int, long);
|
||||
method public static void logEvent(int, int);
|
||||
method public static void logValidated(int, long);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.NetworkEvent> CREATOR;
|
||||
field public static final int NETWORK_CAPTIVE_PORTAL_FOUND = 4; // 0x4
|
||||
field public static final int NETWORK_CONNECTED = 1; // 0x1
|
||||
field public static final int NETWORK_DISCONNECTED = 7; // 0x7
|
||||
field public static final int NETWORK_LINGER = 5; // 0x5
|
||||
field public static final int NETWORK_UNLINGER = 6; // 0x6
|
||||
field public static final int NETWORK_VALIDATED = 2; // 0x2
|
||||
field public static final int NETWORK_VALIDATION_FAILED = 3; // 0x3
|
||||
field public final long durationMs;
|
||||
field public final int eventType;
|
||||
field public final int netId;
|
||||
}
|
||||
|
||||
public final class RaEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.RaEvent> CREATOR;
|
||||
field public final long dnsslLifetime;
|
||||
field public final long prefixPreferredLifetime;
|
||||
field public final long prefixValidLifetime;
|
||||
field public final long rdnssLifetime;
|
||||
field public final long routeInfoLifetime;
|
||||
field public final long routerLifetime;
|
||||
}
|
||||
|
||||
public final class ValidationProbeEvent implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public static void logEvent(int, long, int, int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.metrics.ValidationProbeEvent> CREATOR;
|
||||
field public static final int DNS_FAILURE = 0; // 0x0
|
||||
field public static final int DNS_SUCCESS = 1; // 0x1
|
||||
field public static final int PROBE_DNS = 0; // 0x0
|
||||
field public static final int PROBE_HTTP = 1; // 0x1
|
||||
field public static final int PROBE_HTTPS = 2; // 0x2
|
||||
field public static final int PROBE_PAC = 3; // 0x3
|
||||
field public final long durationMs;
|
||||
field public final int netId;
|
||||
field public final int probeType;
|
||||
field public final int returnCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.nsd {
|
||||
|
||||
public final class NsdManager {
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
/** {@hide} */
|
||||
parcelable ConnectivityMetricsEvent;
|
||||
parcelable ConnectivityMetricsEvent.Reference;
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/** {@hide} */
|
||||
@SystemApi
|
||||
public final class ConnectivityMetricsEvent implements Parcelable {
|
||||
|
||||
/** The time when this event was collected, as returned by System.currentTimeMillis(). */
|
||||
@@ -67,7 +65,6 @@ public final class ConnectivityMetricsEvent implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(timestamp);
|
||||
@@ -80,51 +77,4 @@ public final class ConnectivityMetricsEvent implements Parcelable {
|
||||
return String.format("ConnectivityMetricsEvent(%tT.%tL, %d, %d): %s",
|
||||
timestamp, timestamp, componentTag, eventTag, data);
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
@SystemApi
|
||||
public final static class Reference implements Parcelable {
|
||||
|
||||
private long mValue;
|
||||
|
||||
public Reference(long ref) {
|
||||
this.mValue = ref;
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
public static final Parcelable.Creator<Reference> CREATOR
|
||||
= new Parcelable.Creator<Reference> (){
|
||||
public Reference createFromParcel(Parcel source) {
|
||||
return new Reference(source.readLong());
|
||||
}
|
||||
|
||||
public Reference[] newArray(int size) {
|
||||
return new Reference[size];
|
||||
}
|
||||
};
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(mValue);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
mValue = in.readLong();
|
||||
}
|
||||
|
||||
public long getValue() {
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public void setValue(long val) {
|
||||
mValue = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.net;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
/** {@hide} */
|
||||
@SystemApi
|
||||
public class ConnectivityMetricsLogger {
|
||||
private static String TAG = "ConnectivityMetricsLogger";
|
||||
private static final boolean DBG = true;
|
||||
|
||||
public static final String CONNECTIVITY_METRICS_LOGGER_SERVICE = "connectivity_metrics_logger";
|
||||
|
||||
// Component Tags
|
||||
public static final int COMPONENT_TAG_CONNECTIVITY = 0;
|
||||
public static final int COMPONENT_TAG_BLUETOOTH = 1;
|
||||
public static final int COMPONENT_TAG_WIFI = 2;
|
||||
public static final int COMPONENT_TAG_TELECOM = 3;
|
||||
public static final int COMPONENT_TAG_TELEPHONY = 4;
|
||||
public static final int NUMBER_OF_COMPONENTS = 5;
|
||||
|
||||
// Event Tag
|
||||
public static final int TAG_SKIPPED_EVENTS = -1;
|
||||
|
||||
public static final String DATA_KEY_EVENTS_COUNT = "count";
|
||||
|
||||
public ConnectivityMetricsLogger() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a ConnectivityMetricsEvent.
|
||||
*
|
||||
* This method keeps track of skipped events when MetricsLoggerService throttles input events.
|
||||
* It skips logging when MetricsLoggerService is active. When throttling ends, it logs a
|
||||
* meta-event containing the number of events dropped. It is not safe to call this method
|
||||
* concurrently from different threads.
|
||||
*
|
||||
* @param timestamp is the epoch timestamp of the event in ms.
|
||||
* @param componentTag is the COMPONENT_* constant the event belongs to.
|
||||
* @param eventTag is an event type constant whose meaning is specific to the component tag.
|
||||
* @param data is a Parcelable instance representing the event.
|
||||
*/
|
||||
public void logEvent(long timestamp, int componentTag, int eventTag, Parcelable data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve events
|
||||
*
|
||||
* @param reference of the last event previously returned. The function will return
|
||||
* events following it.
|
||||
* If 0 then all events will be returned.
|
||||
* After the function call it will contain reference of the
|
||||
* last returned event.
|
||||
* @return events
|
||||
*/
|
||||
public ConnectivityMetricsEvent[] getEvents(ConnectivityMetricsEvent.Reference reference) {
|
||||
return new ConnectivityMetricsEvent[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register PendingIntent which will be sent when new events are ready to be retrieved.
|
||||
*/
|
||||
public boolean register(PendingIntent newEventsIntent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean unregister(PendingIntent newEventsIntent) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.net.ConnectivityMetricsEvent;
|
||||
|
||||
/** {@hide} */
|
||||
interface IConnectivityMetricsLogger {
|
||||
|
||||
/**
|
||||
* @return 0 on success
|
||||
* <0 if error happened
|
||||
* >0 timestamp after which new events will be accepted
|
||||
*/
|
||||
long logEvent(in ConnectivityMetricsEvent event);
|
||||
long logEvents(in ConnectivityMetricsEvent[] events);
|
||||
|
||||
/**
|
||||
* @param reference of the last event previously returned. The function will return
|
||||
* events following it.
|
||||
* If 0 then all events will be returned.
|
||||
* After the function call it will contain reference of the last event.
|
||||
*/
|
||||
ConnectivityMetricsEvent[] getEvents(inout ConnectivityMetricsEvent.Reference reference);
|
||||
|
||||
boolean register(in PendingIntent newEventsIntent);
|
||||
void unregister(in PendingIntent newEventsIntent);
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
@@ -36,7 +35,6 @@ import java.util.List;
|
||||
* the APF program in place with a new APF program.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class ApfProgramEvent implements Parcelable {
|
||||
|
||||
// Bitflag constants describing what an Apf program filters.
|
||||
@@ -55,7 +53,6 @@ public final class ApfProgramEvent implements Parcelable {
|
||||
public final int programLength; // Length of the APF program in bytes
|
||||
public final int flags; // Bitfield compound of FLAG_* constants
|
||||
|
||||
/** {@hide} */
|
||||
public ApfProgramEvent(
|
||||
long lifetime, int filteredRas, int currentRas, int programLength, @Flags int flags) {
|
||||
this.lifetime = lifetime;
|
||||
@@ -105,7 +102,6 @@ public final class ApfProgramEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
/** {@hide} */
|
||||
public static @Flags int flagsFor(boolean hasIPv4, boolean multicastFilterOn) {
|
||||
int bitfield = 0;
|
||||
if (hasIPv4) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -24,7 +23,6 @@ import android.os.Parcelable;
|
||||
* An event logged for an interface with APF capabilities when its IpManager state machine exits.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class ApfStats implements Parcelable {
|
||||
|
||||
public final long durationMs; // time interval in milliseconds these stastistics covers
|
||||
@@ -36,7 +34,6 @@ public final class ApfStats implements Parcelable {
|
||||
public final int programUpdates; // number of APF program updates
|
||||
public final int maxProgramSize; // maximum APF program size advertised by hardware
|
||||
|
||||
/** {@hide} */
|
||||
public ApfStats(long durationMs, int receivedRas, int matchingRas, int droppedRas,
|
||||
int zeroLifetimeRas, int parseErrors, int programUpdates, int maxProgramSize) {
|
||||
this.durationMs = durationMs;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -25,7 +24,6 @@ import android.os.Parcelable;
|
||||
* An event recorded by ConnectivityService when there is a change in the default network.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class DefaultNetworkEvent implements Parcelable {
|
||||
// The ID of the network that has become the new default or NETID_UNSET if none.
|
||||
public final int netId;
|
||||
@@ -38,7 +36,6 @@ public final class DefaultNetworkEvent implements Parcelable {
|
||||
public final boolean prevIPv4;
|
||||
public final boolean prevIPv6;
|
||||
|
||||
/** {@hide} */
|
||||
public DefaultNetworkEvent(int netId, int[] transportTypes,
|
||||
int prevNetId, boolean prevIPv4, boolean prevIPv6) {
|
||||
this.netId = netId;
|
||||
@@ -106,8 +103,4 @@ public final class DefaultNetworkEvent implements Parcelable {
|
||||
return new DefaultNetworkEvent[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static void logEvent(
|
||||
int netId, int[] transports, int prevNetId, boolean hadIPv4, boolean hadIPv6) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -24,7 +23,6 @@ import android.os.Parcelable;
|
||||
* An event recorded when a DhcpClient state machine transitions to a new state.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class DhcpClientEvent implements Parcelable {
|
||||
|
||||
// Names for recording DhcpClient pseudo-state transitions.
|
||||
@@ -37,7 +35,6 @@ public final class DhcpClientEvent implements Parcelable {
|
||||
public final String msg;
|
||||
public final int durationMs;
|
||||
|
||||
/** {@hide} */
|
||||
public DhcpClientEvent(String ifName, String msg, int durationMs) {
|
||||
this.ifName = ifName;
|
||||
this.msg = msg;
|
||||
@@ -77,7 +74,4 @@ public final class DhcpClientEvent implements Parcelable {
|
||||
return new DhcpClientEvent[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static void logStateEvent(String ifName, String state) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
@@ -27,7 +26,6 @@ import com.android.internal.util.MessageUtils;
|
||||
* Event class used to record error events when parsing DHCP response packets.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class DhcpErrorEvent implements Parcelable {
|
||||
public static final int L2_ERROR = 1;
|
||||
public static final int L3_ERROR = 2;
|
||||
@@ -50,12 +48,10 @@ public final class DhcpErrorEvent implements Parcelable {
|
||||
public static final int DHCP_INVALID_OPTION_LENGTH = makeErrorCode(DHCP_ERROR, 3);
|
||||
public static final int DHCP_NO_MSG_TYPE = makeErrorCode(DHCP_ERROR, 4);
|
||||
public static final int DHCP_UNKNOWN_MSG_TYPE = makeErrorCode(DHCP_ERROR, 5);
|
||||
/** {@hide} */
|
||||
public static final int DHCP_NO_COOKIE = makeErrorCode(DHCP_ERROR, 6);
|
||||
|
||||
public static final int BUFFER_UNDERFLOW = makeErrorCode(MISC_ERROR, 1);
|
||||
public static final int RECEIVE_ERROR = makeErrorCode(MISC_ERROR, 2);
|
||||
/** {@hide} */
|
||||
public static final int PARSING_ERROR = makeErrorCode(MISC_ERROR, 3);
|
||||
|
||||
public final String ifName;
|
||||
@@ -66,7 +62,6 @@ public final class DhcpErrorEvent implements Parcelable {
|
||||
// byte 3: optional code
|
||||
public final int errorCode;
|
||||
|
||||
/** {@hide} */
|
||||
public DhcpErrorEvent(String ifName, int errorCode) {
|
||||
this.ifName = ifName;
|
||||
this.errorCode = errorCode;
|
||||
@@ -99,12 +94,6 @@ public final class DhcpErrorEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
public static void logParseError(String ifName, int errorCode) {
|
||||
}
|
||||
|
||||
public static void logReceiveError(String ifName) {
|
||||
}
|
||||
|
||||
public static int errorCodeWithOption(int errorCode, int option) {
|
||||
return (0xFFFF0000 & errorCode) | (0xFF & option);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -24,7 +23,6 @@ import android.os.Parcelable;
|
||||
* A DNS event recorded by NetdEventListenerService.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
final public class DnsEvent implements Parcelable {
|
||||
public final int netId;
|
||||
|
||||
@@ -38,7 +36,6 @@ final public class DnsEvent implements Parcelable {
|
||||
// queries.
|
||||
public final int[] latenciesMs;
|
||||
|
||||
/** {@hide} */
|
||||
public DnsEvent(int netId, byte[] eventTypes, byte[] returnCodes, int[] latenciesMs) {
|
||||
this.netId = netId;
|
||||
this.eventTypes = eventTypes;
|
||||
@@ -82,8 +79,4 @@ final public class DnsEvent implements Parcelable {
|
||||
return new DnsEvent[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static void logEvent(
|
||||
int netId, byte[] eventTypes, byte[] returnCodes, int[] latenciesMs) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
@@ -32,17 +31,15 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* when a network disconnects.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class IpManagerEvent implements Parcelable {
|
||||
|
||||
public static final int PROVISIONING_OK = 1;
|
||||
public static final int PROVISIONING_FAIL = 2;
|
||||
public static final int COMPLETE_LIFECYCLE = 3;
|
||||
/** @hide */ public static final int ERROR_STARTING_IPV4 = 4;
|
||||
/** @hide */ public static final int ERROR_STARTING_IPV6 = 5;
|
||||
/** @hide */ public static final int ERROR_STARTING_IPREACHABILITYMONITOR = 6;
|
||||
public static final int PROVISIONING_OK = 1;
|
||||
public static final int PROVISIONING_FAIL = 2;
|
||||
public static final int COMPLETE_LIFECYCLE = 3;
|
||||
public static final int ERROR_STARTING_IPV4 = 4;
|
||||
public static final int ERROR_STARTING_IPV6 = 5;
|
||||
public static final int ERROR_STARTING_IPREACHABILITYMONITOR = 6;
|
||||
|
||||
/** {@hide} */
|
||||
@IntDef(value = {
|
||||
PROVISIONING_OK, PROVISIONING_FAIL, COMPLETE_LIFECYCLE,
|
||||
ERROR_STARTING_IPV4, ERROR_STARTING_IPV6, ERROR_STARTING_IPREACHABILITYMONITOR,
|
||||
@@ -54,7 +51,6 @@ public final class IpManagerEvent implements Parcelable {
|
||||
public final @EventType int eventType;
|
||||
public final long durationMs;
|
||||
|
||||
/** {@hide} */
|
||||
public IpManagerEvent(String ifName, @EventType int eventType, long duration) {
|
||||
this.ifName = ifName;
|
||||
this.eventType = eventType;
|
||||
@@ -90,9 +86,6 @@ public final class IpManagerEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
public static void logEvent(int eventType, String ifName, long durationMs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("IpManagerEvent(%s, %s, %dms)",
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
@@ -28,7 +27,6 @@ import com.android.internal.util.MessageUtils;
|
||||
* a neighbor probe result.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class IpReachabilityEvent implements Parcelable {
|
||||
|
||||
// Event types.
|
||||
@@ -38,9 +36,9 @@ public final class IpReachabilityEvent implements Parcelable {
|
||||
public static final int NUD_FAILED = 2 << 8;
|
||||
/** Neighbor unreachable after a forced probe, IP provisioning is also lost. */
|
||||
public static final int PROVISIONING_LOST = 3 << 8;
|
||||
/** {@hide} Neighbor unreachable notification from kernel. */
|
||||
/** Neighbor unreachable notification from kernel. */
|
||||
public static final int NUD_FAILED_ORGANIC = 4 << 8;
|
||||
/** {@hide} Neighbor unreachable notification from kernel, IP provisioning is also lost. */
|
||||
/** Neighbor unreachable notification from kernel, IP provisioning is also lost. */
|
||||
public static final int PROVISIONING_LOST_ORGANIC = 5 << 8;
|
||||
|
||||
public final String ifName;
|
||||
@@ -51,7 +49,6 @@ public final class IpReachabilityEvent implements Parcelable {
|
||||
// byte 3: when byte 2 == PROBE, errno code from RTNetlink or IpReachabilityMonitor.
|
||||
public final int eventType;
|
||||
|
||||
/** {@hide} */
|
||||
public IpReachabilityEvent(String ifName, int eventType) {
|
||||
this.ifName = ifName;
|
||||
this.eventType = eventType;
|
||||
@@ -84,18 +81,8 @@ public final class IpReachabilityEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
public static void logProbeEvent(String ifName, int nlErrorCode) {
|
||||
}
|
||||
|
||||
public static void logNudFailed(String ifName) {
|
||||
}
|
||||
|
||||
public static void logProvisioningLost(String ifName) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the NUD failure event type code corresponding to the given conditions.
|
||||
* {@hide}
|
||||
*/
|
||||
public static int nudFailureEventType(boolean isFromProbe, boolean isProvisioningLost) {
|
||||
if (isFromProbe) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
@@ -30,7 +29,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class NetworkEvent implements Parcelable {
|
||||
|
||||
public static final int NETWORK_CONNECTED = 1;
|
||||
@@ -41,16 +39,11 @@ public final class NetworkEvent implements Parcelable {
|
||||
public static final int NETWORK_UNLINGER = 6;
|
||||
public static final int NETWORK_DISCONNECTED = 7;
|
||||
|
||||
/** {@hide} */
|
||||
public static final int NETWORK_FIRST_VALIDATION_SUCCESS = 8;
|
||||
/** {@hide} */
|
||||
public static final int NETWORK_REVALIDATION_SUCCESS = 9;
|
||||
/** {@hide} */
|
||||
public static final int NETWORK_FIRST_VALIDATION_PORTAL_FOUND = 10;
|
||||
/** {@hide} */
|
||||
public static final int NETWORK_REVALIDATION_PORTAL_FOUND = 11;
|
||||
|
||||
/** {@hide} */
|
||||
@IntDef(value = {
|
||||
NETWORK_CONNECTED,
|
||||
NETWORK_VALIDATED,
|
||||
@@ -71,14 +64,12 @@ public final class NetworkEvent implements Parcelable {
|
||||
public final @EventType int eventType;
|
||||
public final long durationMs;
|
||||
|
||||
/** {@hide} */
|
||||
public NetworkEvent(int netId, @EventType int eventType, long durationMs) {
|
||||
this.netId = netId;
|
||||
this.eventType = eventType;
|
||||
this.durationMs = durationMs;
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public NetworkEvent(int netId, @EventType int eventType) {
|
||||
this(netId, eventType, 0);
|
||||
}
|
||||
@@ -112,15 +103,6 @@ public final class NetworkEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
public static void logEvent(int netId, int eventType) {
|
||||
}
|
||||
|
||||
public static void logValidated(int netId, long durationMs) {
|
||||
}
|
||||
|
||||
public static void logCaptivePortalFound(int netId, long durationMs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("NetworkEvent(%d, %s, %dms)",
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -24,10 +23,8 @@ import android.os.Parcelable;
|
||||
* An event logged when the APF packet socket receives an RA packet.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class RaEvent implements Parcelable {
|
||||
|
||||
/** {@hide} */
|
||||
public static final long NO_LIFETIME = -1L;
|
||||
|
||||
// Lifetime in seconds of options found in a single RA packet.
|
||||
@@ -39,7 +36,6 @@ public final class RaEvent implements Parcelable {
|
||||
public final long rdnssLifetime;
|
||||
public final long dnsslLifetime;
|
||||
|
||||
/** {@hide} */
|
||||
public RaEvent(long routerLifetime, long prefixValidLifetime, long prefixPreferredLifetime,
|
||||
long routeInfoLifetime, long rdnssLifetime, long dnsslLifetime) {
|
||||
this.routerLifetime = routerLifetime;
|
||||
@@ -96,7 +92,6 @@ public final class RaEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
/** {@hide} */
|
||||
public static class Builder {
|
||||
|
||||
long routerLifetime = NO_LIFETIME;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
@@ -31,14 +30,12 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* An event recorded by NetworkMonitor when sending a probe for finding captive portals.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
public final class ValidationProbeEvent implements Parcelable {
|
||||
|
||||
public static final int PROBE_DNS = 0;
|
||||
public static final int PROBE_HTTP = 1;
|
||||
public static final int PROBE_HTTPS = 2;
|
||||
public static final int PROBE_PAC = 3;
|
||||
/** {@hide} */
|
||||
public static final int PROBE_FALLBACK = 4;
|
||||
|
||||
public static final int DNS_FAILURE = 0;
|
||||
@@ -47,7 +44,6 @@ public final class ValidationProbeEvent implements Parcelable {
|
||||
private static final int FIRST_VALIDATION = 1 << 8;
|
||||
private static final int REVALIDATION = 2 << 8;
|
||||
|
||||
/** {@hide} */
|
||||
@IntDef(value = {DNS_FAILURE, DNS_SUCCESS})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ReturnCode {}
|
||||
@@ -62,7 +58,6 @@ public final class ValidationProbeEvent implements Parcelable {
|
||||
public final int probeType;
|
||||
public final @ReturnCode int returnCode;
|
||||
|
||||
/** {@hide} */
|
||||
public ValidationProbeEvent(
|
||||
int netId, long durationMs, int probeType, @ReturnCode int returnCode) {
|
||||
this.netId = netId;
|
||||
@@ -102,24 +97,18 @@ public final class ValidationProbeEvent implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
/** @hide */
|
||||
public static int makeProbeType(int probeType, boolean firstValidation) {
|
||||
return (probeType & 0xff) | (firstValidation ? FIRST_VALIDATION : REVALIDATION);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static String getProbeName(int probeType) {
|
||||
return Decoder.constants.get(probeType & 0xff, "PROBE_???");
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static String getValidationStage(int probeType) {
|
||||
return Decoder.constants.get(probeType & 0xff00, "UNKNOWN");
|
||||
}
|
||||
|
||||
public static void logEvent(int netId, long durationMs, int probeType, int returnCode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("ValidationProbeEvent(%d, %s:%d %s, %dms)", netId,
|
||||
|
||||
@@ -17,101 +17,59 @@
|
||||
package com.android.server.connectivity;
|
||||
|
||||
import android.net.ConnectivityMetricsEvent;
|
||||
import android.net.ConnectivityMetricsLogger;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
abstract public class MetricsTestUtil {
|
||||
private MetricsTestUtil() {
|
||||
}
|
||||
|
||||
static ConnectivityMetricsEvent ipEv(Parcelable p) {
|
||||
return ev(ConnectivityMetricsLogger.COMPONENT_TAG_CONNECTIVITY, p);
|
||||
static ConnectivityMetricsEvent ev(Parcelable p) {
|
||||
return new ConnectivityMetricsEvent(1L, 0, 0, p);
|
||||
}
|
||||
|
||||
static ConnectivityMetricsEvent telephonyEv() {
|
||||
return ev(ConnectivityMetricsLogger.COMPONENT_TAG_TELEPHONY, new Bundle());
|
||||
}
|
||||
|
||||
static ConnectivityMetricsEvent ev(int tag, Parcelable p) {
|
||||
return new ConnectivityMetricsEvent(1L, tag, 0, p);
|
||||
}
|
||||
|
||||
// Utiliy interface for describing the content of a Parcel. This relies on
|
||||
// the implementation defails of Parcelable and on the fact that the fully
|
||||
// qualified Parcelable class names are written as string in the Parcels.
|
||||
interface ParcelField {
|
||||
void write(Parcel p);
|
||||
}
|
||||
|
||||
static ConnectivityMetricsEvent describeIpEvent(ParcelField... fs) {
|
||||
static ConnectivityMetricsEvent describeIpEvent(Consumer<Parcel>... fs) {
|
||||
Parcel p = Parcel.obtain();
|
||||
for (ParcelField f : fs) {
|
||||
f.write(p);
|
||||
for (Consumer<Parcel> f : fs) {
|
||||
f.accept(p);
|
||||
}
|
||||
p.setDataPosition(0);
|
||||
return ipEv(p.readParcelable(ClassLoader.getSystemClassLoader()));
|
||||
return ev(p.readParcelable(ClassLoader.getSystemClassLoader()));
|
||||
}
|
||||
|
||||
static ParcelField aType(Class<?> c) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeString(c.getName());
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> aType(Class<?> c) {
|
||||
return aString(c.getName());
|
||||
}
|
||||
|
||||
static ParcelField aBool(boolean b) {
|
||||
static Consumer<Parcel> aBool(boolean b) {
|
||||
return aByte((byte) (b ? 1 : 0));
|
||||
}
|
||||
|
||||
static ParcelField aByte(byte b) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeByte(b);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> aByte(byte b) {
|
||||
return (p) -> p.writeByte(b);
|
||||
}
|
||||
|
||||
static ParcelField anInt(int i) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeInt(i);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> anInt(int i) {
|
||||
return (p) -> p.writeInt(i);
|
||||
}
|
||||
|
||||
static ParcelField aLong(long l) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeLong(l);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> aLong(long l) {
|
||||
return (p) -> p.writeLong(l);
|
||||
}
|
||||
|
||||
static ParcelField aString(String s) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeString(s);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> aString(String s) {
|
||||
return (p) -> p.writeString(s);
|
||||
}
|
||||
|
||||
static ParcelField aByteArray(byte... ary) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeByteArray(ary);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> aByteArray(byte... ary) {
|
||||
return (p) -> p.writeByteArray(ary);
|
||||
}
|
||||
|
||||
static ParcelField anIntArray(int... ary) {
|
||||
return new ParcelField() {
|
||||
public void write(Parcel p) {
|
||||
p.writeIntArray(ary);
|
||||
}
|
||||
};
|
||||
static Consumer<Parcel> anIntArray(int... ary) {
|
||||
return (p) -> p.writeIntArray(ary);
|
||||
}
|
||||
|
||||
static byte b(int i) {
|
||||
|
||||
Reference in New Issue
Block a user