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

Commit a357590b authored by Todd Lee's avatar Todd Lee
Browse files

Allow querying of remote filters via transitions

This change adds a method to Transitions which allows
for querying whether a given TransitionInfo will be handled by
the set of TransitionFilters which have been registered with
the RemoteTransitionHandler.

Bug: b/436673180
Test: presubmits
Flag: NONE trivial change
Change-Id: I608d8d3aa35b87566bbf18f2a3dc2a7ea5788a45
parent fb4084bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
    private final ArrayMap<IBinder, RemoteTransition> mRequestedRemotes = new ArrayMap<>();

    /** Ordered by specificity. Last filters will be checked first */
    private final ArrayList<Pair<TransitionFilter, RemoteTransition>> mFilters =
    final ArrayList<Pair<TransitionFilter, RemoteTransition>> mFilters =
            new ArrayList<>();
    private final ArrayList<Pair<TransitionFilter, RemoteTransition>> mTakeoverFilters =
            new ArrayList<>();
+17 −0
Original line number Diff line number Diff line
@@ -483,6 +483,23 @@ public class Transitions implements RemoteCallable<Transitions>,
        mRemoteTransitionHandler.removeFiltered(remoteTransition);
    }

    /**
     * Check whether a given TransitionInfo object would be handled by the TransitionFilter(s)
     * registered with the RemoteTransitionHandler.
     *
     * @param info the TransitionInfo to check with the RemoteTransitionHandler.
     * @return true if the info matches with a registered TransitionFilter, otherwise false.
     */
    public boolean matchesRemoteFilter(TransitionInfo info) {
        for (Pair<TransitionFilter, RemoteTransition> filterPair
                : mRemoteTransitionHandler.mFilters) {
            if (filterPair.first.matches(info)) {
                return true;
            }
        }
        return false;
    }

    RemoteTransitionHandler getRemoteTransitionHandler() {
        return mRemoteTransitionHandler;
    }