summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-11-14 14:28:40 -0800
committerNick Pelly <npelly@google.com>2011-11-14 14:28:40 -0800
commit0571ce53451baf7d363703b6e3ac10bc885fc5bc (patch)
treedb887379a50f87d1da7e11a8b393589ff77f9c89
parentc05387ef4e6d6d024b03254e7e2ea5ad001cf2d2 (diff)
downloadpackages_apps_nfc-0571ce53451baf7d363703b6e3ac10bc885fc5bc.zip
packages_apps_nfc-0571ce53451baf7d363703b6e3ac10bc885fc5bc.tar.gz
packages_apps_nfc-0571ce53451baf7d363703b6e3ac10bc885fc5bc.tar.bz2
Add null check to aovid NPE on un-matched close().
Also finish removing NFCEE permission, and fix a couple of style mistakes. Change-Id: I4ec22469990de6661365c281db2e8cfd7ae413b0
-rwxr-xr-xAndroidManifest.xml6
-rwxr-xr-xsrc/com/android/nfc/NfcService.java10
2 files changed, 7 insertions, 9 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6177da4..3ce49b8 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -20,12 +20,6 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.VIBRATE" />
- <permission android:name="com.android.nfc.permission.NFCEE_ADMIN"
- android:label="@string/permlab_nfcAdmin"
- android:description="@string/permdesc_nfcAdmin"
- android:protectionLevel="dangerous"
- />
-
<application android:name="com.android.nfc.NfcService"
android:icon="@drawable/icon"
android:label="@string/app_name"
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 58a5732..7c1a8e6 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -1088,7 +1088,7 @@ public class NfcService extends Application implements DeviceHostListener {
//TODO: This is incorrect behavior - the close should interrupt pending
// operations. However this is not supported by current hardware.
- synchronized(NfcService.this) {
+ synchronized (NfcService.this) {
if (!isNfcEnabled()) {
throw new IOException("NFC adapter is disabled");
}
@@ -1168,7 +1168,11 @@ public class NfcService extends Application implements DeviceHostListener {
public Bundle close(String pkg, IBinder b) throws RemoteException {
NfcService.this.enforceNfceeAdminPerm(pkg);
- b.unlinkToDeath(mOpenEe, 0);
+ synchronized (this) {
+ if (mOpenEe != null) {
+ b.unlinkToDeath(mOpenEe, 0);
+ }
+ }
Bundle result;
try {
@@ -1201,7 +1205,7 @@ public class NfcService extends Application implements DeviceHostListener {
if (!isNfcEnabled()) {
throw new IOException("NFC is not enabled");
}
- if (mOpenEe == null){
+ if (mOpenEe == null) {
throw new IOException("NFC EE is not open");
}
if (getCallingPid() != mOpenEe.pid) {