diff options
author | Danny Lin <danny@kdrag0n.dev> | 2021-10-25 19:32:33 -0700 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-01-26 11:42:56 +0800 |
commit | f9ba29915825363d46b31bfd975aab67d158a531 (patch) | |
tree | 6414110544adb5df4e72c8ed0ba00bae02eb97c3 | |
parent | 18c95ca7c9e8d7397510e4f3a5a25707f8d3ab52 (diff) |
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.
Change-Id: I10af134b35dfabdb9275f1aca8ca8512e1db6d27
4 files changed, 37 insertions, 58 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java index cc9e7485dcff..4bf8053017f1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java @@ -255,7 +255,7 @@ public class InternetTile extends QSTileImpl<SignalState> { Log.d(TAG, "setWifiIndicators: " + indicators); } mWifiInfo.mEnabled = indicators.enabled; - if (indicators.qsIcon == null) { + if (indicators.qsIcon == null || !indicators.isDefault) { return; } mWifiInfo.mConnected = indicators.qsIcon.visible; @@ -275,7 +275,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; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 0779be42b7f4..9027a77ea9f5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -528,7 +528,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile IconState qsIcon = null; CharSequence description = null; // Only send data sim callbacks to QS. - if (mCurrentState.dataSim && mCurrentState.isDefault) { + if (mCurrentState.dataSim) { qsTypeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0; qsIcon = new IconState(mCurrentState.enabled @@ -552,7 +552,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile statusIcon, qsIcon, typeIcon, qsTypeIcon, activityIn, activityOut, volteIcon, dataContentDescription, dataContentDescriptionHtml, description, icons.isWide, mSubscriptionInfo.getSubscriptionId(), - mCurrentState.roaming, showTriangle); + mCurrentState.roaming, showTriangle, mCurrentState.isDefault); callback.setMobileDataIndicators(mobileDataIndicators); } else { boolean showDataIcon = mCurrentState.dataConnected || dataDisabled; @@ -563,25 +563,13 @@ public class MobileSignalController extends SignalController<MobileState, Mobile int qsTypeIcon = 0; IconState qsIcon = null; CharSequence description = null; - // Only send data sim callbacks to QS. - if (mProviderModelSetting) { - if (mCurrentState.dataSim && mCurrentState.isDefault) { - qsTypeIcon = - (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0; - qsIcon = new IconState( - mCurrentState.enabled && !mCurrentState.isEmergency, - getQsCurrentIconId(), contentDescription); - description = mCurrentState.isEmergency ? null : mCurrentState.networkName; - } - } else { - if (mCurrentState.dataSim) { - qsTypeIcon = - (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0; - qsIcon = new IconState( - mCurrentState.enabled && !mCurrentState.isEmergency, - getQsCurrentIconId(), contentDescription); - description = mCurrentState.isEmergency ? null : mCurrentState.networkName; - } + if (mCurrentState.dataSim) { + qsTypeIcon = + (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0; + qsIcon = new IconState( + mCurrentState.enabled && !mCurrentState.isEmergency, + getQsCurrentIconId(), contentDescription); + description = mCurrentState.isEmergency ? null : mCurrentState.networkName; } boolean activityIn = mCurrentState.dataConnected @@ -625,7 +613,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile statusIcon, qsIcon, typeIcon, qsTypeIcon, activityIn, activityOut, volteIcon, dataContentDescription, dataContentDescriptionHtml, description, icons.isWide, mSubscriptionInfo.getSubscriptionId(), - mCurrentState.roaming, showTriangle); + mCurrentState.roaming, showTriangle, mCurrentState.isDefault); callback.setMobileDataIndicators(mobileDataIndicators); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index be2bf0750d92..b0782c934b91 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -59,10 +59,11 @@ public interface NetworkController extends CallbackController<SignalCallback>, D public String description; public boolean isTransient; public String statusLabel; + public boolean isDefault; public WifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon, boolean activityIn, boolean activityOut, String description, - boolean isTransient, String statusLabel) { + boolean isTransient, String statusLabel, boolean isDefault) { this.enabled = enabled; this.statusIcon = statusIcon; this.qsIcon = qsIcon; @@ -71,6 +72,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D this.description = description; this.isTransient = isTransient; this.statusLabel = statusLabel; + this.isDefault = isDefault; } @Override @@ -84,6 +86,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D .append(",description=").append(description) .append(",isTransient=").append(isTransient) .append(",statusLabel=").append(statusLabel) + .append(",isDefault=").append(isDefault) .append(']').toString(); } } @@ -106,12 +109,13 @@ public interface NetworkController extends CallbackController<SignalCallback>, D public int subId; public boolean roaming; public boolean showTriangle; + public boolean isDefault; public MobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, int qsType, boolean activityIn, boolean activityOut, int volteIcon, CharSequence typeContentDescription, CharSequence typeContentDescriptionHtml, CharSequence description, boolean isWide, int subId, boolean roaming, - boolean showTriangle) { + boolean showTriangle, boolean isDefault) { this.statusIcon = statusIcon; this.qsIcon = qsIcon; this.statusType = statusType; @@ -126,6 +130,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D this.subId = subId; this.roaming = roaming; this.showTriangle = showTriangle; + this.isDefault = isDefault; } @Override @@ -145,6 +150,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D .append(",subId=").append(subId) .append(",roaming=").append(roaming) .append(",showTriangle=").append(showTriangle) + .append(",isDefault=").append(isDefault) .append(']').toString(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java index cb96bd80a90c..bc5a4c435dca 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java @@ -168,37 +168,21 @@ public class WifiSignalController extends if (mCurrentState.inetCondition == 0) { contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet)); } - if (mProviderModelSetting) { - IconState statusIcon = new IconState( - wifiVisible, getCurrentIconId(), contentDescription); - IconState qsIcon = null; - if (mCurrentState.isDefault || (!mNetworkController.isRadioOn() - && !mNetworkController.isEthernetDefault())) { - qsIcon = new IconState(mCurrentState.connected, - mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected - : getQsCurrentIconId(), contentDescription); - } - WifiIndicators wifiIndicators = new WifiIndicators( - mCurrentState.enabled, statusIcon, qsIcon, - ssidPresent && mCurrentState.activityIn, - ssidPresent && mCurrentState.activityOut, - wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel - ); - callback.setWifiIndicators(wifiIndicators); - } else { - IconState statusIcon = new IconState( - wifiVisible, getCurrentIconId(), contentDescription); - IconState qsIcon = new IconState(mCurrentState.connected, - mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected - : getQsCurrentIconId(), contentDescription); - WifiIndicators wifiIndicators = new WifiIndicators( - mCurrentState.enabled, statusIcon, qsIcon, - ssidPresent && mCurrentState.activityIn, - ssidPresent && mCurrentState.activityOut, - wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel - ); - callback.setWifiIndicators(wifiIndicators); - } + IconState statusIcon = new IconState( + wifiVisible, getCurrentIconId(), contentDescription); + 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, + isDefault + ); + callback.setWifiIndicators(wifiIndicators); } private void notifyListenersForCarrierWifi(SignalCallback callback) { @@ -231,7 +215,8 @@ public class WifiSignalController extends statusIcon, qsIcon, typeIcon, qsTypeIcon, mCurrentState.activityIn, mCurrentState.activityOut, volteIcon, dataContentDescription, dataContentDescriptionHtml, description, icons.isWide, - mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true + mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true, + /* isDefault= */ qsIcon != null ); callback.setMobileDataIndicators(mobileDataIndicators); } |