diff options
-rw-r--r-- | src/com/android/nfc/NfcService.java | 52 |
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); + } } } } |