Merge "Support for hotspot client visibility."
This commit is contained in:
@@ -16,14 +16,11 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.wifi.WifiClient;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.text.BidiFormatter;
|
import android.text.BidiFormatter;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
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.OnStart;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class WifiTetherPreferenceController extends AbstractPreferenceController
|
public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||||
implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
|
implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
|
||||||
|
|
||||||
@@ -128,13 +127,13 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNumClientsChanged(int numClients) {
|
public void onConnectedClientsChanged(List<WifiClient> clients) {
|
||||||
if (mPreference != null
|
if (mPreference != null
|
||||||
&& mSoftApState == WifiManager.WIFI_AP_STATE_ENABLED) {
|
&& mSoftApState == WifiManager.WIFI_AP_STATE_ENABLED) {
|
||||||
// Only show the number of clients when state is on
|
// Only show the number of clients when state is on
|
||||||
mPreference.setSummary(mContext.getResources().getQuantityString(
|
mPreference.setSummary(mContext.getResources().getQuantityString(
|
||||||
R.plurals.wifi_tether_connected_summary, numClients,
|
R.plurals.wifi_tether_connected_summary, clients.size(),
|
||||||
numClients));
|
clients.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
package com.android.settings.wifi.tether;
|
package com.android.settings.wifi.tether;
|
||||||
|
|
||||||
|
import android.net.wifi.WifiClient;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for {@link android.net.wifi.WifiManager.SoftApCallback} to pass the robo test
|
* Wrapper for {@link android.net.wifi.WifiManager.SoftApCallback} to pass the robo test
|
||||||
*/
|
*/
|
||||||
@@ -18,8 +21,8 @@ public class WifiTetherSoftApManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNumClientsChanged(int numClients) {
|
public void onConnectedClientsChanged(List<WifiClient> clients) {
|
||||||
mWifiTetherSoftApCallback.onNumClientsChanged(numClients);
|
mWifiTetherSoftApCallback.onConnectedClientsChanged(clients);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
@@ -42,6 +45,11 @@ public class WifiTetherSoftApManager {
|
|||||||
public interface WifiTetherSoftApCallback {
|
public interface WifiTetherSoftApCallback {
|
||||||
void onStateChanged(int state, int failureReason);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user