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

Commit f40f71cc authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Replace isWeaklyValidatedHostname with guava

The guava implementation is more accurate than the basic NetworkUtils
implementation.
NetworkUtils is being moved to its own JAR and will not be available
from Settings.

Bug: 174436414
Test: m
      Wrote test for isWeaklyValidatedHostname, verified it passes with
      guava
Change-Id: I1d01f2beba36009e17f651652e2d7f57be5aa398
parent 4d181cc0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.NetworkUtils;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -56,6 +55,8 @@ import com.android.settingslib.HelpUtils;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal;

import com.google.common.net.InternetDomainName;

import java.util.HashMap;
import java.util.Map;

@@ -278,7 +279,7 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
        final Button saveButton = getSaveButton();
        if (saveButton != null) {
            saveButton.setEnabled(modeProvider
                    ? NetworkUtils.isWeaklyValidatedHostname(mEditText.getText().toString())
                    ? InternetDomainName.isValid(mEditText.getText().toString())
                    : true);
        }
    }