summaryrefslogtreecommitdiffstats
path: root/src/com/android
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 /src/com/android
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
Diffstat (limited to 'src/com/android')
-rwxr-xr-xsrc/com/android/nfc/NfcService.java10
1 files changed, 7 insertions, 3 deletions
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) {