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

Commit 7ff8eb9c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Wait for target package MessageQueue empty before continuing"

parents 29a97de3 7156c61c
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -17,16 +17,19 @@
package com.android.frameworks.perftests.amteststestapp;

import android.app.Activity;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;

import com.android.frameworks.perftests.am.util.Constants;
import com.android.frameworks.perftests.am.util.Utils;

public class TestActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Utils.sendTime(getIntent(), Constants.TYPE_ACTIVITY_CREATED);
    protected void onResume() {
        super.onResume();
        Looper.myQueue().addIdleHandler(() -> {
            Utils.sendTime(getIntent(), Constants.TYPE_TARGET_PACKAGE_START);
            return false;
        });
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public class TargetPackageUtils {
            sleep();
        }
        // make sure Application has run
        timeReceiver.getReceivedTimeNs(Constants.TYPE_ACTIVITY_CREATED);
        timeReceiver.getReceivedTimeNs(Constants.TYPE_TARGET_PACKAGE_START);
        Utils.drainBroadcastQueue();
    }

+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.frameworks.perftests.am.util;

public class Constants {
    public static final String TYPE_ACTIVITY_CREATED = "activity_create";
    public static final String TYPE_TARGET_PACKAGE_START = "target_package_start";
    public static final String TYPE_BROADCAST_RECEIVE = "broadcast_receive";

    public static final String ACTION_BROADCAST_MANIFEST_RECEIVE =