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

Commit 19f64d08 authored by Sundeep Ghuman's avatar Sundeep Ghuman
Browse files

Remove Wifi Badges from platform.

This change makes it impossible to return a badged wifi icon, even if
scoring ui is enabled. It also prevents IAE from net badgecurve enums.

Bug: b/35628911
Test: make -j40
Change-Id: I014f27e5c4e42075e7e62da7fffb9ecf38f6eb4c
parent 08b953dd
Loading
Loading
Loading
Loading
+1 −36
Original line number Diff line number Diff line
@@ -66,15 +66,7 @@ public class NetworkBadging {
     */
    @NonNull public static Drawable getWifiIcon(
            @IntRange(from=0, to=4) int signalLevel, @Badging int badging, @Nullable Theme theme) {
        Resources resources = Resources.getSystem();
        if (badging == BADGING_NONE) {
            return resources.getDrawable(getWifiSignalResource(signalLevel), theme);
        }
        Drawable[] layers = new Drawable[] {
                resources.getDrawable(getBadgedWifiSignalResource(signalLevel), theme),
                resources.getDrawable(getWifiBadgeResource(badging), theme)
        };
        return new LayerDrawable(layers);
        return Resources.getSystem().getDrawable(getWifiSignalResource(signalLevel), theme);
    }

    /**
@@ -134,31 +126,4 @@ public class NetworkBadging {
                throw new IllegalArgumentException("Invalid signal level: " + signalLevel);
        }
    }

    /**
     * Returns the wifi quality badge resource id for the the given badging balue.
     *
     * <p>This badge should be displayed with the badge signal resource retrieved from
     * {@link #getBadgedWifiSignalResource(int)}.
     *
     * @param badging {@see NetworkBadging#Badging} from {@link ScoredNetwork#calculateBadge(int)}.
     * @return the @DrawableRes for the icon or {@link View#NO_ID} for
     *         {@link NetworkBadging#BADGING_NONE}
     * @throws IllegalArgumentException for an invalid badging value.
     * @hide
     */
    @DrawableRes private static int getWifiBadgeResource(@Badging int badging) {
        switch (badging) {
            case BADGING_NONE:
                return View.NO_ID;
            case BADGING_SD:
                return com.android.internal.R.drawable.ic_signal_wifi_badged_sd;
            case BADGING_HD:
                return com.android.internal.R.drawable.ic_signal_wifi_badged_hd;
            case BADGING_4K:
                return com.android.internal.R.drawable.ic_signal_wifi_badged_4k;
            default:
                throw new IllegalArgumentException("No resource found for badge: " + badging);
        }
    }
}