Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad32dbfc authored by Roshan Pius's avatar Roshan Pius
Browse files

Revert "Sysui/WifiTracker: Changes to support late starting wifi service"

This reverts commit e01f30b6.

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
parent ab2703eb
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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;

+0 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ public class HotspotTile extends QSTileImpl<BooleanState> {
        if (listening) {
            refreshState();
        }
        mHotspotController.handleSetListening(listening);
    }

    @Override
+0 −2
Original line number Diff line number Diff line
@@ -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();

+9 −26
Original line number Diff line number Diff line
@@ -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);
                    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.
                    // 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));
                    }
                            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;
+0 −4
Original line number Diff line number Diff line
@@ -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);
Loading