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

Commit 77a64024 authored by nift4's avatar nift4
Browse files

SystemUI: Enable cast tile without Wi-Fi connection

* Match Settings behaviour
* Miracast does not need Wi-Fi connection, it's Wi-Fi Direct

Change-Id: I46c1394f35f993875beaaad547c9709a4355a342
parent e8fc948c
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -78,8 +78,8 @@ public class CastTile extends QSTileImpl<BooleanState> {
    private final NetworkController mNetworkController;
    private final DialogLaunchAnimator mDialogLaunchAnimator;
    private final Callback mCallback = new Callback();
    private boolean mWifiConnected;
    private boolean mHotspotConnected;
    private boolean mWifiEnabled;
    private boolean mHotspotEnabled;

    @Inject
    public CastTile(
@@ -288,19 +288,17 @@ public class CastTile extends QSTileImpl<BooleanState> {
    }

    private boolean canCastToWifi() {
        return mWifiConnected || mHotspotConnected;
        return mWifiEnabled || mHotspotEnabled;
    }

    private final SignalCallback mSignalCallback = new SignalCallback() {
                @Override
                public void setWifiIndicators(@NonNull WifiIndicators indicators) {
                    // statusIcon.visible has the connected status information
                    boolean enabledAndConnected = indicators.enabled
                            && (indicators.qsIcon == null ? false : indicators.qsIcon.visible);
                    if (enabledAndConnected != mWifiConnected) {
                        mWifiConnected = enabledAndConnected;
                        // Hotspot is not connected, so changes here should update
                        if (!mHotspotConnected) {
                    boolean enabled = indicators.enabled;
                    if (enabled != mWifiEnabled) {
                        mWifiEnabled = enabled;
                        // Hotspot is not enabled, so changes here should update
                        if (!mHotspotEnabled) {
                            refreshState();
                        }
                    }
@@ -311,11 +309,10 @@ public class CastTile extends QSTileImpl<BooleanState> {
            new HotspotController.Callback() {
                @Override
                public void onHotspotChanged(boolean enabled, int numDevices) {
                    boolean enabledAndConnected = enabled && numDevices > 0;
                    if (enabledAndConnected != mHotspotConnected) {
                        mHotspotConnected = enabledAndConnected;
                        // Wifi is not connected, so changes here should update
                        if (!mWifiConnected) {
                    if (enabled != mHotspotEnabled) {
                        mHotspotEnabled = enabled;
                        // Wifi is not enabled, so changes here should update
                        if (!mWifiEnabled) {
                            refreshState();
                        }
                    }