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

Commit 8b8683af authored by Atneya Nair's avatar Atneya Nair
Browse files

Minor getFutureForIntent fixes

- Add exported receiver for inter-app communication
- Add overload not taking predicate

Bug: 268724205
Test: atest getFutureForIntentTest
Change-Id: I48ab98a68702f52af22df5f0c0ce9dddba91dbc0
parent 42d2ac89
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