Fix Wi-Fi Settings Guest mode UI.
Progress bar should not show in guest mode when onViewCreated. When Wi-Fi is off, Wi-Fi OFF tip should be shown even in guest mode to be consistent with Wi-Fi status. Bug: 35627922 Test: tracked in b/35324506 Change-Id: If89728e293721cea45dcd717316d87f6df17ea7c
This commit is contained in:
@@ -178,9 +178,8 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
if (!isUiRestricted()) {
|
mProgressHeader = (ProgressBar) setPinnedHeaderView(R.layout.wifi_progress_header);
|
||||||
mProgressHeader = (ProgressBar) setPinnedHeaderView(R.layout.wifi_progress_header);
|
setProgressBarVisible(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,15 +613,19 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
public void onAccessPointsChanged() {
|
public void onAccessPointsChanged() {
|
||||||
// Safeguard from some delayed event handling
|
// Safeguard from some delayed event handling
|
||||||
if (getActivity() == null) return;
|
if (getActivity() == null) return;
|
||||||
|
final int wifiState = mWifiManager.getWifiState();
|
||||||
if (isUiRestricted()) {
|
if (isUiRestricted()) {
|
||||||
removeConnectedAccessPointPreference();
|
removeConnectedAccessPointPreference();
|
||||||
mAccessPointsPreferenceCategory.removeAll();
|
mAccessPointsPreferenceCategory.removeAll();
|
||||||
if (!isUiRestrictedByOnlyAdmin()) {
|
if (!isUiRestrictedByOnlyAdmin()) {
|
||||||
addMessagePreference(R.string.wifi_empty_list_user_restricted);
|
if (wifiState == WifiManager.WIFI_AP_STATE_DISABLED) {
|
||||||
|
setOffMessage();
|
||||||
|
} else {
|
||||||
|
addMessagePreference(R.string.wifi_empty_list_user_restricted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int wifiState = mWifiManager.getWifiState();
|
|
||||||
|
|
||||||
switch (wifiState) {
|
switch (wifiState) {
|
||||||
case WifiManager.WIFI_STATE_ENABLED:
|
case WifiManager.WIFI_STATE_ENABLED:
|
||||||
@@ -801,22 +804,13 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setOffMessage() {
|
private void setOffMessage() {
|
||||||
if (isUiRestricted()) {
|
|
||||||
removeConnectedAccessPointPreference();
|
|
||||||
mAccessPointsPreferenceCategory.removeAll();
|
|
||||||
if (!isUiRestrictedByOnlyAdmin()) {
|
|
||||||
addMessagePreference(R.string.wifi_empty_list_user_restricted);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
|
final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
|
||||||
|
|
||||||
// Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
|
// Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
|
||||||
// read the system settings directly. Because when the device is in Airplane mode, even if
|
// read the system settings directly. Because when the device is in Airplane mode, even if
|
||||||
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
|
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
|
||||||
final ContentResolver resolver = getActivity().getContentResolver();
|
final ContentResolver resolver = getActivity().getContentResolver();
|
||||||
final boolean wifiScanningMode = Settings.Global.getInt(
|
final boolean wifiScanningMode = !isUiRestricted() && Settings.Global.getInt(
|
||||||
resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
||||||
|
|
||||||
if (!wifiScanningMode) {
|
if (!wifiScanningMode) {
|
||||||
@@ -850,7 +844,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
protected void setProgressBarVisible(boolean visible) {
|
protected void setProgressBarVisible(boolean visible) {
|
||||||
if (mProgressHeader != null) {
|
if (mProgressHeader != null) {
|
||||||
mProgressHeader.setVisibility(visible ? View.VISIBLE : View.GONE);
|
mProgressHeader.setVisibility(visible && !isUiRestricted() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user