Revert "Sysui/WifiTracker: Changes to support late starting wifi service"
This reverts commit e01f30b6bf.
Reason for revert: Wifi services no longer plan to be a separate
APK/process for mainline. Will instead become a jar loaded from Apex.
Bug: 144722612
Test: Device boots up & connects to wifi networks.
Change-Id: Iad48a59ff397ba61fac77a4c3c296190b7c70ee5
This commit is contained in:
@@ -224,9 +224,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
|
||||
mConnectivityManager = connectivityManager;
|
||||
|
||||
// check if verbose logging developer option has been turned on or off
|
||||
sVerboseLogging = Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, 0) > 0;
|
||||
sVerboseLogging = mWifiManager != null && (mWifiManager.getVerboseLoggingLevel() > 0);
|
||||
|
||||
mFilter = filter;
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ public class HotspotTile extends QSTileImpl<BooleanState> {
|
||||
if (listening) {
|
||||
refreshState();
|
||||
}
|
||||
mHotspotController.handleSetListening(listening);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.statusbar.policy.HotspotController.Callback;
|
||||
|
||||
public interface HotspotController extends CallbackController<Callback>, Dumpable {
|
||||
void handleSetListening(boolean listening);
|
||||
|
||||
boolean isHotspotEnabled();
|
||||
boolean isHotspotTransient();
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
|
||||
private int mHotspotState;
|
||||
private volatile int mNumConnectedDevices;
|
||||
private boolean mWaitingForTerminalState;
|
||||
private boolean mListening;
|
||||
|
||||
/**
|
||||
* Controller used to retrieve information related to a hotspot.
|
||||
@@ -109,19 +108,14 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
|
||||
if (DEBUG) Log.d(TAG, "addCallback " + callback);
|
||||
mCallbacks.add(callback);
|
||||
if (mWifiManager != null) {
|
||||
if (mListening) {
|
||||
if (mCallbacks.size() == 1) {
|
||||
mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler),
|
||||
this);
|
||||
} else {
|
||||
// mWifiManager#registerSoftApCallback triggers a call to
|
||||
// onConnectedClientsChanged on the Main Handler. In order to always update
|
||||
// the callback on added, we make this call when adding callbacks after the
|
||||
// first.
|
||||
mMainHandler.post(() ->
|
||||
callback.onHotspotChanged(isHotspotEnabled(),
|
||||
mNumConnectedDevices));
|
||||
}
|
||||
if (mCallbacks.size() == 1) {
|
||||
mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler), this);
|
||||
} else {
|
||||
// mWifiManager#registerSoftApCallback triggers a call to onNumClientsChanged
|
||||
// on the Main Handler. In order to always update the callback on added, we
|
||||
// make this call when adding callbacks after the first.
|
||||
mMainHandler.post(() ->
|
||||
callback.onHotspotChanged(isHotspotEnabled(), mNumConnectedDevices));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,23 +127,12 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
|
||||
if (DEBUG) Log.d(TAG, "removeCallback " + callback);
|
||||
synchronized (mCallbacks) {
|
||||
mCallbacks.remove(callback);
|
||||
if (mCallbacks.isEmpty() && mWifiManager != null && mListening) {
|
||||
if (mCallbacks.isEmpty() && mWifiManager != null) {
|
||||
mWifiManager.unregisterSoftApCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSetListening(boolean listening) {
|
||||
// Wait for the first |handleSetListening(true))| to register softap callbacks (for lazy
|
||||
// registration of the softap callbacks).
|
||||
if (mListening || !listening) return;
|
||||
mListening = true;
|
||||
if (mCallbacks.size() >= 1) {
|
||||
mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler), this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHotspotEnabled() {
|
||||
return mHotspotState == WifiManager.WIFI_AP_STATE_ENABLED;
|
||||
|
||||
@@ -325,7 +325,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
||||
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_BOOT_COMPLETED);
|
||||
filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
|
||||
mBroadcastDispatcher.registerReceiver(this, filter, mReceiverHandler);
|
||||
mListening = true;
|
||||
@@ -543,9 +542,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
recalculateEmergency();
|
||||
}
|
||||
break;
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
mWifiSignalController.handleBootCompleted();
|
||||
break;
|
||||
case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
|
||||
mConfig = Config.readConfig(mContext);
|
||||
mReceiverHandler.post(this::handleConfigurationChanged);
|
||||
|
||||
@@ -38,7 +38,6 @@ import java.util.Objects;
|
||||
public class WifiSignalController extends
|
||||
SignalController<WifiSignalController.WifiState, SignalController.IconGroup> {
|
||||
private final boolean mHasMobileData;
|
||||
private final WifiManager mWifiManager;
|
||||
private final WifiStatusTracker mWifiTracker;
|
||||
|
||||
public WifiSignalController(Context context, boolean hasMobileData,
|
||||
@@ -50,11 +49,13 @@ public class WifiSignalController extends
|
||||
context.getSystemService(NetworkScoreManager.class);
|
||||
ConnectivityManager connectivityManager =
|
||||
context.getSystemService(ConnectivityManager.class);
|
||||
mWifiManager = wifiManager;
|
||||
mWifiTracker = new WifiStatusTracker(mContext, wifiManager, networkScoreManager,
|
||||
connectivityManager, this::handleStatusUpdated);
|
||||
mWifiTracker.setListening(true);
|
||||
mHasMobileData = hasMobileData;
|
||||
if (wifiManager != null) {
|
||||
wifiManager.registerTrafficStateCallback(new WifiTrafficStateCallback());
|
||||
}
|
||||
// WiFi only has one state.
|
||||
mCurrentState.iconGroup = mLastState.iconGroup = new IconGroup(
|
||||
"Wi-Fi Icons",
|
||||
@@ -127,10 +128,6 @@ public class WifiSignalController extends
|
||||
notifyListenersIfNecessary();
|
||||
}
|
||||
|
||||
public void handleBootCompleted() {
|
||||
mWifiManager.registerTrafficStateCallback(new WifiTrafficStateCallback());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler to receive the data activity on wifi.
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,6 @@ public class HotspotControllerImplTest extends SysuiTestCase {
|
||||
any(WifiManager.SoftApCallback.class));
|
||||
|
||||
mController = new HotspotControllerImpl(mContext, new Handler(mLooper.getLooper()));
|
||||
mController.handleSetListening(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,10 +25,6 @@ public class FakeHotspotController extends BaseLeakChecker<Callback> implements
|
||||
super(test, "hotspot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSetListening(boolean listening) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHotspotEnabled() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user