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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user