246 lines
13 KiB
Diff
246 lines
13 KiB
Diff
From 48d242260887d95b592b8796fce1176d334394d0 Mon Sep 17 00:00:00 2001
|
|
From: Danny Lin <danny@kdrag0n.dev>
|
|
Date: Mon, 25 Oct 2021 19:32:33 -0700
|
|
Subject: [PATCH 21/21] 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
|
|
---
|
|
.../systemui/qs/tiles/InternetTile.java | 4 +-
|
|
.../policy/MobileSignalController.java | 32 ++++--------
|
|
.../statusbar/policy/NetworkController.java | 10 +++-
|
|
.../policy/WifiSignalController.java | 49 +++++++------------
|
|
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 7cb1421e3f0f..aa917d9ec397 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java
|
|
@@ -245,7 +245,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;
|
|
@@ -265,7 +265,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 43781f3941ba..cf89cabf6ab9 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
|
|
@@ -397,7 +397,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
|
|
@@ -420,7 +420,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
|
activityIn, activityOut, dataContentDescription, dataContentDescriptionHtml,
|
|
description, icons.isWide, mSubscriptionInfo.getSubscriptionId(),
|
|
- mCurrentState.roaming, showTriangle);
|
|
+ mCurrentState.roaming, showTriangle, mCurrentState.isDefault);
|
|
callback.setMobileDataIndicators(mobileDataIndicators);
|
|
} else {
|
|
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
|
@@ -431,25 +431,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
|
|
@@ -465,7 +453,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
|
|
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
|
activityIn, activityOut, 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 ef2ca985858d..39fa68cab281 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
|
|
@@ -58,10 +58,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;
|
|
@@ -70,6 +71,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|
this.description = description;
|
|
this.isTransient = isTransient;
|
|
this.statusLabel = statusLabel;
|
|
+ this.isDefault = isDefault;
|
|
}
|
|
|
|
@Override
|
|
@@ -83,6 +85,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();
|
|
}
|
|
}
|
|
@@ -104,12 +107,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,
|
|
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;
|
|
@@ -123,6 +127,7 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
|
this.subId = subId;
|
|
this.roaming = roaming;
|
|
this.showTriangle = showTriangle;
|
|
+ this.isDefault = isDefault;
|
|
}
|
|
|
|
@Override
|
|
@@ -141,6 +146,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 f8e36476c4a6..1513544eb22b 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
|
|
@@ -112,37 +112,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) {
|
|
@@ -173,7 +157,8 @@ public class WifiSignalController extends
|
|
statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
|
mCurrentState.activityIn, mCurrentState.activityOut, dataContentDescription,
|
|
dataContentDescriptionHtml, description, icons.isWide,
|
|
- mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true
|
|
+ mCurrentState.subId, /* roaming= */ false, /* showTriangle= */ true,
|
|
+ /* isDefault= */ qsIcon != null
|
|
);
|
|
callback.setMobileDataIndicators(mobileDataIndicators);
|
|
}
|
|
--
|
|
2.25.1
|
|
|