Merge "Show the icons in QS/SB as long as the default is default" into sc-dev

This commit is contained in:
Ying Xu
2021-06-22 14:50:08 +00:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 29 deletions

View File

@@ -387,15 +387,8 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
int qsTypeIcon = 0; int qsTypeIcon = 0;
IconState qsIcon = null; IconState qsIcon = null;
CharSequence description = null; CharSequence description = null;
// Mobile icon will only be shown in the statusbar in 2 scenarios
// 1. Mobile is the default network, and it is validated
// 2. Mobile is the default network, it is not validated and there is no other
// non-Carrier WiFi networks available.
boolean maybeShowIcons = (mCurrentState.inetCondition == 1)
|| (mCurrentState.inetCondition == 0
&& !mNetworkController.isNonCarrierWifiNetworkAvailable());
// Only send data sim callbacks to QS. // Only send data sim callbacks to QS.
if (mCurrentState.dataSim && mCurrentState.isDefault && maybeShowIcons) { if (mCurrentState.dataSim && mCurrentState.isDefault) {
qsTypeIcon = qsTypeIcon =
(showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0; (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.qsDataType : 0;
qsIcon = new IconState(mCurrentState.enabled qsIcon = new IconState(mCurrentState.enabled
@@ -408,7 +401,7 @@ public class MobileSignalController extends SignalController<MobileState, Mobile
boolean activityOut = mCurrentState.dataConnected boolean activityOut = mCurrentState.dataConnected
&& !mCurrentState.carrierNetworkChangeMode && !mCurrentState.carrierNetworkChangeMode
&& mCurrentState.activityOut; && mCurrentState.activityOut;
showDataIcon &= mCurrentState.dataSim && mCurrentState.isDefault && maybeShowIcons; showDataIcon &= mCurrentState.dataSim && mCurrentState.isDefault;
boolean showTriangle = showDataIcon && !mCurrentState.airplaneMode; boolean showTriangle = showDataIcon && !mCurrentState.airplaneMode;
int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0; int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.dataType : 0;
showDataIcon |= mCurrentState.roaming; showDataIcon |= mCurrentState.roaming;

View File

@@ -109,17 +109,10 @@ public class WifiSignalController extends
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet)); contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
} }
if (mProviderModel) { if (mProviderModel) {
// WiFi icon will only be shown in the statusbar in 2 scenarios
// 1. WiFi is the default network, and it is validated
// 2. WiFi is the default network, it is not validated and there is no other
// non-Carrier WiFi networks available.
boolean maybeShowIcons = (mCurrentState.inetCondition == 1)
|| (mCurrentState.inetCondition == 0
&& !mNetworkController.isNonCarrierWifiNetworkAvailable());
IconState statusIcon = new IconState( IconState statusIcon = new IconState(
wifiVisible && maybeShowIcons, getCurrentIconId(), contentDescription); wifiVisible, getCurrentIconId(), contentDescription);
IconState qsIcon = null; IconState qsIcon = null;
if ((mCurrentState.isDefault && maybeShowIcons) || (!mNetworkController.isRadioOn() if (mCurrentState.isDefault || (!mNetworkController.isRadioOn()
&& !mNetworkController.isEthernetDefault())) { && !mNetworkController.isEthernetDefault())) {
qsIcon = new IconState(mCurrentState.connected, qsIcon = new IconState(mCurrentState.connected,
mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected mWifiTracker.isCaptivePortal ? R.drawable.ic_qs_wifi_disconnected
@@ -158,15 +151,8 @@ public class WifiSignalController extends
if (mCurrentState.inetCondition == 0) { if (mCurrentState.inetCondition == 0) {
dataContentDescription = mContext.getString(R.string.data_connection_no_internet); dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
} }
// Mobile icon will only be shown in the statusbar in 2 scenarios
// 1. Mobile is the default network, and it is validated
// 2. Mobile is the default network, it is not validated and there is no other
// non-Carrier WiFi networks available.
boolean maybeShowIcons = (mCurrentState.inetCondition == 1)
|| (mCurrentState.inetCondition == 0
&& !mNetworkController.isNonCarrierWifiNetworkAvailable());
boolean sbVisible = mCurrentState.enabled && mCurrentState.connected boolean sbVisible = mCurrentState.enabled && mCurrentState.connected
&& maybeShowIcons && mCurrentState.isDefault; && mCurrentState.isDefault;
IconState statusIcon = IconState statusIcon =
new IconState(sbVisible, getCurrentIconIdForCarrierWifi(), contentDescription); new IconState(sbVisible, getCurrentIconIdForCarrierWifi(), contentDescription);
int typeIcon = sbVisible ? icons.dataType : 0; int typeIcon = sbVisible ? icons.dataType : 0;

View File

@@ -238,9 +238,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
mNetworkController.setNoNetworksAvailable(false); mNetworkController.setNoNetworksAvailable(false);
setWifiStateForVcn(true, testSsid); setWifiStateForVcn(true, testSsid);
setWifiLevelForVcn(0); setWifiLevelForVcn(0);
// Connected, but still not validated - does not show verifyLastMobileDataIndicatorsForVcn(true, 0, TelephonyIcons.ICON_CWF, false);
//verifyLastWifiIcon(false, WifiIcons.WIFI_SIGNAL_STRENGTH[0][0]);
verifyLastMobileDataIndicatorsForVcn(false, 0, 0, false);
mNetworkController.setNoNetworksAvailable(true); mNetworkController.setNoNetworksAvailable(true);
for (int testLevel = 0; testLevel < WifiIcons.WIFI_LEVEL_COUNT; testLevel++) { for (int testLevel = 0; testLevel < WifiIcons.WIFI_LEVEL_COUNT; testLevel++) {