am 20914f0a: am a4e345e1: Merge "sensorservice: 64-bit compile issues"

* commit '20914f0ad3691d977f61f1d4b92b49535e8f6f33':
  sensorservice: 64-bit compile issues
This commit is contained in:
Mark Salyzyn 2014-06-12 16:13:39 +00:00 committed by Android Git Automerger
commit c46422ed2b
2 changed files with 20 additions and 17 deletions

View File

@ -14,8 +14,9 @@
* limitations under the License.
*/
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <sys/types.h>
#include <utils/Atomic.h>
@ -134,11 +135,11 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
Info& info( mActivationCount.editValueFor(handle) );
ALOGD_IF(DEBUG_CONNECTIONS,
"SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%d",
"SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%zu",
ident, handle, enabled, info.batchParams.size());
if (enabled) {
ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%d", info.batchParams.indexOfKey(ident));
ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%zd", info.batchParams.indexOfKey(ident));
if (info.batchParams.indexOfKey(ident) >= 0) {
if (info.batchParams.size() == 1) {
@ -150,7 +151,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
ALOGE("\t >>>ERROR: activate called without batch");
}
} else {
ALOGD_IF(DEBUG_CONNECTIONS, "disable index=%d", info.batchParams.indexOfKey(ident));
ALOGD_IF(DEBUG_CONNECTIONS, "disable index=%zd", info.batchParams.indexOfKey(ident));
if (info.removeBatchParamsForIdent(ident) >= 0) {
if (info.batchParams.size() == 0) {
@ -163,7 +164,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
// batch_rate and timeout. One of the apps has unregistered for sensor
// events, and the best effort batch parameters might have changed.
ALOGD_IF(DEBUG_CONNECTIONS,
"\t>>> actuating h/w batch %d %d %lld %lld ", handle,
"\t>>> actuating h/w batch %d %d %" PRId64 " %" PRId64, handle,
info.bestBatchParams.flags, info.bestBatchParams.batchDelay,
info.bestBatchParams.batchTimeout);
mSensorDevice->batch(mSensorDevice, handle,info.bestBatchParams.flags,
@ -191,7 +192,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
// On older devices which do not support batch, call setDelay().
if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_1 && info.batchParams.size() > 0) {
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w setDelay %d %lld ", handle,
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w setDelay %d %" PRId64, handle,
info.bestBatchParams.batchDelay);
mSensorDevice->setDelay(
reinterpret_cast<struct sensors_poll_device_t *>(mSensorDevice),
@ -231,7 +232,7 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin
}
ALOGD_IF(DEBUG_CONNECTIONS,
"SensorDevice::batch: ident=%p, handle=0x%08x, flags=%d, period_ns=%lld timeout=%lld",
"SensorDevice::batch: ident=%p, handle=0x%08x, flags=%d, period_ns=%" PRId64 " timeout=%" PRId64,
ident, handle, flags, samplingPeriodNs, maxBatchReportLatencyNs);
Mutex::Autolock _l(mLock);
@ -250,7 +251,8 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin
info.selectBatchParams();
ALOGD_IF(DEBUG_CONNECTIONS,
"\t>>> curr_period=%lld min_period=%lld curr_timeout=%lld min_timeout=%lld",
"\t>>> curr_period=%" PRId64 " min_period=%" PRId64
" curr_timeout=%" PRId64 " min_timeout=%" PRId64,
prevBestBatchParams.batchDelay, info.bestBatchParams.batchDelay,
prevBestBatchParams.batchTimeout, info.bestBatchParams.batchTimeout);
@ -258,7 +260,7 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin
// If the min period or min timeout has changed since the last batch call, call batch.
if (prevBestBatchParams != info.bestBatchParams) {
if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) {
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w BATCH %d %d %lld %lld ", handle,
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w BATCH %d %d %" PRId64 " %" PRId64, handle,
info.bestBatchParams.flags, info.bestBatchParams.batchDelay,
info.bestBatchParams.batchTimeout);
err = mSensorDevice->batch(mSensorDevice, handle, info.bestBatchParams.flags,
@ -270,7 +272,8 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin
// call setDelay in SensorDevice::activate() method.
}
if (err != NO_ERROR) {
ALOGE("sensor batch failed %p %d %d %lld %lld err=%s", mSensorDevice, handle,
ALOGE("sensor batch failed %p %d %d %" PRId64 " %" PRId64 " err=%s",
mSensorDevice, handle,
info.bestBatchParams.flags, info.bestBatchParams.batchDelay,
info.bestBatchParams.batchTimeout, strerror(-err));
info.removeBatchParamsForIdent(ident);
@ -324,7 +327,7 @@ status_t SensorDevice::Info::setBatchParamsForIdent(void* ident, int flags,
int64_t maxBatchReportLatencyNs) {
ssize_t index = batchParams.indexOfKey(ident);
if (index < 0) {
ALOGE("Info::setBatchParamsForIdent(ident=%p, period_ns=%lld timeout=%lld) failed (%s)",
ALOGE("Info::setBatchParamsForIdent(ident=%p, period_ns=%" PRId64 " timeout=%" PRId64 ") failed (%s)",
ident, samplingPeriodNs, maxBatchReportLatencyNs, strerror(-index));
return BAD_INDEX;
}

View File

@ -378,7 +378,7 @@ bool SensorService::threadLoop()
for (size_t j=0 ; j<activeVirtualSensorCount ; j++) {
if (count + k >= minBufferSize) {
ALOGE("buffer too small to hold all events: "
"count=%u, k=%u, size=%u",
"count=%zd, k=%zu, size=%zu",
count, k, minBufferSize);
break;
}
@ -522,11 +522,11 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
Mutex::Autolock _l(mLock);
const wp<SensorEventConnection> connection(c);
size_t size = mActiveSensors.size();
ALOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size);
ALOGD_IF(DEBUG_CONNECTIONS, "%zu active sensors", size);
for (size_t i=0 ; i<size ; ) {
int handle = mActiveSensors.keyAt(i);
if (c->hasSensor(handle)) {
ALOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle);
ALOGD_IF(DEBUG_CONNECTIONS, "%zu: disabling handle=0x%08x", i, handle);
SensorInterface* sensor = mSensorMap.valueFor( handle );
ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
if (sensor) {
@ -534,9 +534,9 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
}
}
SensorRecord* rec = mActiveSensors.valueAt(i);
ALOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle);
ALOGE_IF(!rec, "mActiveSensors[%zu] is null (handle=0x%08x)!", i, handle);
ALOGD_IF(DEBUG_CONNECTIONS,
"removing connection %p for sensor[%d].handle=0x%08x",
"removing connection %p for sensor[%zu].handle=0x%08x",
c, i, handle);
if (rec && rec->removeConnection(connection)) {
@ -625,7 +625,7 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
samplingPeriodNs = minDelayNs;
}
ALOGD_IF(DEBUG_CONNECTIONS, "Calling batch handle==%d flags=%d rate=%lld timeout== %lld",
ALOGD_IF(DEBUG_CONNECTIONS, "Calling batch handle==%d flags=%d rate=%" PRId64 " timeout== %" PRId64,
handle, reservedFlags, samplingPeriodNs, maxBatchReportLatencyNs);
status_t err = sensor->batch(connection.get(), handle, reservedFlags, samplingPeriodNs,