Loading services/sensorservice/SensorDirectConnection.cpp +6 −9 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,6 @@ #include "SensorDirectConnection.h" #include "SensorDirectConnection.h" #include <hardware/sensors.h> #include <hardware/sensors.h> #include <sys/stat.h> #define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x) namespace android { namespace android { Loading Loading @@ -182,13 +180,12 @@ bool SensorService::SensorDirectConnection::isEquivalent(const sensors_direct_me if (mMem.type == mem->type) { if (mMem.type == mem->type) { switch (mMem.type) { switch (mMem.type) { case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { struct stat s1, s2; // there is no known method to test if two ashmem fds are equivalent besides int fd1, fd2; // trivially comparing the fd values (ino number from fstat() are always the fd1 = mMem.handle->data[0]; // same, pointing to "/dev/ashmem"). fd2 = mem->handle->data[0]; int fd1 = mMem.handle->data[0]; if (fstat(fd1, &s1) < 0 || fstat(fd2, &s2) < 0 || s1.st_ino == s2.st_ino) { int fd2 = mem->handle->data[0]; ret = true; ret = (fd1 == fd2); } break; break; } } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: case SENSOR_DIRECT_MEM_TYPE_GRALLOC: Loading Loading
services/sensorservice/SensorDirectConnection.cpp +6 −9 Original line number Original line Diff line number Diff line Loading @@ -18,8 +18,6 @@ #include "SensorDirectConnection.h" #include "SensorDirectConnection.h" #include <hardware/sensors.h> #include <hardware/sensors.h> #include <sys/stat.h> #define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x) namespace android { namespace android { Loading Loading @@ -182,13 +180,12 @@ bool SensorService::SensorDirectConnection::isEquivalent(const sensors_direct_me if (mMem.type == mem->type) { if (mMem.type == mem->type) { switch (mMem.type) { switch (mMem.type) { case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { struct stat s1, s2; // there is no known method to test if two ashmem fds are equivalent besides int fd1, fd2; // trivially comparing the fd values (ino number from fstat() are always the fd1 = mMem.handle->data[0]; // same, pointing to "/dev/ashmem"). fd2 = mem->handle->data[0]; int fd1 = mMem.handle->data[0]; if (fstat(fd1, &s1) < 0 || fstat(fd2, &s2) < 0 || s1.st_ino == s2.st_ino) { int fd2 = mem->handle->data[0]; ret = true; ret = (fd1 == fd2); } break; break; } } case SENSOR_DIRECT_MEM_TYPE_GRALLOC: case SENSOR_DIRECT_MEM_TYPE_GRALLOC: Loading