Loading services/core/java/com/android/server/am/ApplicationThreadDeferred.java +3 −19 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); }; Loading @@ -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. Loading Loading @@ -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; } Loading services/core/java/com/android/server/am/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -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" Loading services/tests/mockingservicestests/src/com/android/server/am/ApplicationThreadDeferredTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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); Loading Loading
services/core/java/com/android/server/am/ApplicationThreadDeferred.java +3 −19 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); }; Loading @@ -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. Loading Loading @@ -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; } Loading
services/core/java/com/android/server/am/flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -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" Loading
services/tests/mockingservicestests/src/com/android/server/am/ApplicationThreadDeferredTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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); Loading