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

Commit 27895365 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ie79ce57c,I003dd7c9,Ibb0f4504

* changes:
  Assume virtual devices always have USB connection.
  Allocate well-known tag for app store updates.
  Add @TestApi for StrictMode tests.
parents e33412d2 9d640958
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28100,6 +28100,7 @@ package android.net {
    method public static void incrementOperationCount(int, int);
    method public static void setThreadStatsTag(int);
    method public static void setThreadStatsTagBackup();
    method public static void setThreadStatsTagCode();
    method public static void setThreadStatsTagRestore();
    method public static void setThreadStatsUid(int);
    method public static void tagDatagramSocket(java.net.DatagramSocket) throws java.net.SocketException;
+5 −0
Original line number Diff line number Diff line
@@ -31608,6 +31608,7 @@ package android.os {
    method public static android.os.StrictMode.VmPolicy getVmPolicy();
    method public static void noteSlowCall(java.lang.String);
    method public static void setThreadPolicy(android.os.StrictMode.ThreadPolicy);
    method public static void setViolationListener(android.os.StrictMode.ViolationListener);
    method public static void setVmPolicy(android.os.StrictMode.VmPolicy);
  }
@@ -31641,6 +31642,10 @@ package android.os {
    method public android.os.StrictMode.ThreadPolicy.Builder permitUnbufferedIo();
  }
  public static abstract interface StrictMode.ViolationListener {
    method public abstract void onViolation(java.lang.String);
  }
  public static final class StrictMode.VmPolicy {
    field public static final android.os.StrictMode.VmPolicy LAX;
  }
+27 −13
Original line number Diff line number Diff line
@@ -109,25 +109,26 @@ public class TrafficStats {
     */
    public static final int TAG_SYSTEM_RESTORE = 0xFFFFFF04;

    /**
     * Default tag value for code or resources downloaded by an app store on
     * behalf of the app, such as app updates.
     *
     * @hide
     */
    public static final int TAG_SYSTEM_CODE = 0xFFFFFF05;

    /** @hide */
    public static final int TAG_SYSTEM_DHCP = 0xFFFFFF05;
    public static final int TAG_SYSTEM_DHCP = 0xFFFFFF40;
    /** @hide */
    public static final int TAG_SYSTEM_NTP = 0xFFFFFF06;
    public static final int TAG_SYSTEM_NTP = 0xFFFFFF41;
    /** @hide */
    public static final int TAG_SYSTEM_PROBE = 0xFFFFFF07;
    public static final int TAG_SYSTEM_PROBE = 0xFFFFFF42;
    /** @hide */
    public static final int TAG_SYSTEM_NEIGHBOR = 0xFFFFFF08;
    public static final int TAG_SYSTEM_NEIGHBOR = 0xFFFFFF43;
    /** @hide */
    public static final int TAG_SYSTEM_GPS = 0xFFFFFF09;
    public static final int TAG_SYSTEM_GPS = 0xFFFFFF44;
    /** @hide */
    public static final int TAG_SYSTEM_PAC = 0xFFFFFF0A;

    /**
     * Sockets that are strictly local on device; never hits network.
     *
     * @hide
     */
    public static final int TAG_SYSTEM_LOCAL = 0xFFFFFFAA;
    public static final int TAG_SYSTEM_PAC = 0xFFFFFF45;

    private static INetworkStatsService sStatsService;

@@ -209,6 +210,19 @@ public class TrafficStats {
        setThreadStatsTag(TAG_SYSTEM_RESTORE);
    }

    /**
     * Set active tag to use when accounting {@link Socket} traffic originating
     * from the current thread. The tag used internally is well-defined to
     * distinguish all code-related traffic, such as updates performed by an app
     * store.
     *
     * @hide
     */
    @SystemApi
    public static void setThreadStatsTagCode() {
        setThreadStatsTag(TAG_SYSTEM_CODE);
    }

    /**
     * Get the active tag used when accounting {@link Socket} traffic originating
     * from the current thread. Only one active tag per thread is supported.
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package android.os;

import android.animation.ValueAnimator;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.ApplicationErrorReport;
@@ -343,6 +344,7 @@ public final class StrictMode {
    private static volatile VmPolicy sVmPolicy = VmPolicy.LAX;

    /** {@hide} */
    @TestApi
    public interface ViolationListener {
        public void onViolation(String message);
    }
@@ -350,6 +352,7 @@ public final class StrictMode {
    private static volatile ViolationListener sListener;

    /** {@hide} */
    @TestApi
    public static void setViolationListener(ViolationListener listener) {
        sListener = listener;
    }
+5 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public class RescueParty {
    private static final String PROP_RESCUE_LEVEL = "sys.rescue_level";
    private static final String PROP_RESCUE_BOOT_COUNT = "sys.rescue_boot_count";
    private static final String PROP_RESCUE_BOOT_START = "sys.rescue_boot_start";
    private static final String PROP_VIRTUAL_DEVICE = "ro.hardware.virtual_device";

    private static final int LEVEL_NONE = 0;
    private static final int LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS = 1;
@@ -336,6 +337,10 @@ public class RescueParty {
     * a good proxy for someone doing local development work.
     */
    private static boolean isUsbActive() {
        if (SystemProperties.getBoolean(PROP_VIRTUAL_DEVICE, false)) {
            Slog.v(TAG, "Assuming virtual device is connected over USB");
            return true;
        }
        try {
            final String state = FileUtils
                    .readTextFile(new File("/sys/class/android_usb/android0/state"), 128, "");