Snap for 4922203 from a9ef080f9964f46d4983bf7637a2c52a6e0eadd2 to pi-qpr1-release

Change-Id: I7618716c7271dcba29c2254d536fe2997e586c14
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
old mode 100755
new mode 100644
index 18589d8..d6d4fd1
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -514,6 +514,14 @@
                 Context.SECURE_ELEMENT_SERVICE));
     }
 
+    private boolean isSEServiceAvailable() {
+        if (mSEService == null) {
+            mSEService = ISecureElementService.Stub.asInterface(ServiceManager.getService(
+                    Context.SECURE_ELEMENT_SERVICE));
+        }
+        return (mSEService != null);
+    }
+
     void initSoundPool() {
         synchronized (this) {
             if (mSoundPool == null) {
@@ -2241,7 +2249,7 @@
         }
 
         private void sendOffHostTransactionEvent(byte[] aid, byte[] data, byte[] readerByteArray) {
-            if (mSEService == null || mNfcEventInstalledPackages.isEmpty()) {
+            if (!isSEServiceAvailable() || mNfcEventInstalledPackages.isEmpty()) {
                 return;
             }
 
@@ -2281,7 +2289,7 @@
 
         /* Returns the list of packages that have access to NFC Events on any SE */
         private ArrayList<String> getSEAccessAllowedPackages() {
-            if (mSEService == null || mNfcEventInstalledPackages.isEmpty()) {
+            if (!isSEServiceAvailable() || mNfcEventInstalledPackages.isEmpty()) {
                 return null;
             }
             String[] readers = null;