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

Commit 08408b93 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Tweak for b/37809561.

From the WTF log we know Args.run() sometimes gets called multiple
times.

Remove the Runnable interface from the Args class to make it
impossible to cast it to Runnable.

If the WTF still happens with this change, that'd be *very* interesting.

Test: Build and boot
Bug: 37809561
Change-Id: Id4bd9bd8d4098086649235fddfc2136527805838
parent 9414a255
Loading
Loading
Loading
Loading
+59 −57
Original line number Diff line number Diff line
@@ -1214,7 +1214,7 @@ public final class LoadedApk {
        RuntimeException mUnregisterLocation;
        boolean mForgotten;

        final class Args extends BroadcastReceiver.PendingResult implements Runnable {
        final class Args extends BroadcastReceiver.PendingResult {
            private Intent mCurIntent;
            private final boolean mOrdered;
            private boolean mDispatched;
@@ -1229,7 +1229,8 @@ public final class LoadedApk {
                mOrdered = ordered;
            }

            public void run() {
            public final Runnable getRunnable() {
                return () -> {
                    final BroadcastReceiver receiver = mReceiver;
                    final boolean ordered = mOrdered;

@@ -1288,6 +1289,7 @@ public final class LoadedApk {
                        finish();
                    }
                    Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
                };
            }
        }

@@ -1356,7 +1358,7 @@ public final class LoadedApk {
                            + " seq=" + seq + " to " + mReceiver);
                }
            }
            if (intent == null || !mActivityThread.post(args)) {
            if (intent == null || !mActivityThread.post(args.getRunnable())) {
                if (mRegistered && ordered) {
                    IActivityManager mgr = ActivityManager.getService();
                    if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG,