summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Automerger <android-build@android.com>2011-10-28 20:31:29 -0700
committerThe Android Automerger <android-build@android.com>2011-10-28 20:31:29 -0700
commit4e290849ab6b16876cae8585d762075a3122bdfd (patch)
treebcaa7c32767e21bef5e59f75a1d24d3a8917158d
parent79faaaec4f99360b1f9a3503b85433b6e77c7898 (diff)
downloadpackages_apps_nfc-4e290849ab6b16876cae8585d762075a3122bdfd.zip
packages_apps_nfc-4e290849ab6b16876cae8585d762075a3122bdfd.tar.gz
packages_apps_nfc-4e290849ab6b16876cae8585d762075a3122bdfd.tar.bz2
Revert "Merge "Add event logs for NFC events. DO NOT MERGE" into ics-mr0"
This reverts commit 79faaaec4f99360b1f9a3503b85433b6e77c7898, reversing changes made to fb21ff7547c2a8af66645bdc6be7daf7450e15af.
-rw-r--r--Android.mk20
-rw-r--r--src/com/android/nfc/EventLogTags.logtags12
-rwxr-xr-xsrc/com/android/nfc/NfcService.java12
-rwxr-xr-xsrc/com/android/nfc/P2pLinkManager.java90
4 files changed, 10 insertions, 124 deletions
diff --git a/Android.mk b/Android.mk
index a041854..b5ae045 100644
--- a/Android.mk
+++ b/Android.mk
@@ -3,33 +3,15 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Nfc
LOCAL_CERTIFICATE := platform
-LOCAL_STATIC_JAVA_LIBRARIES := NfcLogTags
-
LOCAL_JNI_SHARED_LIBRARIES := libnfc_jni
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
-
-#####
-# static lib for the log tags
-#####
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := src/com/android/nfc/EventLogTags.logtags
-
-LOCAL_MODULE:= NfcLogTags
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/src/com/android/nfc/EventLogTags.logtags b/src/com/android/nfc/EventLogTags.logtags
deleted file mode 100644
index 40a60b3..0000000
--- a/src/com/android/nfc/EventLogTags.logtags
+++ /dev/null
@@ -1,12 +0,0 @@
-# See system/core/logcat/event.logtags for a description of the format of this file.
-
-option java_package com.android.nfc
-
-# logged on the first P2P sharing event
-90000 nfc_first_share
-# logged when a P2P transaction succeeds
-90001 nfc_share (size|1|2),(tnf|1),(type|3),(aar_present|1),(duration|1|3)
-# logged when a P2P transaction fails
-90002 nfc_share_fail (size|1|2),(tnf|1),(type|3),(aar_present|1)
-# data is either the URL or MIME type
-90003 nfc_ndef_received (size|1|2),(tnf|1),(type|3),(aar_present|1)
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 337930e..b955714 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -90,12 +90,12 @@ public class NfcService extends Application implements DeviceHostListener {
public static final String PREF = "NfcServicePrefs";
- static final String PREF_NFC_ON = "nfc_on";
- static final boolean NFC_ON_DEFAULT = true;
- static final String PREF_NDEF_PUSH_ON = "ndef_push_on";
- static final boolean NDEF_PUSH_ON_DEFAULT = true;
- static final String PREF_FIRST_BEAM = "first_beam";
- static final String PREF_FIRST_BOOT = "first_boot";
+ private static final String PREF_NFC_ON = "nfc_on";
+ private static final boolean NFC_ON_DEFAULT = true;
+ private static final String PREF_NDEF_PUSH_ON = "ndef_push_on";
+ private static final boolean NDEF_PUSH_ON_DEFAULT = true;
+
+ private static final String PREF_FIRST_BOOT = "first_boot";
static final int MSG_NDEF_TAG = 0;
static final int MSG_CARD_EMULATION = 1;
diff --git a/src/com/android/nfc/P2pLinkManager.java b/src/com/android/nfc/P2pLinkManager.java
index 466453d..5c5be9f 100755
--- a/src/com/android/nfc/P2pLinkManager.java
+++ b/src/com/android/nfc/P2pLinkManager.java
@@ -25,7 +25,6 @@ import com.android.nfc.snep.SnepServer;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
-import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -37,7 +36,6 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
-import android.os.SystemClock;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Profile;
import android.util.Log;
@@ -45,8 +43,6 @@ import android.util.Log;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
-import java.nio.charset.Charsets;
-import java.util.Arrays;
import java.util.List;
/**
@@ -138,8 +134,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
NdefMessage mStaticNdef;
INdefPushCallback mCallbackNdef;
SendTask mSendTask;
- SharedPreferences mPrefs;
- boolean mFirstBeam;
public P2pLinkManager(Context context) {
mNdefPushServer = new NdefPushServer(NDEFPUSH_SAP, mNppCallback);
@@ -153,8 +147,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
mSendState = SEND_STATE_NOTHING_TO_SEND;
mIsSendEnabled = false;
mIsReceiveEnabled = false;
- mPrefs = context.getSharedPreferences(NfcService.PREF, Context.MODE_PRIVATE);
- mFirstBeam = mPrefs.getBoolean(NfcService.PREF_FIRST_BEAM, true);
}
/**
@@ -293,14 +285,7 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
}
}
- void onSendComplete(NdefMessage msg, long elapsedRealtime) {
- if (mFirstBeam) {
- EventLogTags.writeNfcFirstShare();
- mPrefs.edit().putBoolean(NfcService.PREF_FIRST_BEAM, false).apply();
- mFirstBeam = false;
- }
- EventLogTags.writeNfcShare(getMessageSize(msg), getMessageTnf(msg), getMessageType(msg),
- getMessageAarPresent(msg), (int) elapsedRealtime);
+ void onSendComplete() {
// Make callbacks on UI thread
mHandler.sendEmptyMessage(MSG_SEND_COMPLETE);
}
@@ -334,7 +319,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
m = mMessageToSend;
}
- long time = SystemClock.elapsedRealtime();
try {
if (DBG) Log.d(TAG, "Sending ndef via SNEP");
result = doSnepProtocol(m);
@@ -347,12 +331,9 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
result = new NdefPushClient().push(m);
}
- time = SystemClock.elapsedRealtime() - time;
-
- if (DBG) Log.d(TAG, "SendTask result=" + result + ", time ms=" + time);
-
+ if (DBG) Log.d(TAG, "SendTask result=" + result);
if (result) {
- onSendComplete(m, time);
+ onSendComplete();
}
return null;
}
@@ -401,8 +382,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
};
void onReceiveComplete(NdefMessage msg) {
- EventLogTags.writeNfcNdefReceived(getMessageSize(msg), getMessageTnf(msg),
- getMessageType(msg), getMessageAarPresent(msg));
// Make callbacks on UI thread
mHandler.obtainMessage(MSG_RECEIVE_COMPLETE, msg).sendToTarget();
}
@@ -415,11 +394,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
if (mLinkState != LINK_STATE_DEBOUNCE) {
break;
}
- if (mSendState == SEND_STATE_SENDING) {
- EventLogTags.writeNfcShareFail(getMessageSize(mMessageToSend),
- getMessageTnf(mMessageToSend), getMessageType(mMessageToSend),
- getMessageAarPresent(mMessageToSend));
- }
if (DBG) Log.d(TAG, "Debounce timeout");
mLinkState = LINK_STATE_DOWN;
mSendState = SEND_STATE_NOTHING_TO_SEND;
@@ -465,64 +439,6 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba
return true;
}
- int getMessageSize(NdefMessage msg) {
- if (msg != null) {
- return msg.toByteArray().length;
- } else {
- return 0;
- }
- }
-
- int getMessageTnf(NdefMessage msg) {
- if (msg == null) {
- return NdefRecord.TNF_EMPTY;
- }
- NdefRecord records[] = msg.getRecords();
- if (records == null || records.length == 0) {
- return NdefRecord.TNF_EMPTY;
- }
- return records[0].getTnf();
- }
-
- String getMessageType(NdefMessage msg) {
- if (msg == null) {
- return "null";
- }
- NdefRecord records[] = msg.getRecords();
- if (records == null || records.length == 0) {
- return "null";
- }
- NdefRecord record = records[0];
- switch (record.getTnf()) {
- case NdefRecord.TNF_ABSOLUTE_URI:
- // The actual URI is in the type field, don't log it
- return "uri";
- case NdefRecord.TNF_EXTERNAL_TYPE:
- case NdefRecord.TNF_MIME_MEDIA:
- case NdefRecord.TNF_WELL_KNOWN:
- return new String(record.getType(), Charsets.UTF_8);
- default:
- return "unknown";
- }
- }
-
- int getMessageAarPresent(NdefMessage msg) {
- if (msg == null) {
- return 0;
- }
- NdefRecord records[] = msg.getRecords();
- if (records == null) {
- return 0;
- }
- for (NdefRecord record : records) {
- if (record.getTnf() == NdefRecord.TNF_EXTERNAL_TYPE &&
- Arrays.equals(NdefRecord.RTD_ANDROID_APP, record.getType())) {
- return 1;
- }
- }
- return 0;
- }
-
@Override
public void onP2pSendConfirmed() {
if (DBG) Log.d(TAG, "onP2pSendConfirmed()");