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

Commit c8e49491 authored by Yi Kong's avatar Yi Kong Committed by Android (Google) Code Review
Browse files

Merge "[sensorservice] Modernize codebase by replacing NULL with nullptr"

parents 9b14ac68 8f313e3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ void BatteryService::cleanupImpl(uid_t uid) {
bool BatteryService::checkService() {
    if (mBatteryStatService == nullptr) {
        const sp<IServiceManager> sm(defaultServiceManager());
        if (sm != NULL) {
        if (sm != nullptr) {
            const String16 name("batterystats");
            mBatteryStatService = interface_cast<IBatteryStats>(sm->getService(name));
        }
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ const char* RotationVectorSensor::getSensorName() const {
            return "GeoMag Rotation Vector Sensor";
        default:
            assert(0);
            return NULL;
            return nullptr;
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {

    if(numHidlTransportErrors > 0) {
        ALOGE("Saw %d Hidl transport failures", numHidlTransportErrors);
        HidlTransportErrorLog errLog(time(NULL), numHidlTransportErrors);
        HidlTransportErrorLog errLog(time(nullptr), numHidlTransportErrors);
        mHidlTransportErrors.add(errLog);
        mTotalHidlTransportErrors++;
    }
+4 −4
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ SensorService::SensorEventConnection::SensorEventConnection(
        const sp<SensorService>& service, uid_t uid, String8 packageName, bool isDataInjectionMode,
        const String16& opPackageName, bool hasSensorAccess)
    : mService(service), mUid(uid), mWakeLockRefCount(0), mHasLooperCallbacks(false),
      mDead(false), mDataInjectionMode(isDataInjectionMode), mEventCache(NULL),
      mDead(false), mDataInjectionMode(isDataInjectionMode), mEventCache(nullptr),
      mCacheSize(0), mMaxCacheSize(0), mPackageName(packageName), mOpPackageName(opPackageName),
      mDestroyed(false), mHasSensorAccess(hasSensorAccess) {
    mChannel = new BitTube(mService->mSocketBufferSize);
@@ -55,7 +55,7 @@ void SensorService::SensorEventConnection::destroy() {
    }

    mService->cleanupConnection(this);
    if (mEventCache != NULL) {
    if (mEventCache != nullptr) {
        delete[] mEventCache;
    }
    mDestroyed = true;
@@ -200,7 +200,7 @@ void SensorService::SensorEventConnection::updateLooperRegistrationLocked(

    // Add the file descriptor to the Looper for receiving acknowledegments if the app has
    // registered for wake-up sensors OR for sending events in the cache.
    int ret = looper->addFd(mChannel->getSendFd(), 0, looper_flags, this, NULL);
    int ret = looper->addFd(mChannel->getSendFd(), 0, looper_flags, this, nullptr);
    if (ret == 1) {
        ALOGD_IF(DEBUG_CONNECTIONS, "%p addFd fd=%d", this, mChannel->getSendFd());
        mHasLooperCallbacks = true;
@@ -371,7 +371,7 @@ status_t SensorService::SensorEventConnection::sendEvents(
            --mTotalAcksNeeded;
#endif
        }
        if (mEventCache == NULL) {
        if (mEventCache == nullptr) {
            mMaxCacheSize = computeMaxCacheSizeLocked();
            mEventCache = new sensors_event_t[mMaxCacheSize];
            mCacheSize = 0;
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ public:
                          bool hasSensorAccess);

    status_t sendEvents(sensors_event_t const* buffer, size_t count, sensors_event_t* scratch,
                        wp<const SensorEventConnection> const * mapFlushEventsToConnections = NULL);
                        wp<const SensorEventConnection> const * mapFlushEventsToConnections = nullptr);
    bool hasSensor(int32_t handle) const;
    bool hasAnySensor() const;
    bool hasOneShotSensors() const;
Loading