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

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

Merge "Show WiFi minimum level when the Wi-Fi level is UNREACHABLE"

parents ce71a7bb 673f06c2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.wifi.WifiUtils;
import com.android.wifitrackerlib.WifiEntry;
import com.android.wifitrackerlib.WifiPickerTracker;

@@ -419,8 +420,7 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
            return;
        }
        // TODO: Check level of the network to show signal icon.
        final Drawable wifiIcon = mActivity.getDrawable(
                Utils.getWifiIconResource(level)).mutate();
        final Drawable wifiIcon = mActivity.getDrawable(getWifiIconResource(level)).mutate();
        final Drawable wifiIconDark = wifiIcon.getConstantState().newDrawable().mutate();
        wifiIconDark.setTintList(
                Utils.getColorAttr(mActivity, android.R.attr.colorControlNormal));
@@ -566,8 +566,7 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
            final PreferenceImageView imageView = view.findViewById(android.R.id.icon);
            if (imageView != null) {
                final Drawable drawable = getContext().getDrawable(
                        com.android.settingslib.Utils.getWifiIconResource(
                                uiConfigurationItem.mLevel));
                        getWifiIconResource(uiConfigurationItem.mLevel));
                drawable.setTintList(
                        com.android.settingslib.Utils.getColorAttr(getContext(),
                                android.R.attr.colorControlNormal));
@@ -755,8 +754,6 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
        }
    }



    @VisibleForTesting
    void updateScanResultsToUi() {
        if (mUiToRequestedList == null) {
@@ -825,4 +822,9 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
    public void onNumSavedNetworksChanged() {
        // Do nothing.
    }

    @VisibleForTesting
    static int getWifiIconResource(int level) {
        return WifiUtils.getInternetIconResource(level, false /* noInternet */);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -485,6 +485,11 @@ public class AddAppNetworksFragmentTest {
        assertThat(item.mDisplayedSsid).isEqualTo(FAKE_NEW_WPA_SSID);
    }

    @Test
    public void getWifiIconResource_wifiLevelIsUnreachable_shouldNotCrash() {
        AddAppNetworksFragment.getWifiIconResource(WifiEntry.WIFI_LEVEL_UNREACHABLE);
    }

    private void setUpOneScannedNetworkWithScanedLevel4() {
        final ArrayList list = new ArrayList<>();
        list.add(mWifiEntry);