summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2013-05-20 16:49:01 -0700
committerMartijn Coenen <maco@google.com>2013-05-20 20:18:47 -0700
commit96e8f30552ad5b420cc89b97ffdc486962701afa (patch)
treebd1d6e653597e1e04f08f4e56d38265037910bdb
parent476ee8a64404b7ee042ba1a70400bcb1dd5ace10 (diff)
downloadandroid_packages_apps_Nfc-96e8f30552ad5b420cc89b97ffdc486962701afa.tar.gz
android_packages_apps_Nfc-96e8f30552ad5b420cc89b97ffdc486962701afa.tar.bz2
android_packages_apps_Nfc-96e8f30552ad5b420cc89b97ffdc486962701afa.zip
Broadcast LLCP events in debug builds.
Bug: 8839848 Change-Id: I01a18b3409da66ab1394c2c196a06a8749b9c72c
-rwxr-xr-xsrc/com/android/nfc/NfcService.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index f6ca3b55..6ed07fdd 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -56,6 +56,7 @@ import android.nfc.tech.Ndef;
import android.nfc.tech.TagTechnology;
import android.os.AsyncTask;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -175,6 +176,12 @@ public class NfcService implements DeviceHostListener {
"com.android.nfc_extras.action.AID_SELECTED";
public static final String EXTRA_AID = "com.android.nfc_extras.extra.AID";
+ public static final String ACTION_LLCP_UP =
+ "com.android.nfc.action.LLCP_UP";
+
+ public static final String ACTION_LLCP_DOWN =
+ "com.android.nfc.action.LLCP_DOWN";
+
public static final String ACTION_APDU_RECEIVED =
"com.android.nfc_extras.action.APDU_RECEIVED";
public static final String EXTRA_APDU_BYTES =
@@ -237,6 +244,7 @@ public class NfcService implements DeviceHostListener {
NfcAdapterExtrasService mExtrasService;
boolean mIsAirplaneSensitive;
boolean mIsAirplaneToggleable;
+ boolean mIsDebugBuild;
NfceeAccessControl mNfceeAccessControl;
private NfcDispatcher mNfcDispatcher;
@@ -394,6 +402,8 @@ public class NfcService implements DeviceHostListener {
mState = NfcAdapter.STATE_OFF;
mIsNdefPushEnabled = mPrefs.getBoolean(PREF_NDEF_PUSH_ON, NDEF_PUSH_ON_DEFAULT);
+ mIsDebugBuild = "userdebug".equals(Build.TYPE) || "eng".equals(Build.TYPE);
+
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mRoutingWakeLock = mPowerManager.newWakeLock(
@@ -1884,10 +1894,18 @@ public class NfcService implements DeviceHostListener {
break;
case MSG_LLCP_LINK_ACTIVATION:
+ if (mIsDebugBuild) {
+ Intent actIntent = new Intent(ACTION_LLCP_UP);
+ mContext.sendBroadcast(actIntent);
+ }
llcpActivated((NfcDepEndpoint) msg.obj);
break;
case MSG_LLCP_LINK_DEACTIVATED:
+ if (mIsDebugBuild) {
+ Intent deactIntent = new Intent(ACTION_LLCP_DOWN);
+ mContext.sendBroadcast(deactIntent);
+ }
NfcDepEndpoint device = (NfcDepEndpoint) msg.obj;
boolean needsDisconnect = false;