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

Unverified Commit ece265eb authored by Danny Lin's avatar Danny Lin Committed by Michael Bestas
Browse files

SystemUI: Allow Wi-Fi/cell tiles to co-exist with provider model

The dedicated Wi-Fi/cellular data QS tiles are partially working now
that we've exposed them in the list of tile options, but they're very
buggy and somewhat broken when the provider model (unified internet) is
enabled.

Allow the tiles to co-exist with InternetTile and the provider model
(including both settings_provider_model and combined signal icons) by
always including QS icons in Wi-Fi/data indicator callbacks, and add
a new flag to indicate whether they should be shown in the internet
tile.

(cdesai, mkbestas: Port to 12L)

Change-Id: I10af134b35dfabdb9275f1aca8ca8512e1db6d27
parent 4aa4a602
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -310,6 +310,9 @@ public class InternetTile extends QSTileImpl<SignalState> {
            if (DEBUG) {
                Log.d(TAG, "setWifiIndicators: " + indicators);
            }
            if (!indicators.isDefault) {
                return;
            }
            synchronized (mWifiInfo) {
                mWifiInfo.mEnabled = indicators.enabled;
                mWifiInfo.mSsid = indicators.description;
@@ -335,7 +338,7 @@ public class InternetTile extends QSTileImpl<SignalState> {
            if (DEBUG) {
                Log.d(TAG, "setMobileDataIndicators: " + indicators);
            }
            if (indicators.qsIcon == null) {
            if (indicators.qsIcon == null || !indicators.isDefault) {
                // Not data sim, don't display.
                return;
            }
+2 −6
Original line number Diff line number Diff line
@@ -289,7 +289,8 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
                qsInfo.description,
                mSubscriptionInfo.getSubscriptionId(),
                mCurrentState.roaming,
                sbInfo.showTriangle);
                sbInfo.showTriangle,
                mCurrentState.isDefault);
        callback.setMobileDataIndicators(mobileDataIndicators);
    }

@@ -299,11 +300,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
        CharSequence qsDescription = null;

        if (mCurrentState.dataSim) {
            // only show QS icons if the state is also default
            if (!mCurrentState.isDefault) {
                return new QsInfo(qsTypeIcon, qsIcon, qsDescription);
            }

            if (mCurrentState.showQuickSettingsRatIcon() || mConfig.alwaysShowDataRatIcon) {
                qsTypeIcon = dataTypeIcon;
            }
+6 −2
Original line number Diff line number Diff line
@@ -122,7 +122,8 @@ data class WifiIndicators(
    @JvmField val activityOut: Boolean,
    @JvmField val description: String?,
    @JvmField val isTransient: Boolean,
    @JvmField val statusLabel: String?
    @JvmField val statusLabel: String?,
    @JvmField val isDefault: Boolean
) {
    override fun toString(): String {
        return StringBuilder("WifiIndicators[")
@@ -134,6 +135,7 @@ data class WifiIndicators(
                .append(",qsDescription=").append(description)
                .append(",isTransient=").append(isTransient)
                .append(",statusLabel=").append(statusLabel)
                .append(",isDefault=").append(isDefault)
                .append(']').toString()
    }
}
@@ -151,7 +153,8 @@ data class MobileDataIndicators(
    @JvmField val qsDescription: CharSequence?,
    @JvmField val subId: Int,
    @JvmField val roaming: Boolean,
    @JvmField val showTriangle: Boolean
    @JvmField val showTriangle: Boolean,
    @JvmField val isDefault: Boolean
) {
    override fun toString(): String {
        return java.lang.StringBuilder("MobileDataIndicators[")
@@ -167,6 +170,7 @@ data class MobileDataIndicators(
                .append(",subId=").append(subId)
                .append(",roaming=").append(roaming)
                .append(",showTriangle=").append(showTriangle)
                .append(",isDefault=").append(isDefault)
                .append(']').toString()
    }
}
+8 −9
Original line number Diff line number Diff line
@@ -112,18 +112,16 @@ public class WifiSignalController extends SignalController<WifiState, IconGroup>
        }
        IconState statusIcon = new IconState(
                wifiVisible, getCurrentIconId(), contentDescription);
        IconState qsIcon = null;
        if (mCurrentState.isDefault || (!mNetworkController.isRadioOn()
                && !mNetworkController.isEthernetDefault())) {
            qsIcon = new IconState(mCurrentState.connected,
        IconState qsIcon = new IconState(mCurrentState.connected,
                mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
                        : getQsCurrentIconId(), contentDescription);
        }
        boolean isDefault = mCurrentState.isDefault || (!mNetworkController.isRadioOn()
                && !mNetworkController.isEthernetDefault());
        WifiIndicators wifiIndicators = new WifiIndicators(
                mCurrentState.enabled, statusIcon, qsIcon,
                ssidPresent && mCurrentState.activityIn,
                ssidPresent && mCurrentState.activityOut,
                wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel
                wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel, isDefault
        );
        callback.setWifiIndicators(wifiIndicators);
    }
@@ -156,7 +154,8 @@ public class WifiSignalController extends SignalController<WifiState, IconGroup>
                statusIcon, qsIcon, typeIcon, qsTypeIcon,
                mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
                dataContentDescriptionHtml, description,
                mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
                mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true,
                /* isDefault= */ qsIcon != null
        );
        callback.setMobileDataIndicators(mobileDataIndicators);
    }
+3 −3
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class CastTileTest extends SysuiTestCase {
        WifiIndicators indicators = new WifiIndicators(
                false, mock(IconState.class),
                qsIcon, false, false, "",
                false, "");
                false, "", true);
        mSignalCallback.setWifiIndicators(indicators);
        mTestableLooper.processAllMessages();

@@ -161,7 +161,7 @@ public class CastTileTest extends SysuiTestCase {
        WifiIndicators indicators = new WifiIndicators(
                true, mock(IconState.class),
                qsIcon, false, false, "",
                false, "");
                false, "", true);
        mSignalCallback.setWifiIndicators(indicators);
        mTestableLooper.processAllMessages();

@@ -173,7 +173,7 @@ public class CastTileTest extends SysuiTestCase {
        WifiIndicators indicators = new WifiIndicators(
                true, mock(IconState.class),
                qsIcon, false, false, "",
                false, "");
                false, "", true);
        mSignalCallback.setWifiIndicators(indicators);
        mTestableLooper.processAllMessages();
    }
Loading