summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2013-05-21 14:58:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-05-21 14:58:55 +0000
commit5cb16e95ac80d931280d786f73ca4aebb3e8d743 (patch)
tree1552a68d1bea2d536ed9709b3c400cc45b301771
parent7d58ff5aa3db0abca5cfad904a5f86a6cd9a873e (diff)
parent96e8f30552ad5b420cc89b97ffdc486962701afa (diff)
downloadandroid_packages_apps_Nfc-5cb16e95ac80d931280d786f73ca4aebb3e8d743.tar.gz
android_packages_apps_Nfc-5cb16e95ac80d931280d786f73ca4aebb3e8d743.tar.bz2
android_packages_apps_Nfc-5cb16e95ac80d931280d786f73ca4aebb3e8d743.zip
Merge "Broadcast LLCP events in debug builds." into jb-mr2-dev
-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;