Skip to content

Commit

Permalink
profiles: Use new helper to get default NFC adapter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mikeNG authored and bgcngm committed Jun 15, 2024
1 parent 805093b commit 1baecda
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sdk/src/java/lineageos/profiles/ConnectionSettings.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -254,18 +254,13 @@ public boolean isDirty() {
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;
Expand Down

0 comments on commit 1baecda

Please sign in to comment.