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

Commit 64c8e0d8 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Add null checks for trusted presentation listener apis

Prevent the caller passing in a null window and having the
call fail silently in the future. Instead, fail if the caller
passes in a null window immediately.

Change-Id: I6608af3c9984e07a6c5bb55511d44f45a8a10484
Test: presubmit
Bug: 324908495
parent 59e8043a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -520,11 +520,16 @@ public final class WindowManagerImpl implements WindowManager {
    public void registerTrustedPresentationListener(@NonNull IBinder window,
            @NonNull TrustedPresentationThresholds thresholds, @NonNull Executor executor,
            @NonNull Consumer<Boolean> listener) {
        Objects.requireNonNull(window, "window must not be null");
        Objects.requireNonNull(thresholds, "thresholds must not be null");
        Objects.requireNonNull(executor, "executor must not be null");
        Objects.requireNonNull(listener, "listener must not be null");
        mGlobal.registerTrustedPresentationListener(window, thresholds, executor, listener);
    }

    @Override
    public void unregisterTrustedPresentationListener(@NonNull Consumer<Boolean> listener) {
        Objects.requireNonNull(listener, "listener must not be null");
        mGlobal.unregisterTrustedPresentationListener(listener);
    }