Merge "Update Utils#getTetheringLabel usage on Settings" into sc-dev am: e5e60115db

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13794937

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7016832c402b3a01e2593902f901f6d8bbcadb8e
This commit is contained in:
Paul Hu
2021-03-09 03:43:18 +00:00
committed by Automerger Merge Worker

View File

@@ -27,7 +27,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.net.ConnectivityManager;
import android.net.TetheringManager; import android.net.TetheringManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@@ -61,7 +60,6 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
private final boolean mAdminDisallowedTetherConfig; private final boolean mAdminDisallowedTetherConfig;
private final AtomicReference<BluetoothPan> mBluetoothPan; private final AtomicReference<BluetoothPan> mBluetoothPan;
private final ConnectivityManager mConnectivityManager;
private final BluetoothAdapter mBluetoothAdapter; private final BluetoothAdapter mBluetoothAdapter;
private final TetheringManager mTetheringManager; private final TetheringManager mTetheringManager;
@VisibleForTesting @VisibleForTesting
@@ -86,7 +84,6 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
super(null); super(null);
mAdminDisallowedTetherConfig = false; mAdminDisallowedTetherConfig = false;
mBluetoothPan = new AtomicReference<>(); mBluetoothPan = new AtomicReference<>();
mConnectivityManager = null;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mTetheringManager = null; mTetheringManager = null;
} }
@@ -95,8 +92,6 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
super(context); super(context);
mBluetoothPan = new AtomicReference<>(); mBluetoothPan = new AtomicReference<>();
mAdminDisallowedTetherConfig = isTetherConfigDisallowed(context); mAdminDisallowedTetherConfig = isTetherConfigDisallowed(context);
mConnectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mTetheringManager = context.getSystemService(TetheringManager.class); mTetheringManager = context.getSystemService(TetheringManager.class);
if (lifecycle != null) { if (lifecycle != null) {
@@ -110,7 +105,7 @@ public class TetherPreferenceController extends AbstractPreferenceController imp
mPreference = screen.findPreference(KEY_TETHER_SETTINGS); mPreference = screen.findPreference(KEY_TETHER_SETTINGS);
if (mPreference != null && !mAdminDisallowedTetherConfig) { if (mPreference != null && !mAdminDisallowedTetherConfig) {
mPreference.setTitle( mPreference.setTitle(
com.android.settingslib.Utils.getTetheringLabel(mConnectivityManager)); com.android.settingslib.Utils.getTetheringLabel(mTetheringManager));
} }
} }