Add cancel button for private dns dialog
Also update the onclick method. Change-Id: I69e92584e056a4d0a686153315b8df002d91e204 Fixes: 79479021 Test: RunSettingsRoboTests
This commit is contained in:
@@ -156,16 +156,18 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreference imple
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final Context context = getContext();
|
||||
if (mMode.equals(PRIVATE_DNS_MODE_PROVIDER_HOSTNAME)) {
|
||||
// Only clickable if hostname is valid, so we could save it safely
|
||||
Settings.Global.putString(context.getContentResolver(), HOSTNAME_KEY,
|
||||
mEditText.getText().toString());
|
||||
}
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
final Context context = getContext();
|
||||
if (mMode.equals(PRIVATE_DNS_MODE_PROVIDER_HOSTNAME)) {
|
||||
// Only clickable if hostname is valid, so we could save it safely
|
||||
Settings.Global.putString(context.getContentResolver(), HOSTNAME_KEY,
|
||||
mEditText.getText().toString());
|
||||
}
|
||||
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context,
|
||||
MetricsProto.MetricsEvent.ACTION_PRIVATE_DNS_MODE, mMode);
|
||||
Settings.Global.putString(context.getContentResolver(), MODE_KEY, mMode);
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context,
|
||||
MetricsProto.MetricsEvent.ACTION_PRIVATE_DNS_MODE, mMode);
|
||||
Settings.Global.putString(context.getContentResolver(), MODE_KEY, mMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user