camera_proxy: Remove @hide NFC API usage

These @hide usages in other parts of platform need to be cleaned
up to unbundle NFC mainline module.

Flag: None (The NFC flag - `enableNfcMainline` has been promoted to trunkfood. Note these APIs are available as @hide even if not available in formal SDK until V)
Bug: 307352220
Test: Compiles

Change-Id: I18df26c363de3fb0f71624e5a8d0101dae385edb
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 77b8b02..37976b5 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -133,7 +133,6 @@
         "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",
diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java
index 3c885a1..3b18f0c 100644
--- a/services/core/java/com/android/server/camera/CameraServiceProxy.java
+++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java
@@ -52,7 +52,6 @@
 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,45 +1251,19 @@
         }
     }
 
-    // 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) {
+    private void notifyNfcService(boolean enablePolling) {
+        NfcManager nfcManager = mContext.getSystemService(NfcManager.class);
+        if (nfcManager == 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);
+        NfcAdapter nfcAdapter = nfcManager.getDefaultAdapter();
+        if (nfcAdapter == null) {
+            Slog.w(TAG, "Could not connect to NFC service to notify it of camera state");
+            return;
         }
-    }
-
-    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");
-                return;
-            }
-            NfcAdapter nfcAdapter = nfcManager.getDefaultAdapter();
-            if (nfcAdapter == null) {
-                Slog.w(TAG, "Could not connect to NFC service to notify it of camera state");
-                return;
-            }
-            if (DEBUG) Slog.v(TAG, "Setting NFC reader mode. enablePolling: " + enablePolling);
-            nfcAdapter.setReaderMode(enablePolling);
-        } else {
-            setNfcReaderModeUsingINfcAdapter(enablePolling);
-        }
+        if (DEBUG) Slog.v(TAG, "Setting NFC reader mode. enablePolling: " + enablePolling);
+        nfcAdapter.setReaderMode(enablePolling);
     }
 
     private static int[] toArray(Collection<Integer> c) {