Files
app_Settings/src/com/android/settings/wifi/tether/WifiTetherSoftApManager.java
James Mattis 33379b361b Swap param order in registerSoftApCallback
Moving executor to be the first argument in registerSoftApCallback.

Bug: 144379300
Test: Manually on pixel 3

Change-Id: I5563c1059cc04014a0fd909e2508f7bf497d708e
2019-11-12 22:26:33 -08:00

57 lines
1.7 KiB
Java

package com.android.settings.wifi.tether;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.HandlerExecutor;
import java.util.List;
/**
* Wrapper for {@link android.net.wifi.WifiManager.SoftApCallback} to pass the robo test
*/
public class WifiTetherSoftApManager {
private WifiManager mWifiManager;
private WifiTetherSoftApCallback mWifiTetherSoftApCallback;
private WifiManager.SoftApCallback mSoftApCallback = new WifiManager.SoftApCallback() {
@Override
public void onStateChanged(int state, int failureReason) {
mWifiTetherSoftApCallback.onStateChanged(state, failureReason);
}
@Override
public void onConnectedClientsChanged(List<WifiClient> clients) {
mWifiTetherSoftApCallback.onConnectedClientsChanged(clients);
}
};
private Handler mHandler;
WifiTetherSoftApManager(WifiManager wifiManager,
WifiTetherSoftApCallback wifiTetherSoftApCallback) {
mWifiManager = wifiManager;
mWifiTetherSoftApCallback = wifiTetherSoftApCallback;
mHandler = new Handler();
}
public void registerSoftApCallback() {
mWifiManager.registerSoftApCallback(new HandlerExecutor(mHandler), mSoftApCallback);
}
public void unRegisterSoftApCallback() {
mWifiManager.unregisterSoftApCallback(mSoftApCallback);
}
public interface WifiTetherSoftApCallback {
void onStateChanged(int state, int failureReason);
/**
* Called when the connected clients to soft AP changes.
*
* @param clients the currently connected clients
*/
void onConnectedClientsChanged(List<WifiClient> clients);
}
}