Merge "Support for hotspot client visibility."

This commit is contained in:
James Mattis
2019-11-13 16:37:27 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 10 deletions

View File

@@ -16,14 +16,11 @@
package com.android.settings.wifi.tether;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.provider.Settings;
import android.text.BidiFormatter;
import androidx.annotation.VisibleForTesting;
@@ -39,6 +36,8 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
import java.util.List;
public class WifiTetherPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
@@ -128,13 +127,13 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
}
@Override
public void onNumClientsChanged(int numClients) {
public void onConnectedClientsChanged(List<WifiClient> clients) {
if (mPreference != null
&& mSoftApState == WifiManager.WIFI_AP_STATE_ENABLED) {
// Only show the number of clients when state is on
mPreference.setSummary(mContext.getResources().getQuantityString(
R.plurals.wifi_tether_connected_summary, numClients,
numClients));
R.plurals.wifi_tether_connected_summary, clients.size(),
clients.size()));
}
}
});

View File

@@ -1,8 +1,11 @@
package com.android.settings.wifi.tether;
import android.net.wifi.WifiClient;
import android.net.wifi.WifiManager;
import android.os.Handler;
import java.util.List;
/**
* Wrapper for {@link android.net.wifi.WifiManager.SoftApCallback} to pass the robo test
*/
@@ -18,8 +21,8 @@ public class WifiTetherSoftApManager {
}
@Override
public void onNumClientsChanged(int numClients) {
mWifiTetherSoftApCallback.onNumClientsChanged(numClients);
public void onConnectedClientsChanged(List<WifiClient> clients) {
mWifiTetherSoftApCallback.onConnectedClientsChanged(clients);
}
};
private Handler mHandler;
@@ -42,6 +45,11 @@ public class WifiTetherSoftApManager {
public interface WifiTetherSoftApCallback {
void onStateChanged(int state, int failureReason);
void onNumClientsChanged(int numClients);
/**
* Called when the connected clients to soft AP changes.
*
* @param clients the currently connected clients
*/
void onConnectedClientsChanged(List<WifiClient> clients);
}
}