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

Commit 5ab02433 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Only require that system UIDs tag their sockets.

Apps with a normal UID are typically isolated enough to not require
socket tagging; we're mostly interested in tracking down internal
UIDs that have lots of code sharing the same UID.

Also fix up everyone doing manual string checks of Build.TYPE, since
we now have first-class fields for those.

Bug: 38126076
Test: builds, boots
Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
parent 27895365
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
     * Scrub given IMSI on production builds.
     */
    public static String scrubSubscriberId(String subscriberId) {
        if ("eng".equals(Build.TYPE)) {
        if (Build.IS_ENG) {
            return subscriberId;
        } else if (subscriberId != null) {
            // TODO: parse this as MCC+MNC instead of hard-coding
+10 −11
Original line number Diff line number Diff line
@@ -125,9 +125,6 @@ public final class StrictMode {
    private static final String TAG = "StrictMode";
    private static final boolean LOG_V = Log.isLoggable(TAG, Log.VERBOSE);

    private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
    private static final boolean IS_ENG_BUILD = "eng".equals(Build.TYPE);

    /**
     * Boolean system property to disable strict mode checks outright.
     * Set this to 'true' to force disable; 'false' has no effect on other
@@ -1191,7 +1188,7 @@ public final class StrictMode {

        // For debug builds, log event loop stalls to dropbox for analysis.
        // Similar logic also appears in ActivityThread.java for system apps.
        if (!doFlashes && (IS_USER_BUILD || suppress)) {
        if (!doFlashes && (Build.IS_USER || suppress)) {
            setCloseGuardEnabled(false);
            return false;
        }
@@ -1199,7 +1196,7 @@ public final class StrictMode {
        // Eng builds have flashes on all the time.  The suppression property
        // overrides this, so we force the behavior only after the short-circuit
        // check above.
        if (IS_ENG_BUILD) {
        if (Build.IS_ENG) {
            doFlashes = true;
        }

@@ -1208,7 +1205,7 @@ public final class StrictMode {
                StrictMode.DETECT_DISK_READ |
                StrictMode.DETECT_NETWORK;

        if (!IS_USER_BUILD) {
        if (!Build.IS_USER) {
            threadPolicyMask |= StrictMode.PENALTY_DROPBOX;
        }
        if (doFlashes) {
@@ -1219,23 +1216,25 @@ public final class StrictMode {

        // VM Policy controls CloseGuard, detection of Activity leaks,
        // and instance counting.
        if (IS_USER_BUILD) {
        if (Build.IS_USER) {
            setCloseGuardEnabled(false);
        } else {
            VmPolicy.Builder policyBuilder = new VmPolicy.Builder().detectAll();
            if (!IS_ENG_BUILD) {
            if (!Build.IS_ENG) {
                // Activity leak detection causes too much slowdown for userdebug because of the
                // GCs.
                policyBuilder = policyBuilder.disable(DETECT_VM_ACTIVITY_LEAKS);
            }
            policyBuilder = policyBuilder.penaltyDropBox();
            if (IS_ENG_BUILD) {
            if (Build.IS_ENG) {
                policyBuilder.penaltyLog();
            }
            // All core system components need to tag their sockets to aid
            // system health investigations
            if (android.os.Process.myUid() < android.os.Process.FIRST_APPLICATION_UID) {
                policyBuilder.detectUntaggedSockets();
                policyBuilder.enable(DETECT_VM_UNTAGGED_SOCKET);
            } else {
                policyBuilder.disable(DETECT_VM_UNTAGGED_SOCKET);
            }
            setVmPolicy(policyBuilder.build());
            setCloseGuardEnabled(vmClosableObjectLeaksEnabled());
@@ -2294,7 +2293,7 @@ public final class StrictMode {
     * @hide
     */
    public static Span enterCriticalSpan(String name) {
        if (IS_USER_BUILD) {
        if (Build.IS_USER) {
            return NO_OP_SPAN;
        }
        if (name == null || name.isEmpty()) {
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import java.util.Deque;
 */
public class BootTimingsTraceLog {
    // Debug boot time for every step if it's non-user build.
    private static final boolean DEBUG_BOOT_TIME = !"user".equals(Build.TYPE);
    private static final boolean DEBUG_BOOT_TIME = !Build.IS_USER;
    private final Deque<Pair<String, Long>> mStartTimes
            = DEBUG_BOOT_TIME ? new ArrayDeque<>() : null;
    private final String mTag;
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.util.Log;
 * @hide
 */
public final class InputEventConsistencyVerifier {
    private static final boolean IS_ENG_BUILD = "eng".equals(Build.TYPE);
    private static final boolean IS_ENG_BUILD = Build.IS_ENG;

    private static final String EVENT_TYPE_KEY = "KeyEvent";
    private static final String EVENT_TYPE_TRACKBALL = "TrackballEvent";
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public final class AccessibilityCache {

    private static final boolean DEBUG = false;

    private static final boolean CHECK_INTEGRITY = "eng".equals(Build.TYPE);
    private static final boolean CHECK_INTEGRITY = Build.IS_ENG;

    /**
     * {@link AccessibilityEvent} types that are critical for the cache to stay up to date
Loading