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

Commit 15f89078 authored by Vinit Deshpande's avatar Vinit Deshpande
Browse files

Implement getAvailableChannels

This API allows finding channels by band, so scanning services
can find out which channels to use.

Bug: 16652660
Change-Id: I690825333988a336efa3fc8886297e5b8baf8e1d
parent 8eca9e0f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net.wifi;

import android.os.Messenger;
import android.os.Bundle;

/**
 * {@hide}
@@ -24,4 +25,6 @@ import android.os.Messenger;
interface IWifiScanner
{
    Messenger getMessenger();

    Bundle getAvailableChannels(int band);
}
+10 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.net.wifi;

import android.annotation.SystemApi;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
@@ -76,6 +77,9 @@ public class WifiScanner {
    /** Invalid request */
    public static final int REASON_INVALID_REQUEST = -3;

    /** @hide */
    public static final String GET_AVAILABLE_CHANNELS_EXTRA = "Channels";

    /**
     * Generic action callback invocation interface
     *  @hide
@@ -92,8 +96,13 @@ public class WifiScanner {
     * @hide
     */
    public List<Integer> getAvailableChannels(int band) {
        try {
            Bundle bundle =  mService.getAvailableChannels(band);
            return bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
        } catch (RemoteException e) {
            return null;
        }
    }

    /**
     * provides channel specification for scanning