profiles: Use new helper to get default NFC adapter
No longer necessary to initialize the variable, since the helper returns the default NFC adapter, or null if no NFC adapter exists. Additionally, try...catch can also be removed. Change-Id: Ic3a1fac8cdf892d5ceccec4e39090ac20cc91e5d
This commit is contained in:
committed by
Bruno Martins
parent
805093b3ab
commit
1baecdab6d
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2020 The LineageOS Project
|
||||
* 2020-2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -254,18 +254,13 @@ public final class ConnectionSettings implements Parcelable {
|
||||
public void processOverride(Context context) {
|
||||
BluetoothAdapter bta = BluetoothAdapter.getDefaultAdapter();
|
||||
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(context);
|
||||
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
ConnectivityManager cm =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
TelephonyManager tm = (TelephonyManager)
|
||||
context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
||||
NfcAdapter nfcAdapter = null;
|
||||
try {
|
||||
nfcAdapter = NfcAdapter.getNfcAdapter(context);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
//Nfc not available
|
||||
}
|
||||
|
||||
boolean forcedState = getValue() == 1;
|
||||
boolean currentState;
|
||||
|
||||
Reference in New Issue
Block a user