Fix gralloc direct channel bug and polish log messages
1) Remove obsoleted stub code so that second gralloc direct channel
can be successfully registered.
2) Remove obsoleted misleading log messages.
3) Add missing log messages at failure to help debugging.
Bug: 36900495
Test: SensorDirectReportTest
Change-Id: I1d6941c4179338f6db8f84079844dce515b80516
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 4d76272..26f9143 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -978,6 +978,7 @@
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;
}
}
@@ -988,14 +989,15 @@
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);