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

Commit b7abd810 authored by Etan Cohen's avatar Etan Cohen
Browse files

[AWARE][RTT] Check for null callback registration

Check on the manager side for null callback registration and throw
and exception.

Should be done in addition to service side checks since, in well
behaved apps (which don't bypass the manager), the callback registered
with the service is a proxy wrapper for the user-provided callback.

Bug: 71575804
Test: unit test & integration tests
Change-Id: Ice6585fccb13d842d9518b1f60bff911fb66c48f
parent c36fbd4f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -269,6 +269,10 @@ public class WifiAwareManager {
                    + identityChangedListener);
        }

        if (attachCallback == null) {
            throw new IllegalArgumentException("Null callback provided");
        }

        synchronized (mLock) {
            Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();

@@ -300,6 +304,10 @@ public class WifiAwareManager {
            DiscoverySessionCallback callback) {
        if (VDBG) Log.v(TAG, "publish(): clientId=" + clientId + ", config=" + publishConfig);

        if (callback == null) {
            throw new IllegalArgumentException("Null callback provided");
        }

        try {
            mService.publish(mContext.getOpPackageName(), clientId, publishConfig,
                    new WifiAwareDiscoverySessionCallbackProxy(this, looper, true, callback,
@@ -333,6 +341,10 @@ public class WifiAwareManager {
            }
        }

        if (callback == null) {
            throw new IllegalArgumentException("Null callback provided");
        }

        try {
            mService.subscribe(mContext.getOpPackageName(), clientId, subscribeConfig,
                    new WifiAwareDiscoverySessionCallbackProxy(this, looper, false, callback,
+4 −0
Original line number Diff line number Diff line
@@ -123,6 +123,10 @@ public class WifiRttManager {
                    + ", callback=" + callback + ", handler=" + handler);
        }

        if (callback == null) {
            throw new IllegalArgumentException("Null callback provided");
        }

        Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();
        Binder binder = new Binder();
        try {