diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-03 11:21:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-03 11:21:00 +0000 |
commit | 54bb180f3a6973275c113426e955d25c0818d27d (patch) | |
tree | 4ddcbc534787a4d28b92d803308efeab328b1ed5 /apps | |
parent | 62908e8054c1c7e5c54bada7c7950a5e82f72cb6 (diff) | |
parent | db67bc50999b37abc31239a7ca6d8c9956ab25a1 (diff) | |
download | chre-54bb180f3a6973275c113426e955d25c0818d27d.tar.gz |
Merge changes I9450a54d,I43773101,I482e19c9 into rvc-dev
* changes:
Remove SensorType enum from proto file
Check that sensor type of samples are expected in AP code
Copy datapoints to immutable array to handle concurrency
Diffstat (limited to 'apps')
3 files changed, 14 insertions, 19 deletions
diff --git a/apps/test/common/chre_cross_validator/inc/chre_cross_validator_manager.h b/apps/test/common/chre_cross_validator/inc/chre_cross_validator_manager.h index ab4f3f74..fbbc6bb9 100644 --- a/apps/test/common/chre_cross_validator/inc/chre_cross_validator_manager.h +++ b/apps/test/common/chre_cross_validator/inc/chre_cross_validator_manager.h @@ -170,8 +170,7 @@ class Manager { * axis data. */ chre_cross_validation_Data makeSensorThreeAxisData( - const chreSensorThreeAxisData *threeAxisDataFromChre, - chre_cross_validation_SensorType sensorType); + const chreSensorThreeAxisData *threeAxisDataFromChre, uint8_t sensorType); /** * Handle sensor three axis data from CHRE. @@ -180,8 +179,7 @@ class Manager { * @param sensorType The sensor type that sent the three axis data. */ void handleSensorThreeAxisData( - const chreSensorThreeAxisData *threeAxisDataFromChre, - chre_cross_validation_SensorType sensorType); + const chreSensorThreeAxisData *threeAxisDataFromChre, uint8_t sensorType); /** * Encode and send data to be validated to host. diff --git a/apps/test/common/chre_cross_validator/src/chre_cross_validator_manager.cc b/apps/test/common/chre_cross_validator/src/chre_cross_validator_manager.cc index bd2f444c..eb7f4acb 100644 --- a/apps/test/common/chre_cross_validator/src/chre_cross_validator_manager.cc +++ b/apps/test/common/chre_cross_validator/src/chre_cross_validator_manager.cc @@ -72,7 +72,7 @@ void Manager::handleEvent(uint32_t senderInstanceId, uint16_t eventType, case CHRE_EVENT_SENSOR_ACCELEROMETER_DATA: handleSensorThreeAxisData( static_cast<const chreSensorThreeAxisData *>(eventData), - chre_cross_validation_SensorType_ACCELEROMETER); + CHRE_SENSOR_TYPE_ACCELEROMETER); break; default: LOGE("Got unknown event type from senderInstanceId %" PRIu32 @@ -144,7 +144,7 @@ bool Manager::encodeThreeAxisSensorDatapoints(pb_ostream_t *stream, bool Manager::handleStartSensorMessage( const chre_cross_validation_StartSensorCommand &startSensorCommand) { bool success = true; - uint8_t sensorType = startSensorCommand.sensorType; + uint8_t sensorType = startSensorCommand.apSensorType; uint64_t interval = startSensorCommand.samplingIntervalInNs; uint64_t latency = startSensorCommand.samplingMaxLatencyInNs; uint32_t handle; @@ -227,11 +227,10 @@ void Manager::handleMessageFromHost(uint32_t senderInstanceId, } chre_cross_validation_Data Manager::makeSensorThreeAxisData( - const chreSensorThreeAxisData *threeAxisDataFromChre, - chre_cross_validation_SensorType sensorType) { + const chreSensorThreeAxisData *threeAxisDataFromChre, uint8_t sensorType) { chre_cross_validation_SensorData newThreeAxisData = { - .has_sensorType = true, - .sensorType = sensorType, + .has_chreSensorType = true, + .chreSensorType = sensorType, .has_accuracy = true, .accuracy = threeAxisDataFromChre->header.accuracy, .datapoints = { @@ -248,8 +247,7 @@ chre_cross_validation_Data Manager::makeSensorThreeAxisData( } void Manager::handleSensorThreeAxisData( - const chreSensorThreeAxisData *threeAxisDataFromChre, - chre_cross_validation_SensorType sensorType) { + const chreSensorThreeAxisData *threeAxisDataFromChre, uint8_t sensorType) { if (!isValidHeader(threeAxisDataFromChre->header)) { LOGE("Invalid threeAxisData being thrown away"); } else if (!mCrossValidatorState.has_value()) { diff --git a/apps/test/common/proto/chre_cross_validation.proto b/apps/test/common/proto/chre_cross_validation.proto index a79c01eb..489afe09 100644 --- a/apps/test/common/proto/chre_cross_validation.proto +++ b/apps/test/common/proto/chre_cross_validation.proto @@ -20,19 +20,18 @@ enum MessageType { CHRE_CROSS_VALIDATION_DATA = 2; } -// Sensor types are passed in the StartSensorCommand message of CHRE cross -// validation and SensorDataHeader message. These enum values are the actual -// values described in the sensor_types.h file of the CHRE API. -enum SensorType { ACCELEROMETER = 1; } - message StartCommand { oneof command { StartSensorCommand startSensorCommand = 1; } } +/* + * apSensorType values defined in Sensor class of + * android/frameworks/base/core/java/android/hardware/Sensor.java + */ message StartSensorCommand { - optional SensorType sensorType = 1; + optional uint32 apSensorType = 1; optional uint64 samplingIntervalInNs = 2; optional uint64 samplingMaxLatencyInNs = 3; } @@ -48,7 +47,7 @@ message Data { * android/system/chre/chre_api/include/chre_api/chre/sensor_types.h */ message SensorData { - optional SensorType sensorType = 1; + optional uint32 chreSensorType = 1; optional uint32 accuracy = 2; repeated SensorDatapoint datapoints = 3; } |