Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp

* commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1': (35 commits)
  NetworkMonitor: send one DNS probe per web probe
  NetworkMonitor metrics: add first validation information
  APF: also drop any ICMPv6 RSs
  ConnectivityServiceTest: fix testAvoidBadWifiSettings
  Fix ConnectivityServiceTest testRequestBenchmark
  Switch over to new "time.android.com" NTP pool.
  Define API for metering network stats buckets.
  Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  Use @Ignore to explicitly disable a @Test method.
  Fixed NetworkStatsServiceTest and converted it to JUnit4.
  VPN network stat accounting changes.
  ConnectivityThread: use lazy holder idiom
  ConnectivityManager: use ConnectivityThread looper
  ConnectivityManager: a simpler CallbackHandler
  Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  Add a null check for the OnStartTetheringCallback.
  TokenBucket for rate-limiting and throttling
  IpConnectivityMetrics reads buffer size in settings
  CaptivePortalLogin: set mixed content policy to compatibility.
  Add IP conn metrics to dumpsys and bug reports
  ...
This commit is contained in:
The Android Automerger
2017-01-27 06:39:05 +00:00
3 changed files with 49 additions and 6 deletions

View File

@@ -163,6 +163,29 @@ public final class NetworkStats implements AutoCloseable {
*/ */
public static final int UID_TETHERING = TrafficStats.UID_TETHERING; public static final int UID_TETHERING = TrafficStats.UID_TETHERING;
/** @hide */
@IntDef({METERED_ALL, METERED_NO, METERED_YES})
@Retention(RetentionPolicy.SOURCE)
public @interface Metered {}
/**
* Combined usage across all metered states. Covers metered and unmetered usage.
*/
public static final int METERED_ALL = -1;
/**
* Usage that occurs on an unmetered network.
*/
public static final int METERED_NO = 0x1;
/**
* Usage that occurs on a metered network.
*
* <p>A network is classified as metered when the user is sensitive to heavy data usage on
* that connection.
*/
public static final int METERED_YES = 0x2;
/** @hide */ /** @hide */
@IntDef({ROAMING_ALL, ROAMING_NO, ROAMING_YES}) @IntDef({ROAMING_ALL, ROAMING_NO, ROAMING_YES})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@@ -200,6 +223,7 @@ public final class NetworkStats implements AutoCloseable {
private int mUid; private int mUid;
private int mTag; private int mTag;
private int mState; private int mState;
private int mMetered;
private int mRoaming; private int mRoaming;
private long mBeginTimeStamp; private long mBeginTimeStamp;
private long mEndTimeStamp; private long mEndTimeStamp;
@@ -278,6 +302,21 @@ public final class NetworkStats implements AutoCloseable {
return mState; return mState;
} }
/**
* Metered state. One of the following values:<p/>
* <ul>
* <li>{@link #METERED_ALL}</li>
* <li>{@link #METERED_NO}</li>
* <li>{@link #METERED_YES}</li>
* </ul>
* <p>A network is classified as metered when the user is sensitive to heavy data usage on
* that connection. Apps may warn before using these networks for large downloads. The
* metered state can be set by the user within data usage network restrictions.
*/
public @Metered int getMetered() {
return mMetered;
}
/** /**
* Roaming state. One of the following values:<p/> * Roaming state. One of the following values:<p/>
* <ul> * <ul>
@@ -491,6 +530,8 @@ public final class NetworkStats implements AutoCloseable {
bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid); bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid);
bucketOut.mTag = Bucket.convertTag(mRecycledSummaryEntry.tag); bucketOut.mTag = Bucket.convertTag(mRecycledSummaryEntry.tag);
bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set); bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set);
// TODO: Implement metered tracking.
bucketOut.mMetered = Bucket.METERED_ALL;
bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming); bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming);
bucketOut.mBeginTimeStamp = mStartTimeStamp; bucketOut.mBeginTimeStamp = mStartTimeStamp;
bucketOut.mEndTimeStamp = mEndTimeStamp; bucketOut.mEndTimeStamp = mEndTimeStamp;
@@ -539,6 +580,7 @@ public final class NetworkStats implements AutoCloseable {
bucketOut.mUid = Bucket.convertUid(getUid()); bucketOut.mUid = Bucket.convertUid(getUid());
bucketOut.mTag = Bucket.convertTag(mTag); bucketOut.mTag = Bucket.convertTag(mTag);
bucketOut.mState = Bucket.STATE_ALL; bucketOut.mState = Bucket.STATE_ALL;
bucketOut.mMetered = Bucket.METERED_ALL;
bucketOut.mRoaming = Bucket.ROAMING_ALL; bucketOut.mRoaming = Bucket.ROAMING_ALL;
bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart; bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart + bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart +

View File

@@ -103,11 +103,11 @@ import com.android.internal.util.Protocol;
* to {@link DiscoveryListener#onServiceFound} and a service lost is notified on * to {@link DiscoveryListener#onServiceFound} and a service lost is notified on
* {@link DiscoveryListener#onServiceLost}. * {@link DiscoveryListener#onServiceLost}.
* *
* <p> Once the peer application discovers the "Example" http srevice, and needs to receive data * <p> Once the peer application discovers the "Example" http service, and either needs to read the
* from the "Example" application, it can initiate a resolve with {@link #resolveService} to * attributes of the service or wants to receive data from the "Example" application, it can
* resolve the host and port details for the purpose of establishing a connection. A successful * initiate a resolve with {@link #resolveService} to resolve the attributes, host, and port
* resolve is notified on {@link ResolveListener#onServiceResolved} and a failure is notified * details. A successful resolve is notified on {@link ResolveListener#onServiceResolved} and a
* on {@link ResolveListener#onResolveFailed}. * failure is notified on {@link ResolveListener#onResolveFailed}.
* *
* Applications can reserve for a service type at * Applications can reserve for a service type at
* http://www.iana.org/form/ports-service. Existing services can be found at * http://www.iana.org/form/ports-service. Existing services can be found at

View File

@@ -250,7 +250,8 @@ public final class NsdServiceInfo implements Parcelable {
} }
/** /**
* Retrive attributes as a map of String keys to byte[] values. * Retrieve attributes as a map of String keys to byte[] values. The attributes map is only
* valid for a resolved service.
* *
* <p> The returned map is unmodifiable; changes must be made through {@link #setAttribute} and * <p> The returned map is unmodifiable; changes must be made through {@link #setAttribute} and
* {@link #removeAttribute}. * {@link #removeAttribute}.