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

Commit dc69f468 authored by Roshan Pius's avatar Roshan Pius
Browse files

WifiManager: Send list of matching scan results for network request

Change the arguments for the onMatch() callback to return a list of
|ScanResult| instead of |WifiConfiguration|. This allows the settings UI
team to reuse the existing infrastructure used for presenting list of networks in
the wifi picker UI.

Bug: 113878056
Test: ./frameworks/base/wifi/tests/runtests.sh
Change-Id: Ic7e0665bbef35a52df77be4d3c0574b01e0c8193
parent 98b14ec2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net.wifi;

import android.net.wifi.INetworkRequestUserSelectionCallback;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;

/**
@@ -28,7 +29,7 @@ oneway interface INetworkRequestMatchCallback
{
   void onUserSelectionCallbackRegistration(in INetworkRequestUserSelectionCallback userSelectionCallback);

   void onMatch(in List<WifiConfiguration> wificonfigurations);
   void onMatch(in List<ScanResult> scanResults);

   void onUserSelectionConnectSuccess(in WifiConfiguration wificonfiguration);

+8 −8
Original line number Diff line number Diff line
@@ -1269,12 +1269,12 @@ public class WifiManager {
        /**
         * Invoked when a network request initiated by an app matches some networks in scan results.
         * This may be invoked multiple times for a single network request as the platform finds new
         * networks in scan results.
         * matching networks in scan results.
         *
         * @param wifiConfigurations List of {@link WifiConfiguration} objects corresponding to the
         *                           networks matching the request.
         * @param scanResults List of {@link ScanResult} objects corresponding to the networks
         *                    matching the request.
         */
        void onMatch(@NonNull List<WifiConfiguration> wifiConfigurations);
        void onMatch(@NonNull List<ScanResult> scanResults);

        /**
         * Invoked on a successful connection with the network that the user selected
@@ -1363,13 +1363,13 @@ public class WifiManager {
        }

        @Override
        public void onMatch(List<WifiConfiguration> wifiConfigurations) {
        public void onMatch(List<ScanResult> scanResults) {
            if (mVerboseLoggingEnabled) {
                Log.v(TAG, "NetworkRequestMatchCallbackProxy: onMatch wificonfigurations: "
                        + wifiConfigurations);
                Log.v(TAG, "NetworkRequestMatchCallbackProxy: onMatch scanResults: "
                        + scanResults);
            }
            mHandler.post(() -> {
                mCallback.onMatch(wifiConfigurations);
                mCallback.onMatch(scanResults);
            });
        }

+1 −1
Original line number Diff line number Diff line
@@ -1202,7 +1202,7 @@ i * Verify that a call to cancel WPS immediately returns a failure.
                mock(INetworkRequestUserSelectionCallback.class);

        assertEquals(0, mLooper.dispatchAll());
        callbackCaptor.getValue().onMatch(new ArrayList<WifiConfiguration>());
        callbackCaptor.getValue().onMatch(new ArrayList<ScanResult>());
        assertEquals(1, mLooper.dispatchAll());
        verify(mNetworkRequestMatchCallback).onMatch(anyList());