Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83920743 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Provider Model] Show "!" icon when Wi-Fi is not validated (panel)" into sc-dev

parents 0f867340 a0d4c657
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.settings.network.telephony.NetworkProviderWorker;
import com.android.settings.slices.CustomSliceable;
import com.android.settings.slices.SliceBackgroundWorker;
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.WifiSliceItem;
import com.android.wifitrackerlib.WifiEntry;
@@ -255,7 +256,8 @@ public class ProviderModelSlice extends WifiSlice {
            final @ColorInt int tint = Utils.getColorAttrDefaultColor(mContext,
                    android.R.attr.colorControlNormal);
            final Drawable drawable = mContext.getDrawable(
                    Utils.getWifiIconResource(wifiSliceItem.getLevel()));
                    WifiUtils.getInternetIconResource(
                            wifiSliceItem.getLevel(), wifiSliceItem.shouldShowXLevelIcon()));
            drawable.setTint(tint);
            return Utils.createIconWithDrawable(drawable);
        }
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ import com.android.wifitrackerlib.WifiEntry;

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_MAX_LENGTH = 32;
+3 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.settings.slices.SliceBackgroundWorker;
import com.android.settings.slices.SliceBuilderUtils;
import com.android.settings.wifi.WifiDialogActivity;
import com.android.settings.wifi.WifiSettings;
import com.android.settings.wifi.WifiUtils;
import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
import com.android.wifitrackerlib.WifiEntry;

@@ -176,7 +177,8 @@ public class WifiSlice implements CustomSliceable {
        }

        final Drawable drawable = mContext.getDrawable(
                com.android.settingslib.Utils.getWifiIconResource(wifiSliceItem.getLevel()));
                WifiUtils.getInternetIconResource(wifiSliceItem.getLevel(),
                        wifiSliceItem.shouldShowXLevelIcon()));
        drawable.setTint(tint);
        return Utils.createIconWithDrawable(drawable);
    }
+12 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public class WifiSliceItem {
    private final int mSecurity;
    private final int mConnectedState;
    private final int mLevel;
    private final boolean mShouldShowXLevelIcon;
    private final boolean mShouldEditBeforeConnect;
    private final String mSummary;

@@ -53,6 +54,7 @@ public class WifiSliceItem {
        mSecurity = wifiEntry.getSecurity();
        mConnectedState = wifiEntry.getConnectedState();
        mLevel = wifiEntry.getLevel();
        mShouldShowXLevelIcon = wifiEntry.shouldShowXLevelIcon();
        mShouldEditBeforeConnect = wifiEntry.shouldEditBeforeConnect();
        mSummary = wifiEntry.getSummary(false /* concise */);
    }
@@ -73,6 +75,9 @@ public class WifiSliceItem {
        if (getLevel() != otherItem.getLevel()) {
            return false;
        }
        if (shouldShowXLevelIcon() != otherItem.shouldShowXLevelIcon()) {
            return false;
        }
        if (!TextUtils.equals(getSummary(), otherItem.getSummary())) {
            return false;
        }
@@ -99,6 +104,13 @@ public class WifiSliceItem {
        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.
     * However, for some special cases, Wi-Fi picker should show Wi-Fi editor UI for users to edit