summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-04-02 20:44:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-02 20:44:04 +0000
commit4ab83065938d4044b07f332c23a833388ed81a1b (patch)
tree0698345008ec7e5d390f985c6595db29f85c8709
parent39ee6d184646d01d39b41ea86918675a09037453 (diff)
parent90d11cf327f95bd9cd1040b3abcba98607cc16ed (diff)
downloadNfc-4ab83065938d4044b07f332c23a833388ed81a1b.tar.gz
Merge "nfc(app): Support OEM extension surface" into main
-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 84efb73e..7ce8860d 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;
@@ -419,6 +420,7 @@ public class NfcService implements DeviceHostListener, ForegroundUtils.Callback
private final StatsdUtils mStatsdUtils;
private INfcVendorNciCallback mNfcVendorNciCallBack = null;
+ private INfcOemExtensionCallback mNfcOemExtensionCallback = null;
public static NfcService getInstance() {
return sService;
@@ -2123,15 +2125,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);
+ }
}
}
}