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

Commit d4036b6b authored by Andreas Gampe's avatar Andreas Gampe
Browse files

SensorService: Fix some warnings

For build-system CFLAGS clean-up, remove unused variables.

Also fix some warnings related to format strings, and signed
comparisons.

Bug: 18632512
Change-Id: I5e48dce36678c12069c0e162b920870de81b89f2
parent 59fe878c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -83,7 +83,7 @@ void BatteryService::cleanupImpl(uid_t uid) {
    if (mBatteryStatService != 0) {
    if (mBatteryStatService != 0) {
        Mutex::Autolock _l(mActivationsLock);
        Mutex::Autolock _l(mActivationsLock);
        int64_t identity = IPCThreadState::self()->clearCallingIdentity();
        int64_t identity = IPCThreadState::self()->clearCallingIdentity();
        for (ssize_t i=0 ; i<mActivations.size() ; i++) {
        for (size_t i=0 ; i<mActivations.size() ; i++) {
            const Info& info(mActivations[i]);
            const Info& info(mActivations[i]);
            if (info.uid == uid) {
            if (info.uid == uid) {
                mBatteryStatService->noteStopSensor(info.uid, info.handle);
                mBatteryStatService->noteStopSensor(info.uid, info.handle);
+0 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ GravitySensor::GravitySensor(sensor_t const* list, size_t count)
bool GravitySensor::process(sensors_event_t* outEvent,
bool GravitySensor::process(sensors_event_t* outEvent,
        const sensors_event_t& event)
        const sensors_event_t& event)
{
{
    const static double NS2S = 1.0 / 1000000000.0;
    if (event.type == SENSOR_TYPE_ACCELEROMETER) {
    if (event.type == SENSOR_TYPE_ACCELEROMETER) {
        vec3_t g;
        vec3_t g;
        if (!mSensorFusion.hasEstimate())
        if (!mSensorFusion.hasEstimate())
+1 −1
Original line number Original line Diff line number Diff line
@@ -388,7 +388,7 @@ void SensorDevice::disableAllSensors() {


status_t SensorDevice::injectSensorData(const sensors_event_t *injected_sensor_event) {
status_t SensorDevice::injectSensorData(const sensors_event_t *injected_sensor_event) {
      ALOGD_IF(DEBUG_CONNECTIONS,
      ALOGD_IF(DEBUG_CONNECTIONS,
              "sensor_event handle=%d ts=%lld data=%.2f, %.2f, %.2f %.2f %.2f %.2f",
              "sensor_event handle=%d ts=%" PRId64 " data=%.2f, %.2f, %.2f %.2f %.2f %.2f",
               injected_sensor_event->sensor,
               injected_sensor_event->sensor,
               injected_sensor_event->timestamp, injected_sensor_event->data[0],
               injected_sensor_event->timestamp, injected_sensor_event->data[0],
               injected_sensor_event->data[1], injected_sensor_event->data[2],
               injected_sensor_event->data[1], injected_sensor_event->data[2],
+5 −5
Original line number Original line Diff line number Diff line
@@ -118,7 +118,7 @@ void SensorService::onFirstRef()
            // it's safe to instantiate the SensorFusion object here
            // it's safe to instantiate the SensorFusion object here
            // (it wants to be instantiated after h/w sensors have been
            // (it wants to be instantiated after h/w sensors have been
            // registered)
            // registered)
            const SensorFusion& fusion(SensorFusion::getInstance());
            SensorFusion::getInstance();


            // build the sensor list returned to users
            // build the sensor list returned to users
            mUserSensorList = mSensorList;
            mUserSensorList = mSensorList;
@@ -381,7 +381,7 @@ status_t SensorService::dump(int fd, const Vector<String16>& args)
                        mActiveSensors.valueAt(i)->getNumConnections());
                        mActiveSensors.valueAt(i)->getNumConnections());
            }
            }


            result.appendFormat("Socket Buffer size = %d events\n",
            result.appendFormat("Socket Buffer size = %zd events\n",
                                mSocketBufferSize/sizeof(sensors_event_t));
                                mSocketBufferSize/sizeof(sensors_event_t));
            result.appendFormat("WakeLock Status: %s \n", mWakeLockAcquired ? "acquired" :
            result.appendFormat("WakeLock Status: %s \n", mWakeLockAcquired ? "acquired" :
                    "not held");
                    "not held");
@@ -1104,7 +1104,7 @@ bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,
        AppOpsManager appOps;
        AppOpsManager appOps;
        if (appOps.noteOp(opCode, IPCThreadState::self()->getCallingUid(), opPackageName)
        if (appOps.noteOp(opCode, IPCThreadState::self()->getCallingUid(), opPackageName)
                        != AppOpsManager::MODE_ALLOWED) {
                        != AppOpsManager::MODE_ALLOWED) {
            ALOGE("%s a sensor (%s) without enabled required app op: %D",
            ALOGE("%s a sensor (%s) without enabled required app op: %d",
                    operation, sensor.getName().string(), opCode);
                    operation, sensor.getName().string(), opCode);
            return false;
            return false;
        }
        }
@@ -1307,13 +1307,13 @@ void SensorService::CircularBuffer::printBuffer(String8& result) const {
        }
        }
        result.appendFormat("%d) ", eventNum++);
        result.appendFormat("%d) ", eventNum++);
        if (mSensorType == SENSOR_TYPE_STEP_COUNTER) {
        if (mSensorType == SENSOR_TYPE_STEP_COUNTER) {
            result.appendFormat("%llu,", mTrimmedSensorEventArr[i]->mStepCounter);
            result.appendFormat("%" PRIu64 ",", mTrimmedSensorEventArr[i]->mStepCounter);
        } else {
        } else {
            for (int j = 0; j < numData; ++j) {
            for (int j = 0; j < numData; ++j) {
                result.appendFormat("%5.1f,", mTrimmedSensorEventArr[i]->mData[j]);
                result.appendFormat("%5.1f,", mTrimmedSensorEventArr[i]->mData[j]);
            }
            }
        }
        }
        result.appendFormat("%lld %02d:%02d:%02d ", mTrimmedSensorEventArr[i]->mTimestamp,
        result.appendFormat("%" PRId64 " %02d:%02d:%02d ", mTrimmedSensorEventArr[i]->mTimestamp,
                mTrimmedSensorEventArr[i]->mHour, mTrimmedSensorEventArr[i]->mMin,
                mTrimmedSensorEventArr[i]->mHour, mTrimmedSensorEventArr[i]->mMin,
                mTrimmedSensorEventArr[i]->mSec);
                mTrimmedSensorEventArr[i]->mSec);
        i = (i + 1) % mBufSize;
        i = (i + 1) % mBufSize;
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ template <typename TYPE, size_t SIZE>
class vec;
class vec;


template <typename TYPE, size_t SIZE>
template <typename TYPE, size_t SIZE>
class vbase;
struct vbase;


namespace helpers {
namespace helpers {