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

Commit d0437491 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "Minor getFutureForIntent fixes" into main

parents 1fd24467 8b8683af
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public class TestUtils {
        return getFutureForListener(
                (recv) ->
                        context.registerReceiver(
                                recv, new IntentFilter(action), Context.RECEIVER_NOT_EXPORTED),
                                recv, new IntentFilter(action), Context.RECEIVER_EXPORTED),
                (recv) -> {
                    try {
                        context.unregisterReceiver(recv);
@@ -75,6 +75,13 @@ public class TestUtils {
                "Intent receiver future for action: " + action);
    }

    /**
     * Same as previous, but with no predicate.
     */
    public static ListenableFuture<Intent> getFutureForIntent(Context context, String action) {
        return getFutureForIntent(context, action, i -> true);
    }

    /**
     * Return a future for a callback registered to a listener interface.
     * @param registerFunc - Function which consumes the callback object for registration