diff options
| author | 2023-11-30 22:10:48 +0000 | |
|---|---|---|
| committer | 2023-11-30 22:10:48 +0000 | |
| commit | 0707f8856f2dda60e1288b1a3ad647b65766826d (patch) | |
| tree | 55c7b72b7843f537e5dba642384341a9161cac1e | |
| parent | a99614dd2c1a287de5b0e28e2500fb821b1e0a4f (diff) | |
| parent | 4c8c31ae0f8274230e6f2dfb3fe06fd5f2a67c47 (diff) | |
Merge "camera_proxy: Remove @hide NFC API usage" into main am: 4c8c31ae0f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2850012
Change-Id: I85f1500439c6cb6c13bc8c6556bef8a8f2715f10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/Android.bp | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/camera/CameraServiceProxy.java | 45 |
2 files changed, 9 insertions, 37 deletions
diff --git a/services/core/Android.bp b/services/core/Android.bp index 77b8b026097d..37976b58a4e0 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -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", diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java index 3c885a145315..3b18f0c76d25 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.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,45 +1251,19 @@ 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) { + 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); - } - } - - 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); + 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); } private static int[] toArray(Collection<Integer> c) { |