Fix debug logging
Bug: 131298247
Test: Access rule can be retrieved successfully
Change-Id: I11a79536037ecb968cbf991ff667cd1f2cf1489a
diff --git a/1.0/SecureElement.cpp b/1.0/SecureElement.cpp
index 7c1d0f5..a216a76 100644
--- a/1.0/SecureElement.cpp
+++ b/1.0/SecureElement.cpp
@@ -17,7 +17,7 @@
*
******************************************************************************/
#define LOG_TAG "StEse-SecureElement"
-#include <log/log.h>
+#include <android_logmsg.h>
#include <stdlib.h>
#include <string.h>
@@ -43,13 +43,13 @@
::android::hardware::secure_element::V1_0::ISecureElementHalCallback>&
clientCallback) {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (clientCallback == nullptr) {
return Void();
} else {
mCallbackV1_0 = clientCallback;
if (!mCallbackV1_0->linkToDeath(this, 0 /*cookie*/)) {
- ALOGE("%s: Failed to register death notification", __func__);
+ STLOG_HAL_E("%s: Failed to register death notification", __func__);
}
}
@@ -69,7 +69,7 @@
}
Return<void> SecureElement::getAtr(getAtr_cb _hidl_cb) {
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
hidl_vec<uint8_t> response;
uint8_t* ATR;
ATR = StEse_getAtr();
@@ -94,7 +94,7 @@
memset(&cmdApdu, 0x00, sizeof(StEse_data));
memset(&rspApdu, 0x00, sizeof(StEse_data));
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
cmdApdu.len = data.size();
if (cmdApdu.len >= MIN_APDU_LENGTH) {
cmdApdu.p_data = (uint8_t*)malloc(data.size() * sizeof(uint8_t));
@@ -104,7 +104,7 @@
hidl_vec<uint8_t> result;
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: transmit failed!!!", __func__);
+ STLOG_HAL_E("%s: transmit failed!!!", __func__);
seHalResetSe();
} else {
result.resize(rspApdu.len);
@@ -124,13 +124,13 @@
LogicalChannelResponse resApduBuff;
resApduBuff.channelNumber = 0xff;
memset(&resApduBuff, 0x00, sizeof(resApduBuff));
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
- ALOGD("%s: Enter SeInitialized", __func__);
+ STLOG_HAL_D("%s: Enter SeInitialized", __func__);
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
_hidl_cb(resApduBuff, SecureElementStatus::IOERROR);
OpenLogicalChannelProcessing = false;
return Void();
@@ -184,12 +184,12 @@
/*If manageChannel is failed in any of above cases
send the callback and return*/
_hidl_cb(resApduBuff, sestatus);
- ALOGE("%s: Exit - manage channel failed!!", __func__);
+ STLOG_HAL_E("%s: Exit - manage channel failed!!", __func__);
OpenLogicalChannelProcessing = false;
return Void();
}
- ALOGD("%s: Sending selectApdu", __func__);
+ STLOG_HAL_D("%s: Sending selectApdu", __func__);
/*Reset variables if manageChannel is success*/
sestatus = SecureElementStatus::IOERROR;
status = ESESTATUS_FAILED;
@@ -240,11 +240,11 @@
if (sestatus == SecureElementStatus::IOERROR) {
seHalResetSe();
} else {
- ALOGE("%s: Select APDU failed! Close channel..", __func__);
+ STLOG_HAL_E("%s: Select APDU failed! Close channel..", __func__);
SecureElementStatus closeChannelStatus =
closeChannel(resApduBuff.channelNumber);
if (closeChannelStatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: closeChannel Failed", __func__);
+ STLOG_HAL_E("%s: closeChannel Failed", __func__);
} else {
resApduBuff.channelNumber = 0xff;
}
@@ -253,7 +253,7 @@
_hidl_cb(resApduBuff, sestatus);
free(cmdApdu.p_data);
free(rspApdu.p_data);
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
OpenLogicalChannelProcessing = false;
return Void();
}
@@ -263,12 +263,12 @@
openBasicChannel_cb _hidl_cb) {
hidl_vec<uint8_t> result;
OpenBasicChannelProcessing = true;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
_hidl_cb(result, SecureElementStatus::IOERROR);
OpenBasicChannelProcessing = false;
return Void();
@@ -336,13 +336,13 @@
SecureElementStatus closeChannelStatus =
closeChannel(DEFAULT_BASIC_CHANNEL);
if (closeChannelStatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: closeChannel Failed", __func__);
+ STLOG_HAL_E("%s: closeChannel Failed", __func__);
}
}
_hidl_cb(result, sestatus);
free(cmdApdu.p_data);
free(rspApdu.p_data);
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
OpenBasicChannelProcessing = false;
return Void();
}
@@ -355,12 +355,12 @@
StEse_data cmdApdu;
StEse_data rspApdu;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter : %d", __func__, channelNumber);
if ((channelNumber < DEFAULT_BASIC_CHANNEL) ||
(channelNumber >= MAX_LOGICAL_CHANNELS) ||
(mOpenedChannels[channelNumber] == false)) {
- ALOGE("%s: invalid channel!!!", __func__);
+ STLOG_HAL_E("%s: invalid channel!!!", __func__);
sestatus = SecureElementStatus::FAILED;
} else if (channelNumber > DEFAULT_BASIC_CHANNEL) {
memset(&cmdApdu, 0x00, sizeof(StEse_data));
@@ -403,15 +403,15 @@
}
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return sestatus;
}
void SecureElement::serviceDied(uint64_t /*cookie*/, const wp<IBase>& /*who*/) {
- ALOGE("%s: SecureElement serviceDied!!!", __func__);
+ STLOG_HAL_E("%s: SecureElement serviceDied!!!", __func__);
SecureElementStatus sestatus = seHalDeInit();
if (sestatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: seHalDeInit Faliled!!!", __func__);
+ STLOG_HAL_E("%s: seHalDeInit Faliled!!!", __func__);
}
if (mCallbackV1_0 != nullptr) {
mCallbackV1_0->unlinkToDeath(this);
@@ -423,23 +423,23 @@
ESESTATUS SecureElement::seHalInit() {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
status = StEse_init();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: SecureElement open failed!!!", __func__);
+ STLOG_HAL_E("%s: SecureElement open failed!!!", __func__);
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return status;
}
void SecureElement::seHalResetSe() {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
}
}
@@ -448,7 +448,7 @@
status = StEse_Reset();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: SecureElement reset failed!!", __func__);
+ STLOG_HAL_E("%s: SecureElement reset failed!!", __func__);
} else {
for (uint8_t xx = 0; xx < MAX_LOGICAL_CHANNELS; xx++) {
mOpenedChannels[xx] = false;
@@ -457,12 +457,12 @@
mCallbackV1_0->onStateChange(true);
}
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
}
Return<::android::hardware::secure_element::V1_0::SecureElementStatus>
SecureElement::seHalDeInit() {
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
ESESTATUS status = ESESTATUS_SUCCESS;
SecureElementStatus sestatus = SecureElementStatus::FAILED;
status = StEse_close();
@@ -476,7 +476,7 @@
}
mOpenedchannelCount = 0;
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return sestatus;
}
diff --git a/1.1/SecureElement.cpp b/1.1/SecureElement.cpp
index 434d403..222e48f 100644
--- a/1.1/SecureElement.cpp
+++ b/1.1/SecureElement.cpp
@@ -17,7 +17,7 @@
*
******************************************************************************/
#define LOG_TAG "StEse-SecureElement"
-#include <log/log.h>
+#include <android_logmsg.h>
#include <stdlib.h>
#include <string.h>
@@ -44,14 +44,14 @@
::android::hardware::secure_element::V1_0::ISecureElementHalCallback>&
clientCallback) {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (clientCallback == nullptr) {
return Void();
} else {
mCallbackV1_0 = clientCallback;
mCallbackV1_1 = nullptr;
if (!mCallbackV1_0->linkToDeath(this, 0 /*cookie*/)) {
- ALOGE("%s: Failed to register death notification", __func__);
+ STLOG_HAL_E("%s: Failed to register death notification", __func__);
}
}
@@ -74,14 +74,14 @@
::android::hardware::secure_element::V1_1::ISecureElementHalCallback>&
clientCallback) {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (clientCallback == nullptr) {
return Void();
} else {
mCallbackV1_1 = clientCallback;
mCallbackV1_0 = nullptr;
if (!mCallbackV1_1->linkToDeath(this, 0 /*cookie*/)) {
- ALOGE("%s: Failed to register death notification", __func__);
+ STLOG_HAL_E("%s: Failed to register death notification", __func__);
}
}
@@ -101,7 +101,7 @@
}
Return<void> SecureElement::getAtr(getAtr_cb _hidl_cb) {
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
hidl_vec<uint8_t> response;
uint8_t* ATR;
ATR = StEse_getAtr();
@@ -126,7 +126,7 @@
memset(&cmdApdu, 0x00, sizeof(StEse_data));
memset(&rspApdu, 0x00, sizeof(StEse_data));
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
cmdApdu.len = data.size();
if (cmdApdu.len >= MIN_APDU_LENGTH) {
cmdApdu.p_data = (uint8_t*)malloc(data.size() * sizeof(uint8_t));
@@ -136,7 +136,7 @@
hidl_vec<uint8_t> result;
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: transmit failed!!!", __func__);
+ STLOG_HAL_E("%s: transmit failed!!!", __func__);
seHalResetSe();
} else {
result.resize(rspApdu.len);
@@ -156,13 +156,13 @@
LogicalChannelResponse resApduBuff;
resApduBuff.channelNumber = 0xff;
memset(&resApduBuff, 0x00, sizeof(resApduBuff));
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
- ALOGD("%s: Enter SeInitialized", __func__);
+ STLOG_HAL_D("%s: Enter SeInitialized", __func__);
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
_hidl_cb(resApduBuff, SecureElementStatus::IOERROR);
OpenLogicalChannelProcessing = false;
return Void();
@@ -216,12 +216,12 @@
/*If manageChannel is failed in any of above cases
send the callback and return*/
_hidl_cb(resApduBuff, sestatus);
- ALOGE("%s: Exit - manage channel failed!!", __func__);
+ STLOG_HAL_E("%s: Exit - manage channel failed!!", __func__);
OpenLogicalChannelProcessing = false;
return Void();
}
- ALOGD("%s: Sending selectApdu", __func__);
+ STLOG_HAL_D("%s: Sending selectApdu", __func__);
/*Reset variables if manageChannel is success*/
sestatus = SecureElementStatus::IOERROR;
status = ESESTATUS_FAILED;
@@ -272,11 +272,11 @@
if (sestatus == SecureElementStatus::IOERROR) {
seHalResetSe();
} else {
- ALOGE("%s: Select APDU failed! Close channel..", __func__);
+ STLOG_HAL_E("%s: Select APDU failed! Close channel..", __func__);
SecureElementStatus closeChannelStatus =
closeChannel(resApduBuff.channelNumber);
if (closeChannelStatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: closeChannel Failed", __func__);
+ STLOG_HAL_E("%s: closeChannel Failed", __func__);
} else {
resApduBuff.channelNumber = 0xff;
}
@@ -285,7 +285,7 @@
_hidl_cb(resApduBuff, sestatus);
free(cmdApdu.p_data);
free(rspApdu.p_data);
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
OpenLogicalChannelProcessing = false;
return Void();
}
@@ -295,12 +295,12 @@
openBasicChannel_cb _hidl_cb) {
hidl_vec<uint8_t> result;
OpenBasicChannelProcessing = true;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
_hidl_cb(result, SecureElementStatus::IOERROR);
OpenBasicChannelProcessing = false;
return Void();
@@ -368,13 +368,13 @@
SecureElementStatus closeChannelStatus =
closeChannel(DEFAULT_BASIC_CHANNEL);
if (closeChannelStatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: closeChannel Failed", __func__);
+ STLOG_HAL_E("%s: closeChannel Failed", __func__);
}
}
_hidl_cb(result, sestatus);
free(cmdApdu.p_data);
free(rspApdu.p_data);
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
OpenBasicChannelProcessing = false;
return Void();
}
@@ -387,12 +387,12 @@
StEse_data cmdApdu;
StEse_data rspApdu;
- ALOGD("%s: Enter : %d", __func__, channelNumber);
+ STLOG_HAL_D("%s: Enter : %d", __func__, channelNumber);
if ((channelNumber < DEFAULT_BASIC_CHANNEL) ||
(channelNumber >= MAX_LOGICAL_CHANNELS) ||
(mOpenedChannels[channelNumber] == false)) {
- ALOGE("%s: invalid channel!!!", __func__);
+ STLOG_HAL_E("%s: invalid channel!!!", __func__);
sestatus = SecureElementStatus::FAILED;
} else if (channelNumber > DEFAULT_BASIC_CHANNEL) {
memset(&cmdApdu, 0x00, sizeof(StEse_data));
@@ -424,7 +424,8 @@
if ((channelNumber == DEFAULT_BASIC_CHANNEL) ||
(sestatus == SecureElementStatus::SUCCESS)) {
- ALOGD("%s: Closing channel : %d is successful ", __func__, channelNumber);
+ STLOG_HAL_D("%s: Closing channel : %d is successful ", __func__,
+ channelNumber);
mOpenedChannels[channelNumber] = false;
mOpenedchannelCount--;
/*If there are no channels remaining close secureElement*/
@@ -436,15 +437,15 @@
}
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return sestatus;
}
void SecureElement::serviceDied(uint64_t /*cookie*/, const wp<IBase>& /*who*/) {
- ALOGE("%s: SecureElement serviceDied!!!", __func__);
+ STLOG_HAL_E("%s: SecureElement serviceDied!!!", __func__);
SecureElementStatus sestatus = seHalDeInit();
if (sestatus != SecureElementStatus::SUCCESS) {
- ALOGE("%s: seHalDeInit Faliled!!!", __func__);
+ STLOG_HAL_E("%s: seHalDeInit Faliled!!!", __func__);
}
if (mCallbackV1_1 != nullptr) {
mCallbackV1_1->unlinkToDeath(this);
@@ -457,23 +458,23 @@
ESESTATUS SecureElement::seHalInit() {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
status = StEse_init();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: SecureElement open failed!!!", __func__);
+ STLOG_HAL_E("%s: SecureElement open failed!!!", __func__);
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return status;
}
void SecureElement::seHalResetSe() {
ESESTATUS status = ESESTATUS_SUCCESS;
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
if (!isSeInitialized()) {
ESESTATUS status = seHalInit();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: seHalInit Failed!!!", __func__);
+ STLOG_HAL_E("%s: seHalInit Failed!!!", __func__);
}
}
@@ -482,7 +483,7 @@
status = StEse_Reset();
if (status != ESESTATUS_SUCCESS) {
- ALOGE("%s: SecureElement reset failed!!", __func__);
+ STLOG_HAL_E("%s: SecureElement reset failed!!", __func__);
} else {
for (uint8_t xx = 0; xx < MAX_LOGICAL_CHANNELS; xx++) {
mOpenedChannels[xx] = false;
@@ -491,12 +492,12 @@
mCallbackV1_1->onStateChange_1_1(true, "SE initialized");
}
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
}
Return<::android::hardware::secure_element::V1_0::SecureElementStatus>
SecureElement::seHalDeInit() {
- ALOGD("%s: Enter", __func__);
+ STLOG_HAL_D("%s: Enter", __func__);
ESESTATUS status = ESESTATUS_SUCCESS;
SecureElementStatus sestatus = SecureElementStatus::FAILED;
status = StEse_close();
@@ -510,7 +511,7 @@
}
mOpenedchannelCount = 0;
}
- ALOGV("%s: Exit", __func__);
+ STLOG_HAL_V("%s: Exit", __func__);
return sestatus;
}
diff --git a/ese-spi-driver/Android.bp b/ese-spi-driver/Android.bp
index 282ba81..b67ce5e 100644
--- a/ese-spi-driver/Android.bp
+++ b/ese-spi-driver/Android.bp
@@ -20,9 +20,7 @@
"utils-lib/DataMgmt.cc",
],
- local_include_dirs: [
- "utils-lib",
- ],
+ export_include_dirs: ["utils-lib"],
cflags: [
"-DANDROID",
"-DBUILDCFG=1",
diff --git a/ese-spi-driver/StEseApi.cc b/ese-spi-driver/StEseApi.cc
index c31549c..9f046d7 100644
--- a/ese-spi-driver/StEseApi.cc
+++ b/ese-spi-driver/StEseApi.cc
@@ -31,7 +31,7 @@
/* ESE Context structure */
ese_Context_t ese_ctxt;
-const char* halVersion = "ST54-SE HAL1.0 Version 1.0.19";
+const char* halVersion = "ST54-SE HAL1.0 Version 1.0.20";
pthread_mutex_t mutex;
@@ -76,8 +76,6 @@
memset(&ese_ctxt, 0x00, sizeof(ese_ctxt));
memset(&tSpiDriver, 0x00, sizeof(tSpiDriver));
- ALOGE("MW SEAccessKit Version");
-
/* initialize trace level */
StEseLog_InitializeLogLevel();
diff --git a/ese-spi-driver/utils-lib/android_logmsg.cc b/ese-spi-driver/utils-lib/android_logmsg.cc
index 6d90f64..822350a 100644
--- a/ese-spi-driver/utils-lib/android_logmsg.cc
+++ b/ese-spi-driver/utils-lib/android_logmsg.cc
@@ -48,7 +48,7 @@
num = 1;
num = EseConfig::getUnsigned(NAME_STESE_HAL_LOGLEVEL, 0);
- if (num != 0) hal_trace_level = (unsigned char)num;
+ if (num >= 0) hal_trace_level = (unsigned char)num;
STLOG_HAL_D("%s: level=%u", __func__, hal_trace_level);
return hal_trace_level;