Loading services/sensorservice/SensorDirectConnection.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -185,17 +185,18 @@ bool SensorService::SensorDirectConnection::isEquivalent(const sensors_direct_me struct stat s1, s2; int fd1, fd2; fd1 = mMem.handle->data[0]; fd2 = mem->handle->data[1]; fd2 = mem->handle->data[0]; if (fstat(fd1, &s1) < 0 || fstat(fd2, &s2) < 0 || s1.st_ino == s2.st_ino) { ret = true; } break; } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: LOG_FATAL("%s: Implement GRALLOC or remove", __FUNCTION__); ret = true; // there is no known method to test if two gralloc handle are equivalent ret = false; break; default: // should never happen ALOGE("Unexpected mem type %d", mMem.type); ret = true; break; Loading services/sensorservice/SensorService.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -978,6 +978,7 @@ sp<ISensorEventConnection> SensorService::createSensorDirectConnection( for (auto &i : mDirectConnections) { sp<SensorDirectConnection> connection(i.promote()); if (connection != nullptr && connection->isEquivalent(&mem)) { ALOGE("Duplicate create channel request for the same share memory"); return nullptr; } } Loading @@ -988,14 +989,15 @@ sp<ISensorEventConnection> SensorService::createSensorDirectConnection( int fd = resource->data[0]; int size2 = ashmem_get_size_region(fd); // check size consistency if (size2 != static_cast<int>(size)) { ALOGE("Ashmem direct channel size mismatch, %" PRIu32 " vs %d", size, size2); if (size2 < static_cast<int>(size)) { ALOGE("Ashmem direct channel size %" PRIu32 " greater than shared memory size %d", size, size2); return nullptr; } break; } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: LOG_FATAL("%s: Finish implementation of ION and GRALLOC or remove", __FUNCTION__); // no specific checks for gralloc break; default: ALOGE("Unknown direct connection memory type %d", type); Loading Loading
services/sensorservice/SensorDirectConnection.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -185,17 +185,18 @@ bool SensorService::SensorDirectConnection::isEquivalent(const sensors_direct_me struct stat s1, s2; int fd1, fd2; fd1 = mMem.handle->data[0]; fd2 = mem->handle->data[1]; fd2 = mem->handle->data[0]; if (fstat(fd1, &s1) < 0 || fstat(fd2, &s2) < 0 || s1.st_ino == s2.st_ino) { ret = true; } break; } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: LOG_FATAL("%s: Implement GRALLOC or remove", __FUNCTION__); ret = true; // there is no known method to test if two gralloc handle are equivalent ret = false; break; default: // should never happen ALOGE("Unexpected mem type %d", mMem.type); ret = true; break; Loading
services/sensorservice/SensorService.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -978,6 +978,7 @@ sp<ISensorEventConnection> SensorService::createSensorDirectConnection( for (auto &i : mDirectConnections) { sp<SensorDirectConnection> connection(i.promote()); if (connection != nullptr && connection->isEquivalent(&mem)) { ALOGE("Duplicate create channel request for the same share memory"); return nullptr; } } Loading @@ -988,14 +989,15 @@ sp<ISensorEventConnection> SensorService::createSensorDirectConnection( int fd = resource->data[0]; int size2 = ashmem_get_size_region(fd); // check size consistency if (size2 != static_cast<int>(size)) { ALOGE("Ashmem direct channel size mismatch, %" PRIu32 " vs %d", size, size2); if (size2 < static_cast<int>(size)) { ALOGE("Ashmem direct channel size %" PRIu32 " greater than shared memory size %d", size, size2); return nullptr; } break; } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: LOG_FATAL("%s: Finish implementation of ION and GRALLOC or remove", __FUNCTION__); // no specific checks for gralloc break; default: ALOGE("Unknown direct connection memory type %d", type); Loading