Revert "Merge "Update Utils#getTetheringLabel usage on Settings" am: 2b1e3a971f am: ddf3efb070 am: 8c38e9543e"

This reverts commit 0df55e1eb4.

Reason for revert: Other CLs in topic were skipped, but this one wasn't, which broke sc-dev.

Change-Id: Icf61dae071416381ea11cbe74cd92ae934c3047e
This commit is contained in:
Adrian Roos
2021-03-03 14:51:42 +00:00
parent 0df55e1eb4
commit d99faa25c0

View File

@@ -27,6 +27,7 @@ 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;
@@ -60,6 +61,7 @@ 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
@@ -84,6 +86,7 @@ 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;
} }
@@ -92,6 +95,8 @@ 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) {
@@ -105,7 +110,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(mTetheringManager)); com.android.settingslib.Utils.getTetheringLabel(mConnectivityManager));
} }
} }