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

Commit 16f5e297 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Track broadcast latency of fg instead of bg broadcasts.

Bug: 257326739
Test: atest ./tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/BroadcastPerfTest.java
Change-Id: I1210819f9e13534625d9537520ab8e5eeeac4fe1
parent 44adcab4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -61,10 +61,11 @@ public class BasePerfTest {
        return intent;
    }

    protected Intent createBroadcastIntent(String action) {
    protected Intent createFgBroadcastIntent(String action) {
        final Intent intent = new Intent(action);
        intent.addFlags(
                Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND | Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND
                | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
                | Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        putTimeReceiverBinderExtra(intent);
        return intent;
    }
+6 −6
Original line number Diff line number Diff line
@@ -30,11 +30,11 @@ import org.junit.runner.RunWith;
@LargeTest
public class BroadcastPerfTest extends BasePerfTest {
    @Test
    public void manifestBroadcastRunning() {
    public void manifestFgBroadcastRunning() {
        runPerfFunction(() -> {
            startTargetPackage();

            final Intent intent = createBroadcastIntent(
            final Intent intent = createFgBroadcastIntent(
                    Constants.ACTION_BROADCAST_MANIFEST_RECEIVE);

            final long startTime = System.nanoTime();
@@ -48,9 +48,9 @@ public class BroadcastPerfTest extends BasePerfTest {
    }

    @Test
    public void manifestBroadcastNotRunning() {
    public void manifestFgBroadcastNotRunning() {
        runPerfFunction(() -> {
            final Intent intent = createBroadcastIntent(
            final Intent intent = createFgBroadcastIntent(
                    Constants.ACTION_BROADCAST_MANIFEST_RECEIVE);

            final long startTime = System.nanoTime();
@@ -64,11 +64,11 @@ public class BroadcastPerfTest extends BasePerfTest {
    }

    @Test
    public void registeredBroadcast() {
    public void registeredFgBroadcast() {
        runPerfFunction(() -> {
            startTargetPackage();

            final Intent intent = createBroadcastIntent(
            final Intent intent = createFgBroadcastIntent(
                    Constants.ACTION_BROADCAST_REGISTERED_RECEIVE);

            final long startTime = System.nanoTime();