From 1baecdab6d039fb63f2e3c78dc9d93bc2f7da730 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Sun, 16 Jun 2024 02:28:08 +0300 Subject: [PATCH] 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 --- sdk/src/java/lineageos/profiles/ConnectionSettings.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sdk/src/java/lineageos/profiles/ConnectionSettings.java b/sdk/src/java/lineageos/profiles/ConnectionSettings.java index d9395c83..bb559f8f 100644 --- a/sdk/src/java/lineageos/profiles/ConnectionSettings.java +++ b/sdk/src/java/lineageos/profiles/ConnectionSettings.java @@ -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;