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

Commit 35c05f7c authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Delete the defer_binders_when_paused flag" into main

parents af3be76f 851d1373
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -42,12 +42,6 @@ final class ApplicationThreadDeferred extends IApplicationThread.Delegator {

    static final String TAG = TAG_WITH_CLASS_NAME ? "ApplicationThreadDeferred" : TAG_AM;

    // The flag that enables the deferral behavior of this class.  If the flag is disabled then
    // the class behaves exactly like an ApplicationThreadFilter.
    private static boolean deferBindersWhenPaused() {
        return Flags.deferBindersWhenPaused();
    }

    // The list of notifications that may be deferred.
    private static final int CLEAR_DNS_CACHE = 0;
    private static final int UPDATE_TIME_ZONE = 1;
@@ -84,19 +78,14 @@ final class ApplicationThreadDeferred extends IApplicationThread.Delegator {
    @GuardedBy("mLock")
    private final boolean[] mPending = new boolean[NOTIFICATION_COUNT];

    // When true, binder calls to paused processes will be deferred until the process is unpaused.
    private final boolean mDefer;

    // The base thread, because Delegator does not expose it.
    private final IApplicationThread mBase;

    /** Create an instance with a base thread and a deferral enable flag. */
    @VisibleForTesting
    public ApplicationThreadDeferred(IApplicationThread thread, boolean defer) {
    /** Create an instance with a base thread. */
    public ApplicationThreadDeferred(IApplicationThread thread) {
        super(thread);

        mBase = thread;
        mDefer = defer;

        mOperations[CLEAR_DNS_CACHE] = () -> { super.clearDnsCache(); };
        mOperations[UPDATE_TIME_ZONE] = () -> { super.updateTimeZone(); };
@@ -104,11 +93,6 @@ final class ApplicationThreadDeferred extends IApplicationThread.Delegator {
        mOperations[UPDATE_HTTP_PROXY] = () -> { super.updateHttpProxy(); };
    }

    /** Create an instance with a base flag, using the system deferral enable flag. */
    public ApplicationThreadDeferred(IApplicationThread thread) {
        this(thread, deferBindersWhenPaused());
    }

    /**
     * Return the implementation's value of asBinder(). super.asBinder() is not a real Binder
     * object.
@@ -155,7 +139,7 @@ final class ApplicationThreadDeferred extends IApplicationThread.Delegator {
     */
    private void execute(@NotificationType int tag) throws RemoteException {
        synchronized (mLock) {
            if (mPaused && mDefer) {
            if (mPaused) {
                mPending[tag] = true;
                return;
            }
+0 −8
Original line number Diff line number Diff line
@@ -141,14 +141,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "defer_binders_when_paused"
    namespace: "system_performance"
    is_fixed_read_only: true
    description: "Defer submitting binder calls to paused processes."
    bug: "327038797"
}

flag {
    name: "log_broadcast_sent_event"
    namespace: "backstage_power"
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class ApplicationThreadDeferredTest {
    @Test
    public void testDeferredUnpaused() throws Exception {
        IApplicationThread base = mock(IApplicationThread.class);
        ApplicationThreadDeferred thread = new ApplicationThreadDeferred(base, true);
        ApplicationThreadDeferred thread = new ApplicationThreadDeferred(base);
        callDeferredApis(thread);
        verifyDeferredApis(base, 1);
    }
@@ -83,7 +83,7 @@ public class ApplicationThreadDeferredTest {
    @Test
    public void testDeferredPaused() throws Exception {
        IApplicationThread base = mock(IApplicationThread.class);
        ApplicationThreadDeferred thread = new ApplicationThreadDeferred(base, true);
        ApplicationThreadDeferred thread = new ApplicationThreadDeferred(base);
        thread.onProcessPaused();
        callDeferredApis(thread);
        callDeferredApis(thread);