Merge "[Provider Model] Should show "Connected" and highlight carrier layout as well if connected to W+" into sc-qpr1-dev

This commit is contained in:
Zoey Chen
2021-09-21 14:47:45 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 12 deletions

View File

@@ -303,7 +303,8 @@ public class InternetDialog extends SystemUIDialog implements
mInternetDialogSubTitle.setText(getSubtitleText());
}
updateEthernet();
setMobileDataLayout(mInternetDialogController.activeNetworkIsCellular());
setMobileDataLayout(mInternetDialogController.activeNetworkIsCellular()
|| mInternetDialogController.isCarrierNetworkActive());
if (!mCanConfigWifi) {
return;
@@ -355,7 +356,7 @@ public class InternetDialog extends SystemUIDialog implements
mInternetDialogController.hasEthernet() ? View.VISIBLE : View.GONE);
}
private void setMobileDataLayout(boolean isCellularNetwork) {
private void setMobileDataLayout(boolean isCarrierNetworkConnected) {
if (mInternetDialogController.isAirplaneModeEnabled()
|| !mInternetDialogController.hasCarrier()) {
mMobileNetworkLayout.setVisibility(View.GONE);
@@ -371,13 +372,13 @@ public class InternetDialog extends SystemUIDialog implements
mMobileSummaryText.setVisibility(View.GONE);
}
mSignalIcon.setImageDrawable(getSignalStrengthDrawable());
mMobileTitleText.setTextAppearance(isCellularNetwork
mMobileTitleText.setTextAppearance(isCarrierNetworkConnected
? R.style.TextAppearance_InternetDialog_Active
: R.style.TextAppearance_InternetDialog);
mMobileSummaryText.setTextAppearance(isCellularNetwork
mMobileSummaryText.setTextAppearance(isCarrierNetworkConnected
? R.style.TextAppearance_InternetDialog_Secondary_Active
: R.style.TextAppearance_InternetDialog_Secondary);
mMobileNetworkLayout.setBackground(isCellularNetwork ? mBackgroundOn : null);
mMobileNetworkLayout.setBackground(isCarrierNetworkConnected ? mBackgroundOn : null);
mMobileDataToggle.setVisibility(mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE);
}

View File

@@ -370,9 +370,12 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
drawable = shared.get();
}
drawable.setTint(activeNetworkIsCellular() ? mContext.getColor(
R.color.connected_network_primary_color) : Utils.getColorAttrDefaultColor(
mContext, android.R.attr.textColorTertiary));
int tintColor = Utils.getColorAttrDefaultColor(mContext,
android.R.attr.textColorTertiary);
if (activeNetworkIsCellular() || isCarrierNetworkActive()) {
tintColor = mContext.getColor(R.color.connected_network_primary_color);
}
drawable.setTint(tintColor);
} catch (Throwable e) {
e.printStackTrace();
}
@@ -533,9 +536,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
}
int resId = mapIconSets(config).get(iconKey).dataContentDescription;
final MergedCarrierEntry mergedCarrierEntry =
mAccessPointController.getMergedCarrierEntry();
if (mergedCarrierEntry != null && mergedCarrierEntry.isDefaultNetwork()) {
if (isCarrierNetworkActive()) {
SignalIcon.MobileIconGroup carrierMergedWifiIconGroup =
TelephonyIcons.CARRIER_MERGED_WIFI;
resId = carrierMergedWifiIconGroup.dataContentDescription;
@@ -554,7 +555,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
return context.getString(R.string.mobile_data_no_connection);
}
String summary = networkTypeDescription;
if (activeNetworkIsCellular()) {
if (activeNetworkIsCellular() || isCarrierNetworkActive()) {
summary = context.getString(R.string.preference_summary_default_combination,
context.getString(R.string.mobile_data_connection_active),
networkTypeDescription);
@@ -583,6 +584,12 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
}
}
boolean isCarrierNetworkActive() {
final MergedCarrierEntry mergedCarrierEntry =
mAccessPointController.getMergedCarrierEntry();
return mergedCarrierEntry != null && mergedCarrierEntry.isDefaultNetwork();
}
WifiManager getWifiManager() {
return mWifiManager;
}