[Provider Model] Show "!" icon when Wi-Fi is not validated (panel)
- Screenshot: https://screenshot.googleplex.com/BLNcfXiJFnuoT9N Bug: 185454486 Bug: 185637977 Bug: 186543071 Test: manual test atest -c ProviderModelSliceTest make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest Change-Id: Idff6bb8b394db5553cf399d2020aa28d9dedfc74
This commit is contained in:
@@ -43,6 +43,7 @@ import com.android.settings.network.telephony.NetworkProviderWorker;
|
|||||||
import com.android.settings.slices.CustomSliceable;
|
import com.android.settings.slices.CustomSliceable;
|
||||||
import com.android.settings.slices.SliceBackgroundWorker;
|
import com.android.settings.slices.SliceBackgroundWorker;
|
||||||
import com.android.settings.slices.SliceBuilderUtils;
|
import com.android.settings.slices.SliceBuilderUtils;
|
||||||
|
import com.android.settings.wifi.WifiUtils;
|
||||||
import com.android.settings.wifi.slice.WifiSlice;
|
import com.android.settings.wifi.slice.WifiSlice;
|
||||||
import com.android.settings.wifi.slice.WifiSliceItem;
|
import com.android.settings.wifi.slice.WifiSliceItem;
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
import com.android.wifitrackerlib.WifiEntry;
|
||||||
@@ -255,7 +256,8 @@ public class ProviderModelSlice extends WifiSlice {
|
|||||||
final @ColorInt int tint = Utils.getColorAttrDefaultColor(mContext,
|
final @ColorInt int tint = Utils.getColorAttrDefaultColor(mContext,
|
||||||
android.R.attr.colorControlNormal);
|
android.R.attr.colorControlNormal);
|
||||||
final Drawable drawable = mContext.getDrawable(
|
final Drawable drawable = mContext.getDrawable(
|
||||||
Utils.getWifiIconResource(wifiSliceItem.getLevel()));
|
WifiUtils.getInternetIconResource(
|
||||||
|
wifiSliceItem.getLevel(), wifiSliceItem.shouldShowXLevelIcon()));
|
||||||
drawable.setTint(tint);
|
drawable.setTint(tint);
|
||||||
return Utils.createIconWithDrawable(drawable);
|
return Utils.createIconWithDrawable(drawable);
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,8 @@ import com.android.wifitrackerlib.WifiEntry;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class WifiUtils {
|
/** A utility class for Wi-Fi functions. */
|
||||||
|
public class WifiUtils extends com.android.settingslib.wifi.WifiUtils {
|
||||||
|
|
||||||
private static final int SSID_ASCII_MIN_LENGTH = 1;
|
private static final int SSID_ASCII_MIN_LENGTH = 1;
|
||||||
private static final int SSID_ASCII_MAX_LENGTH = 32;
|
private static final int SSID_ASCII_MAX_LENGTH = 32;
|
||||||
|
@@ -49,6 +49,7 @@ import com.android.settings.slices.SliceBackgroundWorker;
|
|||||||
import com.android.settings.slices.SliceBuilderUtils;
|
import com.android.settings.slices.SliceBuilderUtils;
|
||||||
import com.android.settings.wifi.WifiDialogActivity;
|
import com.android.settings.wifi.WifiDialogActivity;
|
||||||
import com.android.settings.wifi.WifiSettings;
|
import com.android.settings.wifi.WifiSettings;
|
||||||
|
import com.android.settings.wifi.WifiUtils;
|
||||||
import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
|
import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
import com.android.wifitrackerlib.WifiEntry;
|
||||||
|
|
||||||
@@ -176,7 +177,8 @@ public class WifiSlice implements CustomSliceable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Drawable drawable = mContext.getDrawable(
|
final Drawable drawable = mContext.getDrawable(
|
||||||
com.android.settingslib.Utils.getWifiIconResource(wifiSliceItem.getLevel()));
|
WifiUtils.getInternetIconResource(wifiSliceItem.getLevel(),
|
||||||
|
wifiSliceItem.shouldShowXLevelIcon()));
|
||||||
drawable.setTint(tint);
|
drawable.setTint(tint);
|
||||||
return Utils.createIconWithDrawable(drawable);
|
return Utils.createIconWithDrawable(drawable);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ public class WifiSliceItem {
|
|||||||
private final int mSecurity;
|
private final int mSecurity;
|
||||||
private final int mConnectedState;
|
private final int mConnectedState;
|
||||||
private final int mLevel;
|
private final int mLevel;
|
||||||
|
private final boolean mShouldShowXLevelIcon;
|
||||||
private final boolean mShouldEditBeforeConnect;
|
private final boolean mShouldEditBeforeConnect;
|
||||||
private final String mSummary;
|
private final String mSummary;
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ public class WifiSliceItem {
|
|||||||
mSecurity = wifiEntry.getSecurity();
|
mSecurity = wifiEntry.getSecurity();
|
||||||
mConnectedState = wifiEntry.getConnectedState();
|
mConnectedState = wifiEntry.getConnectedState();
|
||||||
mLevel = wifiEntry.getLevel();
|
mLevel = wifiEntry.getLevel();
|
||||||
|
mShouldShowXLevelIcon = wifiEntry.shouldShowXLevelIcon();
|
||||||
mShouldEditBeforeConnect = wifiEntry.shouldEditBeforeConnect();
|
mShouldEditBeforeConnect = wifiEntry.shouldEditBeforeConnect();
|
||||||
mSummary = wifiEntry.getSummary(false /* concise */);
|
mSummary = wifiEntry.getSummary(false /* concise */);
|
||||||
}
|
}
|
||||||
@@ -73,6 +75,9 @@ public class WifiSliceItem {
|
|||||||
if (getLevel() != otherItem.getLevel()) {
|
if (getLevel() != otherItem.getLevel()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (shouldShowXLevelIcon() != otherItem.shouldShowXLevelIcon()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!TextUtils.equals(getSummary(), otherItem.getSummary())) {
|
if (!TextUtils.equals(getSummary(), otherItem.getSummary())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -99,6 +104,13 @@ public class WifiSliceItem {
|
|||||||
return mLevel;
|
return mLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the level icon for this network should show an X or not.
|
||||||
|
*/
|
||||||
|
public boolean shouldShowXLevelIcon() {
|
||||||
|
return mShouldShowXLevelIcon;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In Wi-Fi picker, when users click a saved network, it will connect to the Wi-Fi network.
|
* In Wi-Fi picker, when users click a saved network, it will connect to the Wi-Fi network.
|
||||||
* However, for some special cases, Wi-Fi picker should show Wi-Fi editor UI for users to edit
|
* However, for some special cases, Wi-Fi picker should show Wi-Fi editor UI for users to edit
|
||||||
|
Reference in New Issue
Block a user