Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc798d96 authored by Jeff Hamilton's avatar Jeff Hamilton Committed by Android Git Automerger
Browse files

am 2e2983c6: Merge "Reduce log clutter." into gingerbread

* commit '2e2983c6':
  Reduce log clutter.
parents 482083c5 2e2983c6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -22,8 +22,17 @@
#ifndef __ANDROID_NFC_H__
#define __ANDROID_NFC_H__

#define LOG_TAG "NdefMessage"
#include <utils/Log.h>

extern "C" {

#if 0
  #define TRACE(...) LOG(LOG_DEBUG, "NdefMessage", __VA_ARGS__)
#else
  #define TRACE(...)
#endif

typedef struct phFriNfc_NdefRecord {
    uint8_t                 Flags;
    uint8_t                 Tnf;
+6 −14
Original line number Diff line number Diff line
@@ -14,8 +14,6 @@
 * limitations under the License.
 */

#define LOG_TAG "NdefMessage"

#include <stdlib.h>

#include "jni.h"
@@ -23,8 +21,6 @@

#include "android_nfc.h"

#include <utils/Log.h>

namespace android {

static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
@@ -53,7 +49,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
        return -1;

    /* Get the number of records in the message so we can allocate buffers */
    LOGD("phFriNfc_NdefRecord_GetRecords(NULL)");
    TRACE("phFriNfc_NdefRecord_GetRecords(NULL)");

    status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
            (uint32_t)raw_msg_size, NULL, NULL, &num_of_records);
@@ -62,9 +58,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
        LOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
        goto end;
    }
    LOGD("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);

    LOGD("found %d records in message", num_of_records);
    TRACE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x, with %d records", status, num_of_records);

    is_chunked = (uint8_t*)malloc(num_of_records);
    if (is_chunked == NULL)
@@ -74,7 +68,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
        goto end;

    /* Now, actually retrieve records position in message */
    LOGD("phFriNfc_NdefRecord_GetRecords()");
    TRACE("phFriNfc_NdefRecord_GetRecords()");

    status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
            (uint32_t)raw_msg_size, records, is_chunked, &num_of_records);
@@ -83,7 +77,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
        LOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
        goto end;
    }
    LOGD("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
    TRACE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x, with %d records", status, num_of_records);

    /* Build NDEF records array */
    record_cls = e->FindClass("android/nfc/NdefRecord");
@@ -94,13 +88,11 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,

    ctor = e->GetMethodID(record_cls, "<init>", "(S[B[B[B)V");

    LOGD("NFC_Number of records = %d\n", num_of_records);

    for (i = 0; i < num_of_records; i++) {
        jbyteArray type, id, payload;
        jobject new_record;

        LOGD("phFriNfc_NdefRecord_Parse()");
        TRACE("phFriNfc_NdefRecord_Parse()");

        status = phFriNfc_NdefRecord_Parse(&record, records[i]);

@@ -108,7 +100,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
            LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
            goto end;
        }
        LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
        TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);

        type = e->NewByteArray(record.TypeLength);
        if (type == NULL) {
+4 −4
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ static jbyteArray android_nfc_NdefRecord_generate(
    if (buf == NULL)
        goto end;

    LOGD("phFriNfc_NdefRecord_Generate()");
    TRACE("phFriNfc_NdefRecord_Generate()");

    status = phFriNfc_NdefRecord_Generate(&record, buf, buf_size,
            &record_size);
@@ -63,7 +63,7 @@ static jbyteArray android_nfc_NdefRecord_generate(
        LOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
        goto end;
    }
    LOGD("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
    TRACE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);

    result = e->NewByteArray(record_size);
    if (result == NULL)
@@ -104,13 +104,13 @@ static jint android_nfc_NdefRecord_parseNdefRecord(JNIEnv *e, jobject o,
        goto clean_and_return;
    }

    LOGD("phFriNfc_NdefRecord_Parse()");
    TRACE("phFriNfc_NdefRecord_Parse()");
    status = phFriNfc_NdefRecord_Parse(&record, (uint8_t *)raw_record);
    if (status) {
        LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
        goto clean_and_return;
    }
    LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
    TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);

    /* Set TNF field */
    mTnf = e->GetFieldID(record_cls, "mTnf", "S");