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

Commit 81a8c861 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Update the hardcoded value for the const CORE_DEFER_UNTIL_ACTIVE.

This is already set to true when broadcast constants are
initialied. So, this only impacts tests that does not initialize
broadcast constants.

This makes the tests behavior consistent which results in one of
the tests failing, as this test relies on running after
'testCalculateDeferUntilActive_System' which may not always be
the case.

Bug: 411309776
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastRecordTest.java
Flag: EXEMPT bufix
Change-Id: Ia4d2a34343bb28c782f27f6e41088fa8cdf41dca
parent a640e5ad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ final class BroadcastRecord extends Binder {
     * treat {@link BroadcastOptions#DEFERRAL_POLICY_DEFAULT} as
     * {@link BroadcastOptions#DEFERRAL_POLICY_UNTIL_ACTIVE}.
     */
    static boolean CORE_DEFER_UNTIL_ACTIVE = false;
    static boolean CORE_DEFER_UNTIL_ACTIVE = true;

    /** Empty immutable list of receivers */
    static final List<Object> EMPTY_RECEIVERS = List.of();
+2 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import androidx.test.filters.SmallTest;
import com.android.server.compat.PlatformCompat;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -762,8 +763,6 @@ public class BroadcastRecordTest {

    @Test
    public void testCalculateDeferUntilActive_System() {
        BroadcastRecord.CORE_DEFER_UNTIL_ACTIVE = true;

        // Verify non-urgent behavior
        assertTrue(calculateDeferUntilActive(SYSTEM_UID, null, null, false, false));
        assertTrue(calculateDeferUntilActive(SYSTEM_UID, OPT_DEFAULT, null, false, false));
@@ -1055,6 +1054,7 @@ public class BroadcastRecordTest {
                10);
    }

    @Ignore
    @Test
    @EnableFlags(Flags.FLAG_LOG_BROADCAST_PROCESSED_EVENT)
    public void testUpdateBroadcastProcessedEventRecord_withNewAndExistingReceiver_multipleBroadcastProcessedEventRecordCreated() {