Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ab43bf0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "camera_proxy: Remove @hide NFC API usage" into main am: 4c8c31ae

parents e392f13b 4c8c31ae
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ java_library_static {
        "android.hardware.light-V2.0-java",
        "android.hardware.gnss-V2-java",
        "android.hardware.vibrator-V2-java",
        "android.nfc.flags-aconfig-java",
        "app-compat-annotations",
        "framework-tethering.stubs.module_lib",
        "service-art.stubs.system_server",
+9 −36
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ import android.hardware.display.DisplayManager;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.media.AudioManager;
import android.nfc.INfcAdapter;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
import android.os.Binder;
@@ -1252,30 +1251,7 @@ public class CameraServiceProxy extends SystemService
        }
    }

    // TODO(b/303286040): Remove the raw INfcAdapter usage once |ENABLE_NFC_MAINLINE_FLAG| is
    // rolled out.
    private static final String NFC_SERVICE_BINDER_NAME = "nfc";
    // Flags arguments to NFC adapter to enable/disable NFC
    public static final int DISABLE_POLLING_FLAGS = 0x1000;
    public static final int ENABLE_POLLING_FLAGS = 0x0000;
    private void setNfcReaderModeUsingINfcAdapter(boolean enablePolling) {
        IBinder nfcServiceBinder = getBinderService(NFC_SERVICE_BINDER_NAME);
        if (nfcServiceBinder == null) {
            Slog.w(TAG, "Could not connect to NFC service to notify it of camera state");
            return;
        }
        INfcAdapter nfcAdapterRaw = INfcAdapter.Stub.asInterface(nfcServiceBinder);
        int flags = enablePolling ? ENABLE_POLLING_FLAGS : DISABLE_POLLING_FLAGS;
        if (DEBUG) Slog.v(TAG, "Setting NFC reader mode to flags " + flags);
        try {
            nfcAdapterRaw.setReaderMode(nfcInterfaceToken, null, flags, null);
        } catch (RemoteException e) {
            Slog.w(TAG, "Could not notify NFC service, remote exception: " + e);
        }
    }

    private void notifyNfcService(boolean enablePolling) {
        if (android.nfc.Flags.enableNfcMainline()) {
        NfcManager nfcManager = mContext.getSystemService(NfcManager.class);
        if (nfcManager == null) {
            Slog.w(TAG, "Could not connect to NFC service to notify it of camera state");
@@ -1288,9 +1264,6 @@ public class CameraServiceProxy extends SystemService
        }
        if (DEBUG) Slog.v(TAG, "Setting NFC reader mode. enablePolling: " + enablePolling);
        nfcAdapter.setReaderMode(enablePolling);
        } else {
            setNfcReaderModeUsingINfcAdapter(enablePolling);
        }
    }

    private static int[] toArray(Collection<Integer> c) {