am a4e345e1
: Merge "sensorservice: 64-bit compile issues"
* commit 'a4e345e169fd9101011e358abdfb9308bc065bdb': sensorservice: 64-bit compile issues
This commit is contained in:
commit
20914f0ad3
@ -14,8 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <inttypes.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <utils/Atomic.h>
|
#include <utils/Atomic.h>
|
||||||
@ -134,11 +135,11 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
|
|||||||
Info& info( mActivationCount.editValueFor(handle) );
|
Info& info( mActivationCount.editValueFor(handle) );
|
||||||
|
|
||||||
ALOGD_IF(DEBUG_CONNECTIONS,
|
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());
|
ident, handle, enabled, info.batchParams.size());
|
||||||
|
|
||||||
if (enabled) {
|
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.indexOfKey(ident) >= 0) {
|
||||||
if (info.batchParams.size() == 1) {
|
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");
|
ALOGE("\t >>>ERROR: activate called without batch");
|
||||||
}
|
}
|
||||||
} else {
|
} 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.removeBatchParamsForIdent(ident) >= 0) {
|
||||||
if (info.batchParams.size() == 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
|
// batch_rate and timeout. One of the apps has unregistered for sensor
|
||||||
// events, and the best effort batch parameters might have changed.
|
// events, and the best effort batch parameters might have changed.
|
||||||
ALOGD_IF(DEBUG_CONNECTIONS,
|
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.flags, info.bestBatchParams.batchDelay,
|
||||||
info.bestBatchParams.batchTimeout);
|
info.bestBatchParams.batchTimeout);
|
||||||
mSensorDevice->batch(mSensorDevice, handle,info.bestBatchParams.flags,
|
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().
|
// On older devices which do not support batch, call setDelay().
|
||||||
if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_1 && info.batchParams.size() > 0) {
|
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);
|
info.bestBatchParams.batchDelay);
|
||||||
mSensorDevice->setDelay(
|
mSensorDevice->setDelay(
|
||||||
reinterpret_cast<struct sensors_poll_device_t *>(mSensorDevice),
|
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,
|
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);
|
ident, handle, flags, samplingPeriodNs, maxBatchReportLatencyNs);
|
||||||
|
|
||||||
Mutex::Autolock _l(mLock);
|
Mutex::Autolock _l(mLock);
|
||||||
@ -250,7 +251,8 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin
|
|||||||
info.selectBatchParams();
|
info.selectBatchParams();
|
||||||
|
|
||||||
ALOGD_IF(DEBUG_CONNECTIONS,
|
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.batchDelay, info.bestBatchParams.batchDelay,
|
||||||
prevBestBatchParams.batchTimeout, info.bestBatchParams.batchTimeout);
|
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 the min period or min timeout has changed since the last batch call, call batch.
|
||||||
if (prevBestBatchParams != info.bestBatchParams) {
|
if (prevBestBatchParams != info.bestBatchParams) {
|
||||||
if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) {
|
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.flags, info.bestBatchParams.batchDelay,
|
||||||
info.bestBatchParams.batchTimeout);
|
info.bestBatchParams.batchTimeout);
|
||||||
err = mSensorDevice->batch(mSensorDevice, handle, info.bestBatchParams.flags,
|
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.
|
// call setDelay in SensorDevice::activate() method.
|
||||||
}
|
}
|
||||||
if (err != NO_ERROR) {
|
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.flags, info.bestBatchParams.batchDelay,
|
||||||
info.bestBatchParams.batchTimeout, strerror(-err));
|
info.bestBatchParams.batchTimeout, strerror(-err));
|
||||||
info.removeBatchParamsForIdent(ident);
|
info.removeBatchParamsForIdent(ident);
|
||||||
@ -324,7 +327,7 @@ status_t SensorDevice::Info::setBatchParamsForIdent(void* ident, int flags,
|
|||||||
int64_t maxBatchReportLatencyNs) {
|
int64_t maxBatchReportLatencyNs) {
|
||||||
ssize_t index = batchParams.indexOfKey(ident);
|
ssize_t index = batchParams.indexOfKey(ident);
|
||||||
if (index < 0) {
|
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));
|
ident, samplingPeriodNs, maxBatchReportLatencyNs, strerror(-index));
|
||||||
return BAD_INDEX;
|
return BAD_INDEX;
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ bool SensorService::threadLoop()
|
|||||||
for (size_t j=0 ; j<activeVirtualSensorCount ; j++) {
|
for (size_t j=0 ; j<activeVirtualSensorCount ; j++) {
|
||||||
if (count + k >= minBufferSize) {
|
if (count + k >= minBufferSize) {
|
||||||
ALOGE("buffer too small to hold all events: "
|
ALOGE("buffer too small to hold all events: "
|
||||||
"count=%u, k=%u, size=%u",
|
"count=%zd, k=%zu, size=%zu",
|
||||||
count, k, minBufferSize);
|
count, k, minBufferSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -525,11 +525,11 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
|
|||||||
Mutex::Autolock _l(mLock);
|
Mutex::Autolock _l(mLock);
|
||||||
const wp<SensorEventConnection> connection(c);
|
const wp<SensorEventConnection> connection(c);
|
||||||
size_t size = mActiveSensors.size();
|
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 ; ) {
|
for (size_t i=0 ; i<size ; ) {
|
||||||
int handle = mActiveSensors.keyAt(i);
|
int handle = mActiveSensors.keyAt(i);
|
||||||
if (c->hasSensor(handle)) {
|
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 );
|
SensorInterface* sensor = mSensorMap.valueFor( handle );
|
||||||
ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
|
ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
|
||||||
if (sensor) {
|
if (sensor) {
|
||||||
@ -537,9 +537,9 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SensorRecord* rec = mActiveSensors.valueAt(i);
|
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,
|
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);
|
c, i, handle);
|
||||||
|
|
||||||
if (rec && rec->removeConnection(connection)) {
|
if (rec && rec->removeConnection(connection)) {
|
||||||
@ -616,7 +616,7 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
|
|||||||
samplingPeriodNs = minDelayNs;
|
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);
|
handle, reservedFlags, samplingPeriodNs, maxBatchReportLatencyNs);
|
||||||
|
|
||||||
status_t err = sensor->batch(connection.get(), handle, reservedFlags, samplingPeriodNs,
|
status_t err = sensor->batch(connection.get(), handle, reservedFlags, samplingPeriodNs,
|
||||||
|
Loading…
Reference in New Issue
Block a user