Fix SE permissions.
Change-Id: I83f79bc7a5f3227ef4a8222dc879beda53a8ab31
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 322e420..bd9411d 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -619,7 +619,7 @@
}
public INfcSecureElement getNfcSecureElementInterface() {
- mContext.enforceCallingOrSelfPermission(NFC_PERM, NFC_PERM_ERROR);
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
return mSecureElementService;
}
@@ -1815,6 +1815,8 @@
private INfcSecureElement mSecureElementService = new INfcSecureElement.Stub() {
public int openSecureElementConnection() throws RemoteException {
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
+
Log.d(TAG, "openSecureElementConnection");
int handle;
@@ -1850,6 +1852,7 @@
public int closeSecureElementConnection(int nativeHandle)
throws RemoteException {
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
// Check if NFC is enabled
if (!mIsNfcEnabled) {
@@ -1899,6 +1902,8 @@
public int[] getSecureElementTechList(int nativeHandle)
throws RemoteException {
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
+
// Check if NFC is enabled
if (!mIsNfcEnabled) {
return null;
@@ -1926,6 +1931,8 @@
public byte[] getSecureElementUid(int nativeHandle)
throws RemoteException {
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
+
byte[] uid;
// Check if NFC is enabled
@@ -1955,6 +1962,8 @@
public byte[] exchangeAPDU(int nativeHandle, byte[] data)
throws RemoteException {
+ mContext.enforceCallingOrSelfPermission(ADMIN_PERM, ADMIN_PERM_ERROR);
+
byte[] response;
// Check if NFC is enabled