Refactor tether logic for reuse
am: 135619d483
Change-Id: I216dcb55a0f2423766abb4c30fc996f13afda2e4
This commit is contained in:
@@ -88,8 +88,7 @@ public class TetherPreferenceController extends PreferenceController
|
|||||||
public TetherPreferenceController(Context context, Lifecycle lifecycle) {
|
public TetherPreferenceController(Context context, Lifecycle lifecycle) {
|
||||||
super(context);
|
super(context);
|
||||||
mBluetoothPan = new AtomicReference<>();
|
mBluetoothPan = new AtomicReference<>();
|
||||||
mAdminDisallowedTetherConfig = checkIfRestrictionEnforced(
|
mAdminDisallowedTetherConfig = isTetherConfigDisallowed(context);
|
||||||
context, DISALLOW_CONFIG_TETHERING, UserHandle.myUserId()) != null;
|
|
||||||
mConnectivityManager =
|
mConnectivityManager =
|
||||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
@@ -170,6 +169,11 @@ public class TetherPreferenceController extends PreferenceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isTetherConfigDisallowed(Context context) {
|
||||||
|
return checkIfRestrictionEnforced(
|
||||||
|
context, DISALLOW_CONFIG_TETHERING, UserHandle.myUserId()) != null;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void updateSummary() {
|
void updateSummary() {
|
||||||
if (mPreference == null) {
|
if (mPreference == null) {
|
||||||
|
Reference in New Issue
Block a user