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

Commit 517daecc authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Moved SystemServer binder thread monitor from AMS to Monitor class.

Since to it applies to more than just the ActivityManagerService.

Bug: 19297165
Change-Id: I3affd50aaf8a49589ca48b845d6d31e4a44efb8f
parent 1a3c3303
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -190,6 +190,17 @@ public class Watchdog extends Thread {
        }
    }

    /** Monitor for checking the availability of binder threads. The monitor will block until
     * there is a binder thread available to process in coming IPCs to make sure other processes
     * can still communicate with the service.
     */
    private static final class BinderThreadMonitor implements Watchdog.Monitor {
        @Override
        public void monitor() {
            Binder.blockUntilThreadAvailable();
        }
    }

    public interface Monitor {
        void monitor();
    }
@@ -227,6 +238,9 @@ public class Watchdog extends Thread {
        // And the display thread.
        mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(),
                "display thread", DEFAULT_TIMEOUT));

        // Initialize monitor for Binder threads.
        addMonitor(new BinderThreadMonitor());
    }

    public void init(Context context, ActivityManagerService activity) {
+0 −10
Original line number Diff line number Diff line
@@ -2179,15 +2179,6 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
    }
    public static final class BinderThreadMonitor implements Watchdog.Monitor {
        /** This method will block until there is a binder thread available to process
         * in coming IPCs to make sure other processes can still communicate with the service.
         */
        @Override
        public void monitor() {
            Binder.blockUntilThreadAvailable();
        }
    }
    // Note: This method is invoked on the main thread but may need to attach various
    // handlers to other threads.  So take care to be explicit about the looper.
    public ActivityManagerService(Context systemContext) {
@@ -2282,7 +2273,6 @@ public final class ActivityManagerService extends ActivityManagerNative
        };
        Watchdog.getInstance().addMonitor(this);
        Watchdog.getInstance().addMonitor(new BinderThreadMonitor());
        Watchdog.getInstance().addThread(mHandler);
    }