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

Commit 73ffa869 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge changes from topic "oct28b"

* changes:
  BroadcastQueue: skip ANRs when assuming success.
  BroadcastQueue: better state transition logging.
  BroadcastQueue: return reasons from skip policy.
parents d43f830d ccb17e4d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.os.HandlerThread;
import android.os.Looper;
import android.os.Trace;

import com.android.server.am.BroadcastLoopers;

import java.util.concurrent.Executor;

/**
@@ -45,6 +47,7 @@ public final class JobSchedulerBackgroundThread extends HandlerThread {
            sInstance = new JobSchedulerBackgroundThread();
            sInstance.start();
            final Looper looper = sInstance.getLooper();
            BroadcastLoopers.addLooper(looper);
            looper.setTraceTag(Trace.TRACE_TAG_SYSTEM_SERVER);
            looper.setSlowLogThresholdMs(
                    SLOW_DISPATCH_THRESHOLD_MS, SLOW_DELIVERY_THRESHOLD_MS);
+10 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.os.Looper;
import android.os.Process;
import android.os.StrictMode;

import com.android.server.am.BroadcastLoopers;

/**
 * Special handler thread that we create for system services that require their own loopers.
 */
@@ -46,6 +48,14 @@ public class ServiceThread extends HandlerThread {
        super.run();
    }

    @Override
    protected void onLooperPrepared() {
        // Almost all service threads are used for dispatching broadcast
        // intents, so register ourselves to ensure that "wait-for-broadcast"
        // shell commands are able to drain any pending broadcasts
        BroadcastLoopers.addLooper(getLooper());
    }

    protected static Handler makeSharedHandler(Looper looper) {
        return new Handler(looper, /*callback=*/ null, /* async=*/ false, /* shared=*/ true);
    }
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Preconditions;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.server.am.BroadcastLoopers;
import com.android.server.pm.Installer;
import com.android.server.pm.UserManagerInternal;
import com.android.server.storage.AppFuseBridge;
@@ -1809,6 +1810,7 @@ class StorageManagerService extends IStorageManager.Stub

        HandlerThread hthread = new HandlerThread(TAG);
        hthread.start();
        BroadcastLoopers.addLooper(hthread.getLooper());
        mHandler = new StorageManagerServiceHandler(hthread.getLooper());

        // Add OBB Action Handler to StorageManagerService thread.
+2 −0
Original line number Diff line number Diff line
@@ -2509,6 +2509,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        Watchdog.getInstance().addMonitor(this);
        Watchdog.getInstance().addThread(mHandler);
        BroadcastLoopers.addLooper(BackgroundThread.getHandler().getLooper());
        // bind background threads to little cores
        // this is expected to fail inside of framework tests because apps can't touch cpusets directly
        // make sure we've already adjusted system_server's internal view of itself first
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import android.os.SystemClock;
import android.util.ArraySet;
import android.util.Slog;

import com.android.internal.annotations.GuardedBy;

import java.io.PrintWriter;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
@@ -37,6 +39,7 @@ import java.util.concurrent.CountDownLatch;
public class BroadcastLoopers {
    private static final String TAG = "BroadcastLoopers";

    @GuardedBy("sLoopers")
    private static final ArraySet<Looper> sLoopers = new ArraySet<>();

    /**
Loading