diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-11-07 21:28:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-11-07 21:28:12 +0000 |
commit | 5a651961b08507cf4aa454114d888bfe39c7460e (patch) | |
tree | f01e2c629ff7c56feacf2bc58a0f33928b926d33 | |
parent | ce64df18175bf3999702c9b13925ab99ea66bb04 (diff) | |
parent | 377856d1bec154670ef1f703bb9fd7a45e92d906 (diff) | |
download | libhardware-5a651961b08507cf4aa454114d888bfe39c7460e.tar.gz |
Merge "Fix accidental implicit fallthroughs"
-rw-r--r-- | modules/sensors/dynamic_sensor/Android.bp | 2 | ||||
-rw-r--r-- | modules/sensors/dynamic_sensor/HidRawSensor.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp index 489cdf4c..214d97cf 100644 --- a/modules/sensors/dynamic_sensor/Android.bp +++ b/modules/sensors/dynamic_sensor/Android.bp @@ -22,8 +22,6 @@ cc_defaults { "-Wall", "-Werror", "-Wextra", - // Allow implicit fallthroughs in HidRawSensor.cpp until they are fixed. - "-Wno-error=implicit-fallthrough", ], export_include_dirs: ["."], diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp index ae6ef473..46684128 100644 --- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp +++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp @@ -676,6 +676,7 @@ bool HidRawSensor::detectAndroidCustomSensor(const std::string &description) { mFeatureInfo.type = SENSOR_TYPE_AMBIENT_TEMPERATURE; mFeatureInfo.typeString = SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE; typeParsed = true; + break; case SENSOR_TYPE_LIGHT: mFeatureInfo.type = SENSOR_TYPE_LIGHT; mFeatureInfo.typeString = SENSOR_STRING_TYPE_LIGHT; @@ -917,12 +918,14 @@ int HidRawSensor::batch(int64_t samplingPeriod, int64_t batchingPeriod) { periodMs = std::min(periodMs, static_cast<int64_t>(UINT16_MAX)); buffer[mReportIntervalOffset] = periodMs & 0xFF; buffer[mReportIntervalOffset + 1] = (periodMs >> 8) & 0xFF; + break; case sizeof(uint32_t): periodMs = std::min(periodMs, static_cast<int64_t>(UINT32_MAX)); buffer[mReportIntervalOffset] = periodMs & 0xFF; buffer[mReportIntervalOffset + 1] = (periodMs >> 8) & 0xFF; buffer[mReportIntervalOffset + 2] = (periodMs >> 16) & 0xFF; buffer[mReportIntervalOffset + 3] = (periodMs >> 24) & 0xFF; + break; } ok = device->setFeature(id, buffer); } |