Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5db17efc authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'net-update-mr2-dev-plus-aosp' into nyc-mr2-dev-plus-aosp

* changes:
  DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports
  DO NOT MERGE: Add missing dependency.
  DO NOT MERGE: Show notification for always-on app VPN
  DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
  DO NOT MERGE: ConnectivityServiceTest: fix testAvoidBadWifiSettings
  DO NOT MERGE: Fix ConnectivityServiceTest testRequestBenchmark
  DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
  DO NOT MERGE: Define API for metering network stats buckets.
  DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
  DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
  DO NOT MERGE: ConnectivityThread: use lazy holder idiom
  DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
  DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
  DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
  DO NOT MERGE: [CS] Remove timeout event after first available
  DO NOT MERGE: ApfTest: tag tests with @SmallTest or @MediumTest
  DO NOT MERGE: Unbreak TetherInterfaceStateMachineTest.
  DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net.
  DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils.
  DO NOT MERGE: Move FakeSettingsProvider to a common location.
  DO NOT MERGE: ConnectivityServiceTest: mark flaky test as such
  DO NOT MERGE: Add fuzzing tests to ApfFilter RA processing
  DO NOT MERGE: Support timeouts for requestNetwork() invocations.
  DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is specified for a given network.
parents fc9c93c2 7a613617
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ LOCAL_SRC_FILES += \
       core/java/android/app/admin/SecurityLogTags.logtags \
       core/java/android/content/EventLogTags.logtags \
       core/java/android/speech/tts/EventLogTags.logtags \
       core/java/android/net/EventLogTags.logtags \
       core/java/android/webkit/EventLogTags.logtags \
       core/java/com/android/internal/logging/EventLogTags.logtags \

+4 −0
Original line number Diff line number Diff line
@@ -6447,6 +6447,7 @@ package android.app.usage {
  public static class NetworkStats.Bucket {
    ctor public NetworkStats.Bucket();
    method public long getEndTimeStamp();
    method public int getMetered();
    method public int getRoaming();
    method public long getRxBytes();
    method public long getRxPackets();
@@ -6456,6 +6457,9 @@ package android.app.usage {
    method public long getTxBytes();
    method public long getTxPackets();
    method public int getUid();
    field public static final int METERED_ALL = -1; // 0xffffffff
    field public static final int METERED_NO = 1; // 0x1
    field public static final int METERED_YES = 2; // 0x2
    field public static final int ROAMING_ALL = -1; // 0xffffffff
    field public static final int ROAMING_NO = 1; // 0x1
    field public static final int ROAMING_YES = 2; // 0x2
+4 −0
Original line number Diff line number Diff line
@@ -6741,6 +6741,7 @@ package android.app.usage {
  public static class NetworkStats.Bucket {
    ctor public NetworkStats.Bucket();
    method public long getEndTimeStamp();
    method public int getMetered();
    method public int getRoaming();
    method public long getRxBytes();
    method public long getRxPackets();
@@ -6750,6 +6751,9 @@ package android.app.usage {
    method public long getTxBytes();
    method public long getTxPackets();
    method public int getUid();
    field public static final int METERED_ALL = -1; // 0xffffffff
    field public static final int METERED_NO = 1; // 0x1
    field public static final int METERED_YES = 2; // 0x2
    field public static final int ROAMING_ALL = -1; // 0xffffffff
    field public static final int ROAMING_NO = 1; // 0x1
    field public static final int ROAMING_YES = 2; // 0x2
+4 −0
Original line number Diff line number Diff line
@@ -6456,6 +6456,7 @@ package android.app.usage {
  public static class NetworkStats.Bucket {
    ctor public NetworkStats.Bucket();
    method public long getEndTimeStamp();
    method public int getMetered();
    method public int getRoaming();
    method public long getRxBytes();
    method public long getRxPackets();
@@ -6465,6 +6466,9 @@ package android.app.usage {
    method public long getTxBytes();
    method public long getTxPackets();
    method public int getUid();
    field public static final int METERED_ALL = -1; // 0xffffffff
    field public static final int METERED_NO = 1; // 0x1
    field public static final int METERED_YES = 2; // 0x2
    field public static final int ROAMING_ALL = -1; // 0xffffffff
    field public static final int ROAMING_NO = 1; // 0x1
    field public static final int ROAMING_YES = 2; // 0x2
+50 −0
Original line number Diff line number Diff line
@@ -163,6 +163,29 @@ public final class NetworkStats implements AutoCloseable {
         */
        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 */
        @IntDef({ROAMING_ALL, ROAMING_NO, ROAMING_YES})
        @Retention(RetentionPolicy.SOURCE)
@@ -200,6 +223,7 @@ public final class NetworkStats implements AutoCloseable {
        private int mUid;
        private int mTag;
        private int mState;
        private int mMetered;
        private int mRoaming;
        private long mBeginTimeStamp;
        private long mEndTimeStamp;
@@ -232,6 +256,15 @@ public final class NetworkStats implements AutoCloseable {
            return tag;
        }

        private static @Metered int convertMetered(int metered) {
            switch (metered) {
                case android.net.NetworkStats.METERED_ALL : return METERED_ALL;
                case android.net.NetworkStats.METERED_NO: return METERED_NO;
                case android.net.NetworkStats.METERED_YES: return METERED_YES;
            }
            return 0;
        }

        private static @Roaming int convertRoaming(int roaming) {
            switch (roaming) {
                case android.net.NetworkStats.ROAMING_ALL : return ROAMING_ALL;
@@ -278,6 +311,21 @@ public final class NetworkStats implements AutoCloseable {
            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/>
         * <ul>
@@ -491,6 +539,7 @@ public final class NetworkStats implements AutoCloseable {
        bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid);
        bucketOut.mTag = Bucket.convertTag(mRecycledSummaryEntry.tag);
        bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set);
        bucketOut.mMetered = Bucket.convertMetered(mRecycledSummaryEntry.metered);
        bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming);
        bucketOut.mBeginTimeStamp = mStartTimeStamp;
        bucketOut.mEndTimeStamp = mEndTimeStamp;
@@ -539,6 +588,7 @@ public final class NetworkStats implements AutoCloseable {
                bucketOut.mUid = Bucket.convertUid(getUid());
                bucketOut.mTag = Bucket.convertTag(mTag);
                bucketOut.mState = Bucket.STATE_ALL;
                bucketOut.mMetered = Bucket.METERED_ALL;
                bucketOut.mRoaming = Bucket.ROAMING_ALL;
                bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
                bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart +
Loading