summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2024-03-25 13:01:26 -0700
committerRoshan Pius <rpius@google.com>2024-04-02 17:25:51 +0000
commit90d11cf327f95bd9cd1040b3abcba98607cc16ed (patch)
tree76b2c6bb14b20a8d7ba2f10e84e47f905d84977d
parentda9673973ed8c5945b1fc4fd85acb19525f59e75 (diff)
downloadNfc-90d11cf327f95bd9cd1040b3abcba98607cc16ed.tar.gz
nfc(app): Support OEM extension surface
Bug: 330376108 Test: Compiles Merged-In: I79e7fac5209534fe2bc999879d95d86ac92bc380 Change-Id: I79e7fac5209534fe2bc999879d95d86ac92bc380
-rw-r--r--src/com/android/nfc/NfcService.java52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index a947bf77..9224f08a 100644
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -55,6 +55,7 @@ import android.nfc.INfcControllerAlwaysOnListener;
import android.nfc.INfcVendorNciCallback;
import android.nfc.INfcDta;
import android.nfc.INfcFCardEmulation;
+import android.nfc.INfcOemExtensionCallback;
import android.nfc.INfcTag;
import android.nfc.INfcUnlockHandler;
import android.nfc.ITagRemovedCallback;
@@ -413,6 +414,7 @@ public class NfcService implements DeviceHostListener, ForegroundUtils.Callback
private final FeatureFlags mFeatureFlags = new com.android.nfc.flags.FeatureFlagsImpl();
private INfcVendorNciCallback mNfcVendorNciCallBack = null;
+ private INfcOemExtensionCallback mNfcOemExtensionCallback = null;
public static NfcService getInstance() {
return sService;
@@ -2111,15 +2113,49 @@ public class NfcService implements DeviceHostListener, ForegroundUtils.Callback
NfcPermissions.enforceAdminPermissions(mContext);
mNfcVendorNciCallBack = null;
}
- }
- private void sendVendorNciResponse(int gid, int oid, byte[] payload) {
- if (DBG) Log.i(TAG, "onVendorNciResponseReceived");
- if (mNfcVendorNciCallBack != null) {
- try {
- mNfcVendorNciCallBack.onVendorResponseReceived(gid, oid, payload);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to send vendor response", e);
+ @Override
+ public void registerOemExtensionCallback(INfcOemExtensionCallback callbacks)
+ throws RemoteException {
+ if (DBG) Log.i(TAG, "Register the oem extension callback");
+ NfcPermissions.enforceAdminPermissions(mContext);
+ mNfcOemExtensionCallback = callbacks;
+ }
+
+ @Override
+ public void unregisterOemExtensionCallback(INfcOemExtensionCallback callbacks)
+ throws RemoteException {
+ if (DBG) Log.i(TAG, "Unregister the oem extension callback");
+ NfcPermissions.enforceAdminPermissions(mContext);
+ mNfcOemExtensionCallback = null;
+ }
+
+ @Override
+ public void clearPreference() throws RemoteException {
+ if (DBG) Log.i(TAG, "clearPreference");
+ NfcPermissions.enforceAdminPermissions(mContext);
+ // TODO: Implement this.
+ }
+
+ private synchronized void sendVendorNciResponse(int gid, int oid, byte[] payload) {
+ if (DBG) Log.i(TAG, "onVendorNciResponseReceived");
+ if (mNfcVendorNciCallBack != null) {
+ try {
+ mNfcVendorNciCallBack.onVendorResponseReceived(gid, oid, payload);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to send vendor response", e);
+ }
+ }
+ }
+
+ private synchronized void sendVendorNciNotification(int gid, int oid, byte[] payload) {
+ if (DBG) Log.i(TAG, "sendVendorNciNotification");
+ if (mNfcVendorNciCallBack != null) {
+ try {
+ mNfcVendorNciCallBack.onVendorNotificationReceived(gid, oid, payload);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to send vendor notification", e);
+ }
}
}
}