Merge "Change the parameter type from ContentResolver to Context" into sc-dev

This commit is contained in:
Lucas Lin
2021-03-17 03:27:28 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 3 deletions

View File

@@ -5140,7 +5140,8 @@ public class ConnectivityManager {
/**
* Get private DNS mode from settings.
*
* @param cr The ContentResolver to query private DNS mode from settings.
* @param context The Context to get its ContentResolver to query the private DNS mode from
* settings.
* @return A string of private DNS mode as one of the PRIVATE_DNS_MODE_* constants.
*
* @hide
@@ -5148,7 +5149,8 @@ public class ConnectivityManager {
@SystemApi(client = MODULE_LIBRARIES)
@NonNull
@PrivateDnsMode
public static String getPrivateDnsMode(@NonNull ContentResolver cr) {
public static String getPrivateDnsMode(@NonNull Context context) {
final ContentResolver cr = context.getContentResolver();
String mode = Settings.Global.getString(cr, PRIVATE_DNS_MODE);
if (TextUtils.isEmpty(mode)) mode = Settings.Global.getString(cr, PRIVATE_DNS_DEFAULT_MODE);
// If both PRIVATE_DNS_MODE and PRIVATE_DNS_DEFAULT_MODE are not set, choose