diff options
author | Roshan Pius <rpius@google.com> | 2019-10-25 12:35:58 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-10-26 14:47:18 -0700 |
commit | bda99994b4efd25d0b59af53ee10cceedc2b061c (patch) | |
tree | e929b2a5e5cce404a8352197e875398f5e2ca7b8 /service | |
parent | c8305dfa608b0e03e20a780dac0ff85945ef72b7 (diff) |
ActiveModeWarden: Remove redundant SoftApCallback
Bug: 139157226
Test: atest com.android.server.wifi
Change-Id: I3b31a5e2b1b054c6931e1c00d1f0a7a49e3fb201
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ActiveModeWarden.java | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/service/java/com/android/server/wifi/ActiveModeWarden.java b/service/java/com/android/server/wifi/ActiveModeWarden.java index 8209de91b..7539c18c6 100644 --- a/service/java/com/android/server/wifi/ActiveModeWarden.java +++ b/service/java/com/android/server/wifi/ActiveModeWarden.java @@ -25,7 +25,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.location.LocationManager; -import android.net.wifi.WifiClient; import android.net.wifi.WifiManager; import android.os.BatteryStats; import android.os.Handler; @@ -262,7 +261,9 @@ public class ActiveModeWarden { Preconditions.checkState(softApConfig.getTargetMode() == IFACE_IP_MODE_LOCAL_ONLY || softApConfig.getTargetMode() == IFACE_IP_MODE_TETHERED); - SoftApCallbackImpl callback = new SoftApCallbackImpl(softApConfig.getTargetMode()); + WifiManager.SoftApCallback callback = + softApConfig.getTargetMode() == IFACE_IP_MODE_LOCAL_ONLY + ? mLohsCallback : mSoftApCallback; SoftApListener listener = new SoftApListener(); ActiveModeManager manager = mWifiInjector.makeSoftApManager(listener, callback, softApConfig); @@ -413,40 +414,6 @@ public class ActiveModeWarden { } } - private class SoftApCallbackImpl implements WifiManager.SoftApCallback { - private final int mIpMode; - - SoftApCallbackImpl(int mode) { - Preconditions.checkArgument(mode == IFACE_IP_MODE_TETHERED - || mode == IFACE_IP_MODE_LOCAL_ONLY); - mIpMode = mode; - } - - @Override - public void onStateChanged(int state, int reason) { - switch (mIpMode) { - case IFACE_IP_MODE_TETHERED: - if (mSoftApCallback != null) mSoftApCallback.onStateChanged(state, reason); - break; - case IFACE_IP_MODE_LOCAL_ONLY: - if (mLohsCallback != null) mLohsCallback.onStateChanged(state, reason); - break; - } - } - - @Override - public void onConnectedClientsChanged(List<WifiClient> clients) { - switch (mIpMode) { - case IFACE_IP_MODE_TETHERED: - if (mSoftApCallback != null) mSoftApCallback.onConnectedClientsChanged(clients); - break; - case IFACE_IP_MODE_LOCAL_ONLY: - if (mLohsCallback != null) mLohsCallback.onConnectedClientsChanged(clients); - break; - } - } - } - private void updateBatteryStats() { updateBatteryStatsWifiState(hasAnyModeManager()); if (areAllClientModeManagersInScanOnlyRole()) { |