Merge "Fix HalPowerHidlTargetProfilingTest"
diff --git a/contexthub/1.0/IContexthub.hal b/contexthub/1.0/IContexthub.hal
index 1d136d3..42f2e2d 100644
--- a/contexthub/1.0/IContexthub.hal
+++ b/contexthub/1.0/IContexthub.hal
@@ -18,6 +18,13 @@
import IContexthubCallback;
+/*
+ * The Context Hub HAL provides an interface to a separate low-power processing
+ * domain that has direct access to contextual information, such as sensors.
+ * Native applications that run within a context hub are known as nanoapps, and
+ * they execute within the Context Hub Runtime Environment (CHRE), which is
+ * standardized via the CHRE API, defined elsewhere.
+ */
interface IContexthub {
/*
* Enumerate all available context hubs on the system.
diff --git a/contexthub/1.0/types.hal b/contexthub/1.0/types.hal
index d7e5673..2326b58 100644
--- a/contexthub/1.0/types.hal
+++ b/contexthub/1.0/types.hal
@@ -128,6 +128,22 @@
uint32_t maxSupportedMsgLen;// This is the maximum size of the message that can
// be sent to the hub in one chunk (in bytes)
+
+ // Machine-readable CHRE platform ID, returned to nanoapps in the CHRE API
+ // function call chreGetPlatformId(). The most significant 5 bytes of this
+ // value identify the vendor, while the remaining bytes are set by the
+ // vendor to uniquely identify each different CHRE implementation/hardware
+ // that the vendor supplies. This field pairs with the patch version part of
+ // chreVersion to fully specify the CHRE implementation version. See also
+ // the CHRE API header file chre/version.h.
+ uint64_t chrePlatformId;
+
+ // CHRE implementation version, returned to nanoApps in the CHRE API
+ // function call chreGetVersion(). This value consists of the implemented
+ // CHRE API version (major version in most significant byte, followed by
+ // minor version), and the platform-specific implementation patch version
+ // in the lower two bytes. See also the CHRE API header file chre/version.h.
+ uint32_t chreVersion;
};
struct ContextHubMsg {
diff --git a/dumpstate/1.0/default/Android.mk b/dumpstate/1.0/default/Android.mk
index 4d5c908..0b15184 100644
--- a/dumpstate/1.0/default/Android.mk
+++ b/dumpstate/1.0/default/Android.mk
@@ -1,22 +1,22 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.dumpstate@1.0-impl
+LOCAL_MODULE := android.hardware.dumpstate@1.0-service
+LOCAL_INIT_RC := android.hardware.dumpstate@1.0-service.rc
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
DumpstateDevice.cpp \
+ service.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.dumpstate@1.0 \
libbase \
libcutils \
+ libdumpstateutil \
libhidlbase \
libhidltransport \
libhwbinder \
liblog \
libutils
-LOCAL_STATIC_LIBRARIES := \
- libdumpstateutil
-
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_EXECUTABLE)
diff --git a/dumpstate/1.0/default/DumpstateDevice.cpp b/dumpstate/1.0/default/DumpstateDevice.cpp
index 4264235..8000d85 100644
--- a/dumpstate/1.0/default/DumpstateDevice.cpp
+++ b/dumpstate/1.0/default/DumpstateDevice.cpp
@@ -22,6 +22,9 @@
#include "DumpstateUtil.h"
+using android::os::dumpstate::DumpFileToFd;
+using android::os::dumpstate::RunCommandToFd;
+
namespace android {
namespace hardware {
namespace dumpstate {
@@ -30,6 +33,10 @@
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
+ // NOTE: this is just an example on how to use the DumpstateUtil.h functions to implement
+ // this interface - since HIDL_FETCH_IDumpstateDevice() is not defined, this function will never
+ // be called by dumpstate.
+
if (handle->numFds < 1) {
ALOGE("no FDs\n");
return Void();
@@ -51,13 +58,6 @@
return Void();
}
-
-IDumpstateDevice* HIDL_FETCH_IDumpstateDevice(const char* /* name */) {
- // TODO: temporary returning nullptr until it's implemented on master devices
- return nullptr;
-// return new DumpstateDevice();
-}
-
} // namespace implementation
} // namespace V1_0
} // namespace dumpstate
diff --git a/dumpstate/1.0/default/DumpstateDevice.h b/dumpstate/1.0/default/DumpstateDevice.h
index f216304..f8585f5 100644
--- a/dumpstate/1.0/default/DumpstateDevice.h
+++ b/dumpstate/1.0/default/DumpstateDevice.h
@@ -41,8 +41,6 @@
};
-extern "C" IDumpstateDevice* HIDL_FETCH_IDumpstateDevice(const char* name);
-
} // namespace implementation
} // namespace V1_0
} // namespace dumpstate
diff --git a/dumpstate/1.0/default/android.hardware.dumpstate@1.0-service.rc b/dumpstate/1.0/default/android.hardware.dumpstate@1.0-service.rc
new file mode 100644
index 0000000..99b968e
--- /dev/null
+++ b/dumpstate/1.0/default/android.hardware.dumpstate@1.0-service.rc
@@ -0,0 +1,4 @@
+service dumpstate-1-0 /system/bin/hw/android.hardware.dumpstate@1.0-service
+ class hal
+ user system
+ group system
diff --git a/dumpstate/1.0/default/service.cpp b/dumpstate/1.0/default/service.cpp
new file mode 100644
index 0000000..0d5bd94
--- /dev/null
+++ b/dumpstate/1.0/default/service.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.dumpstate@1.0-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "DumpstateDevice.h"
+
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
+using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::sp;
+
+int main (int /* argc */, char * /* argv */ []) {
+ sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
+ configureRpcThreadpool(1, true);
+ dumpstate->registerAsService("dumpstate");
+ joinRpcThreadpool();
+}
diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal
index b072807..eb66d78 100644
--- a/gnss/1.0/IGnssCallback.hal
+++ b/gnss/1.0/IGnssCallback.hal
@@ -29,21 +29,21 @@
* If this is not set, then the framework will use 1000ms for
* minInterval and will call start() and stop() to schedule the GNSS.
*/
- SCHEDULING = 1 << 0,
+ SCHEDULING = 1 << 0,
/** GNSS supports MS-Based AGNSS mode */
- MSB = 1 << 1,
+ MSB = 1 << 1,
/** GNSS supports MS-Assisted AGNSS mode */
- MSA = 1 << 2,
+ MSA = 1 << 2,
/** GNSS supports single-shot fixes */
- SINGLE_SHOT = 1 << 3,
+ SINGLE_SHOT = 1 << 3,
/** GNSS supports on demand time injection */
- ON_DEMAND_TIME = 1 << 4,
+ ON_DEMAND_TIME = 1 << 4,
/** GNSS supports Geofencing */
- GEOFENCING = 1 << 5,
- /** GNSS supports Measurements. */
- MEASUREMENTS = 1 << 6,
+ GEOFENCING = 1 << 5,
+ /** GNSS supports Measurements for at least GPS. */
+ MEASUREMENTS = 1 << 6,
/** GNSS supports Navigation Messages */
- NAV_MESSAGES = 1 << 7,
+ NAV_MESSAGES = 1 << 7
};
/* GNSS status event values. */
@@ -64,10 +64,11 @@
* Flags that indicate information about the satellite
*/
enum GnssSvFlags : uint8_t {
- NONE = 0,
- HAS_EPHEMERIS_DATA = 1 << 0,
- HAS_ALMANAC_DATA = 1 << 1,
- USED_IN_FIX = 1 << 2
+ NONE = 0,
+ HAS_EPHEMERIS_DATA = 1 << 0,
+ HAS_ALMANAC_DATA = 1 << 1,
+ USED_IN_FIX = 1 << 2,
+ HAS_CARRIER_FREQUENCY = 1 << 3
};
struct GnssSvInfo {
@@ -109,6 +110,17 @@
float azimuthDegrees;
/*
+ * Carrier frequency of the signal tracked, for example it can be the
+ * GPS L1 = 1.57542e9 Hz, or L2, L5, varying GLO channels, etc. If
+ * the field is not set, it is the primary common use frequency,
+ * e.g. L1 for GPS.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_CARRIER_FREQUENCY.
+ */
+ float carrierFrequencyHz;
+
+ /*
* Contains additional data about the given SV.
*/
bitfield<GnssSvFlags> svFlag;
diff --git a/gnss/1.0/IGnssDebug.hal b/gnss/1.0/IGnssDebug.hal
index ff9ea9f..8784d1a 100644
--- a/gnss/1.0/IGnssDebug.hal
+++ b/gnss/1.0/IGnssDebug.hal
@@ -45,11 +45,28 @@
double longitudeDegrees;
/* Altitude above ellipsoid expressed in meters */
float altitudeMeters;
+ /* Represents speed in meters per second. */
+ float speedMetersPerSec;
+ /* Represents heading in degrees. */
+ float bearingDegrees;
/*
* estimated horizontal accuracy of position expressed in meters, radial,
* 68% confidence.
*/
- double accuracyMeters;
+ double horizontalAccuracyMeters;
+ /*
+ * estimated vertical accuracy of position expressed in meters, with
+ * 68% confidence.
+ */
+ double verticalAccuracyMeters;
+ /*
+ * estimated speed accuracy in meters per second with 68% confidence.
+ */
+ double speedAccuracyMetersPerSecond;
+ /*
+ * estimated bearing accuracy degrees with 68% confidence.
+ */
+ double bearingAccuracyDegrees;
/*
* Time duration before this report that this position information was
* valid.
@@ -103,7 +120,7 @@
TimeDebug time;
/*
* Provides a list of the decoded satellite ephemeris.
- * Should provide a complete list for all constellations device can track,
+ * Must provide a complete list for all constellations device can track,
* including GnssConstellationType UNKNOWN.
*/
vec<SatelliteData> satelliteDataArray;
diff --git a/gnss/1.0/IGnssMeasurementCallback.hal b/gnss/1.0/IGnssMeasurementCallback.hal
index 9685942..de640ae 100644
--- a/gnss/1.0/IGnssMeasurementCallback.hal
+++ b/gnss/1.0/IGnssMeasurementCallback.hal
@@ -51,7 +51,9 @@
/** A valid 'carrier phase' is stored in the data structure. */
HAS_CARRIER_PHASE = 1 << 11,
/** A valid 'carrier phase uncertainty' is stored in the data structure. */
- HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12
+ HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12,
+ /** A valid automatic gain control is stored in the data structure. */
+ HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13
};
/*
@@ -95,7 +97,9 @@
STATE_GAL_E1BC_CODE_LOCK = 1 << 10,
STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11,
STATE_GAL_E1B_PAGE_SYNC = 1 << 12,
- STATE_SBAS_SYNC = 1 << 13
+ STATE_SBAS_SYNC = 1 << 13,
+ STATE_TOW_KNOWN = 1 << 14,
+ STATE_GLO_TOD_KNOWN = 1 << 15,
};
/*
@@ -321,6 +325,11 @@
* Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
* Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC set
* TOW decoded : [ 0 1week ] : STATE_TOW_DECODED set
+ * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
*
* Note: If there is any ambiguity in integer millisecond,
* GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS must be set accordingly, in the
@@ -333,33 +342,48 @@
*
* Given the highest sync state that can be achieved, per each satellite,
* valid range for this field can be:
- * Searching : [ 0 ] : STATE_UNKNOWN set
- * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
- * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set
- * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
- * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set
- * Time of day : [ 0 1day ] : STATE_GLO_TOW_DECODED set
+ * Searching : [ 0 ] : STATE_UNKNOWN set
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
+ * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set
+ * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
+ * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set
+ * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED set
+ * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set
+ *
+ * Note: Time of day known refers to the case where it is possibly not
+ * decoded over the air but has been determined from other sources. If
+ * Time of day decoded is set then Time of day known must also be set.
*
* For Beidou, this is the received Beidou time of week,
* at the measurement time in nanoseconds.
*
* Given the highest sync state that can be achieved, per each satellite,
* valid range for this field can be:
- * Searching : [ 0 ] : STATE_UNKNOWN set.
- * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK set.
- * Bit sync (D2): [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set.
- * Bit sync (D1): [ 0 20ms ] : STATE_BIT_SYNC set.
- * Subframe (D2): [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
- * Subframe (D1): [ 0 6s ] : STATE_SUBFRAME_SYNC set.
- * Time of week : [ 0 1week ] : STATE_TOW_DECODED set.
+ * Searching : [ 0 ] : STATE_UNKNOWN set.
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set.
+ * Bit sync (D2) : [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set.
+ * Bit sync (D1) : [ 0 20ms ] : STATE_BIT_SYNC set.
+ * Subframe (D2) : [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
+ * Subframe (D1) : [ 0 6s ] : STATE_SUBFRAME_SYNC set.
+ * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED set.
+ * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
*
* For Galileo, this is the received Galileo time of week,
* at the measurement time in nanoseconds.
*
- * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
- * E1C 2nd code lock: [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
- * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set.
- * Time of week : [ 0 1week] : STATE_TOW_DECODED is set.
+ * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
+ * E1C 2nd code lock : [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
+ * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set.
+ * Time of week decoded : [ 0 1week] : STATE_TOW_DECODED is set.
+ * Time of week known : [ 0 1week] : STATE_TOW_KNOWN set
+ *
+ * Note: TOW Known refers to the case where TOW is possibly not decoded
+ * over the air but has been determined from other sources. If TOW
+ * decoded is set then TOW Known must also be set.
*
* For SBAS, this is received SBAS time, at the measurement time in
* nanoseconds.
@@ -455,9 +479,10 @@
double accumulatedDeltaRangeUncertaintyM;
/*
- * Carrier frequency at which codes and messages are modulated, it can
- * be L1 or L2. If the field is not set, the carrier frequency is
- * assumed to be L1.
+ * Carrier frequency of the signal tracked, for example it can be the
+ * GPS L1 = 1.57542e9 Hz, or L2, L5, varying GLO channels, etc. If the
+ * field is not set, it is the primary common use frequency,
+ * e.g. L1 for GPS.
*
* If the data is available, gnssClockFlags must contain
* HAS_CARRIER_FREQUENCY.
@@ -524,6 +549,24 @@
* observed noise floor" to "the noise RMS".
*/
double snrDb;
+
+ /*
+ * Automatic gain control (AGC) level. AGC acts as a variable gain
+ * amplifier adjusting the power of the incoming signal to minimize the
+ * quantization losses. The AGC level may be used to indicate potential
+ * interference. When AGC is at a nominal level, this value
+ * must be set as 0. Higher gain (and/or lower input power) must be
+ * output as a positive number. Hence in cases of strong jamming, in the
+ * band of this signal, this value must go more negative.
+ *
+ * Note: Different hardware designs (e.g. antenna, pre-amplification, or
+ * other RF HW components) may also affect the typical output of of this
+ * value on any given hardware design in an open sky test - the
+ * important aspect of this output is that changes in this value are
+ * indicative of changes on input signal power in the frequency band for
+ * this measurement.
+ */
+ double agcLevelDb;
};
/*
diff --git a/gnss/1.0/default/Gnss.cpp b/gnss/1.0/default/Gnss.cpp
index 28a1950..19e22c2 100644
--- a/gnss/1.0/default/Gnss.cpp
+++ b/gnss/1.0/default/Gnss.cpp
@@ -121,7 +121,10 @@
.cN0Dbhz = svInfo.c_n0_dbhz,
.elevationDegrees = svInfo.elevation,
.azimuthDegrees = svInfo.azimuth,
- .svFlag = svInfo.flags
+ .svFlag = svInfo.flags,
+ // Older chipsets do not provide carrier frequency, hence HAS_CARRIER_FREQUENCY flag
+ // is not set and the carrierFrequencyHz field is set to zero
+ .carrierFrequencyHz = 0
};
svStatus.gnssSvList[i] = gnssSvInfo;
}
diff --git a/gnss/1.0/default/GnssMeasurement.cpp b/gnss/1.0/default/GnssMeasurement.cpp
index 0d11636..67f6d8d 100644
--- a/gnss/1.0/default/GnssMeasurement.cpp
+++ b/gnss/1.0/default/GnssMeasurement.cpp
@@ -51,12 +51,19 @@
for (size_t i = 0; i < gnssData.measurementCount; i++) {
auto entry = legacyGnssData->measurements[i];
+ auto state = static_cast<GnssMeasurementState>(entry.state);
+ if (state & IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED) {
+ state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_KNOWN;
+ }
+ if (state & IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED) {
+ state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_KNOWN;
+ }
gnssData.measurements[i] = {
.flags = entry.flags,
.svid = entry.svid,
.constellation = static_cast<GnssConstellationType>(entry.constellation),
.timeOffsetNs = entry.time_offset_ns,
- .state = entry.state,
+ .state = state,
.receivedSvTimeInNs = entry.received_sv_time_in_ns,
.receivedSvTimeUncertaintyInNs = entry.received_sv_time_uncertainty_in_ns,
.cN0DbHz = entry.c_n0_dbhz,
diff --git a/gnss/1.0/default/GnssUtils.cpp b/gnss/1.0/default/GnssUtils.cpp
index 9f7e356..4b3ca44 100644
--- a/gnss/1.0/default/GnssUtils.cpp
+++ b/gnss/1.0/default/GnssUtils.cpp
@@ -34,7 +34,13 @@
.altitudeMeters = location->altitude,
.speedMetersPerSec = location->speed,
.bearingDegrees = location->bearing,
- .accuracyMeters = location->accuracy,
+ .horizontalAccuracyMeters = location->accuracy,
+ // Older chipsets do not provide the following 3 fields, hence the flags
+ // HAS_VERTICAL_ACCURACY, HAS_SPEED_ACCURACY and HAS_BEARING_ACCURACY are
+ // not set and the field are set to zeros.
+ .verticalAccuracyMeters = 0,
+ .speedAccuracyMetersPerSecond = 0,
+ .bearingAccuracyDegrees = 0,
.timestamp = location->timestamp
};
}
diff --git a/gnss/1.0/types.hal b/gnss/1.0/types.hal
index ea104c5..2721d44 100644
--- a/gnss/1.0/types.hal
+++ b/gnss/1.0/types.hal
@@ -40,15 +40,21 @@
/** Bit mask to indicate which values are valid in a GnssLocation object. */
enum GnssLocationFlags : uint16_t {
/** GnssLocation has valid latitude and longitude. */
- HAS_LAT_LONG = 0x0001,
+ HAS_LAT_LONG = 0x0001,
/** GnssLocation has valid altitude. */
- HAS_ALTITUDE = 0x0002,
+ HAS_ALTITUDE = 0x0002,
/** GnssLocation has valid speed. */
- HAS_SPEED = 0x0004,
+ HAS_SPEED = 0x0004,
/** GnssLocation has valid bearing. */
- HAS_BEARING = 0x0008,
- /** GnssLocation has valid accuracy. */
- HAS_ACCURACY = 0x0010
+ HAS_BEARING = 0x0008,
+ /** GpsLocation has valid horizontal accuracy. */
+ HAS_HORIZONTAL_ACCURACY = 0x0010,
+ /** GpsLocation has valid vertical accuracy. */
+ HAS_VERTICAL_ACCURACY = 0x0020,
+ /** GpsLocation has valid speed accuracy. */
+ HAS_SPEED_ACCURACY = 0x0040,
+ /** GpsLocation has valid bearing accuracy. */
+ HAS_BEARING_ACCURACY = 0x0080
};
/* Represents a location. */
@@ -73,8 +79,29 @@
/* Represents heading in degrees. */
float bearingDegrees;
- /* Represents expected accuracy in meters. */
- float accuracyMeters;
+ /*
+ * Represents expected horizontal position accuracy, radial, in meters
+ * (68% confidence).
+ */
+ float horizontalAccuracyMeters;
+
+ /*
+ * Represents expected vertical position accuracy in meters
+ * (68% confidence).
+ */
+ float verticalAccuracyMeters;
+
+ /*
+ * Represents expected speed accuracy in meter per seconds
+ * (68% confidence).
+ */
+ float speedAccuracyMetersPerSecond;
+
+ /*
+ * Represents expected bearing accuracy in degrees
+ * (68% confidence).
+ */
+ float bearingAccuracyDegrees;
/* Timestamp for the location fix. */
GnssUtcTime timestamp;
diff --git a/graphics/allocator/2.0/types.hal b/graphics/allocator/2.0/types.hal
index 6081db9..f9d1e1b 100644
--- a/graphics/allocator/2.0/types.hal
+++ b/graphics/allocator/2.0/types.hal
@@ -30,23 +30,23 @@
enum ProducerUsage : uint64_t {
/* bit 0 is reserved */
- /* buffer will be read by CPU occasionally */
+ /* buffer is read by CPU occasionally */
CPU_READ = 1ULL << 1,
- /* buffer will be read by CPU frequently */
+ /* buffer is read by CPU frequently */
CPU_READ_OFTEN = 1ULL << 2,
/* bit 3 is reserved */
/* bit 4 is reserved */
- /* buffer will be written by CPU occasionally */
+ /* buffer is written by CPU occasionally */
CPU_WRITE = 1ULL << 5,
- /* buffer will be written by CPU frequently */
+ /* buffer is written by CPU frequently */
CPU_WRITE_OFTEN = 1ULL << 6,
/* bit 7 is reserved */
/* bit 8 is reserved */
- /* buffer will be used as a GPU render target */
+ /* buffer is used as a GPU render target */
GPU_RENDER_TARGET = 1ULL << 9,
/* bit 10 is reserved */
@@ -64,7 +64,7 @@
/* bit 15 is reserved */
/* bit 16 is reserved */
- /* buffer will be used as a camera HAL output */
+ /* buffer is used as a camera HAL output */
CAMERA = 1ULL << 17,
/* bit 18 is reserved */
@@ -72,10 +72,13 @@
/* bit 20 is reserved */
/* bit 21 is reserved */
- /* buffer will be used as a video decoder output */
+ /* buffer is used as a video decoder output */
VIDEO_DECODER = 1ULL << 22,
- /* bits 23-27 are reserved for future versions */
+ /* buffer is used as a sensor direct report output */
+ SENSOR_DIRECT_DATA = 1ULL << 23,
+
+ /* bits 24-27 are reserved for future versions */
/* bits 28-31 are reserved for vendor extensions */
/* bits 32-47 are reserved for future versions */
@@ -85,9 +88,9 @@
enum ConsumerUsage : uint64_t {
/* bit 0 is reserved */
- /* buffer will be read by CPU occasionally */
+ /* buffer is read by CPU occasionally */
CPU_READ = 1ULL << 1,
- /* buffer will be read by CPU frequently */
+ /* buffer is read by CPU frequently */
CPU_READ_OFTEN = 1ULL << 2,
/* bit 3 is reserved */
@@ -96,40 +99,44 @@
/* bit 6 is reserved */
/* bit 7 is reserved */
- /* buffer will be used as a GPU texture */
+ /* buffer is used as a GPU texture */
GPU_TEXTURE = 1ULL << 8,
/* bit 9 is reserved */
/* bit 10 is reserved */
- /* buffer will be used by hwcomposer HAL */
+ /* buffer is used by hwcomposer HAL */
HWCOMPOSER = 1ULL << 11,
- /* buffer will be as a hwcomposer HAL client target */
+ /* buffer is a hwcomposer HAL client target */
CLIENT_TARGET = 1ULL << 12,
/* bit 13 is reserved */
/* bit 14 is reserved */
- /* buffer will be used as a hwcomposer HAL cursor */
+ /* buffer is used as a hwcomposer HAL cursor */
CURSOR = 1ULL << 15,
- /* buffer will be used as a video encoder input */
+ /* buffer is used as a video encoder input */
VIDEO_ENCODER = 1ULL << 16,
/* bit 17 is reserved */
- /* buffer will be used as a camera HAL input */
+ /* buffer is used as a camera HAL input */
CAMERA = 1ULL << 18,
/* bit 19 is reserved */
- /* buffer will be used as a renderscript allocation */
+ /* buffer is used as a renderscript allocation */
RENDERSCRIPT = 1ULL << 20,
/* bit 21 is reserved */
/* bit 22 is reserved */
- /* bits 23-27 are reserved for future versions */
+ /* buffer is used as as an OpenGL shader storage or uniform
+ buffer object */
+ GPU_DATA_BUFFER = 1ULL << 23,
+
+ /* bits 24-27 are reserved for future versions */
/* bits 28-31 are reserved for vendor extensions */
/* bits 32-47 are reserved for future versions */
diff --git a/sensors/1.0/ISensors.hal b/sensors/1.0/ISensors.hal
index a60cc10..c56da29 100644
--- a/sensors/1.0/ISensors.hal
+++ b/sensors/1.0/ISensors.hal
@@ -52,20 +52,6 @@
activate(int32_t sensorHandle, bool enabled) generates (Result result);
/**
- * Set the sampling period in nanoseconds for a given sensor.
- *
- * If samplingPeriodNs > maxDelay it will be truncated to
- * maxDelay and if samplingPeriodNs < minDelay it will be
- * replaced by minDelay.
- *
- * @param sensorHandle handle of sensor to be changed.
- * @param samplngPeriodNs specified sampling period in nanoseconds.
- * @return result OK on success, BAD_VALUE if sensorHandle is invalid.
- */
- setDelay(int32_t sensorHandle, int64_t samplingPeriodNs)
- generates (Result result);
-
- /**
* Generate a vector of sensor events containing at most "maxCount"
* entries.
*
@@ -105,7 +91,6 @@
* @return result OK on success, BAD_VALUE if any parameters are invalid.
*/
batch(int32_t sensorHandle,
- int32_t flags,
int64_t samplingPeriodNs,
int64_t maxReportLatencyNs) generates (Result result);
@@ -127,12 +112,26 @@
flush(int32_t sensorHandle) generates (Result result);
/*
- * Inject a single sensor sample to this device.
- * data points to the sensor event to be injected
- * Returns OK on success
- * PERMISSION_DENIED if operation is not allowed
- * INVALID_OPERATION, if this functionality is unsupported
- * BAD_VALUE if sensor event cannot be injected
+ * Inject a single sensor event or push operation environment parameters to
+ * device.
+ *
+ * When device is in NORMAL mode, this function is called to push operation
+ * environment data to device. In this operation, Event is always of
+ * SensorType::AdditionalInfo type. See operation evironment parameters
+ * section in AdditionalInfoType.
+ *
+ * When device is in DATA_INJECTION mode, this function is also used for
+ * injecting sensor events.
+ *
+ * Regardless of OperationMode, injected SensorType::ADDITIONAL_INFO
+ * type events should not be routed back to poll() function.
+ *
+ * @see AdditionalInfoType
+ * @see OperationMode
+ * @param event sensor event to be injected
+ * @return result OK on success; PERMISSION_DENIED if operation is not
+ * allowed; INVALID_OPERATION, if this functionality is
+ * unsupported; BAD_VALUE if sensor event cannot be injected.
*/
injectSensorData(Event event) generates (Result result);
diff --git a/sensors/1.0/default/Sensors.cpp b/sensors/1.0/default/Sensors.cpp
index f9f1ca6..8903397 100644
--- a/sensors/1.0/default/Sensors.cpp
+++ b/sensors/1.0/default/Sensors.cpp
@@ -142,15 +142,6 @@
enabled));
}
-Return<Result> Sensors::setDelay(
- int32_t sensor_handle, int64_t sampling_period_ns) {
- return ResultFromStatus(
- mSensorDevice->setDelay(
- reinterpret_cast<sensors_poll_device_t *>(mSensorDevice),
- sensor_handle,
- sampling_period_ns));
-}
-
Return<void> Sensors::poll(int32_t maxCount, poll_cb _hidl_cb) {
hidl_vec<Event> out;
hidl_vec<SensorInfo> dynamicSensorsAdded;
@@ -206,14 +197,13 @@
Return<Result> Sensors::batch(
int32_t sensor_handle,
- int32_t flags,
int64_t sampling_period_ns,
int64_t max_report_latency_ns) {
return ResultFromStatus(
mSensorDevice->batch(
mSensorDevice,
sensor_handle,
- flags,
+ 0, /*flags*/
sampling_period_ns,
max_report_latency_ns));
}
diff --git a/sensors/1.0/default/Sensors.h b/sensors/1.0/default/Sensors.h
index a33f283..e8bd98d 100644
--- a/sensors/1.0/default/Sensors.h
+++ b/sensors/1.0/default/Sensors.h
@@ -39,14 +39,10 @@
Return<Result> activate(
int32_t sensor_handle, bool enabled) override;
- Return<Result> setDelay(
- int32_t sensor_handle, int64_t sampling_period_ns) override;
-
Return<void> poll(int32_t maxCount, poll_cb _hidl_cb) override;
Return<Result> batch(
int32_t sensor_handle,
- int32_t flags,
int64_t sampling_period_ns,
int64_t max_report_latency_ns) override;
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index 68fb75c..6735e96 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -72,18 +72,18 @@
dst->timestamp = src.timestamp;
switch (dst->sensorType) {
- case SensorType::SENSOR_TYPE_META_DATA:
+ case SensorType::META_DATA:
{
dst->u.meta.what = (MetaDataEventType)src.meta_data.what;
break;
}
- case SensorType::SENSOR_TYPE_ACCELEROMETER:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_FIELD:
- case SensorType::SENSOR_TYPE_ORIENTATION:
- case SensorType::SENSOR_TYPE_GYROSCOPE:
- case SensorType::SENSOR_TYPE_GRAVITY:
- case SensorType::SENSOR_TYPE_LINEAR_ACCELERATION:
+ case SensorType::ACCELEROMETER:
+ case SensorType::MAGNETIC_FIELD:
+ case SensorType::ORIENTATION:
+ case SensorType::GYROSCOPE:
+ case SensorType::GRAVITY:
+ case SensorType::LINEAR_ACCELERATION:
{
dst->u.vec3.x = src.acceleration.x;
dst->u.vec3.y = src.acceleration.y;
@@ -92,9 +92,9 @@
break;
}
- case SensorType::SENSOR_TYPE_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_GAME_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR:
+ case SensorType::ROTATION_VECTOR:
+ case SensorType::GAME_ROTATION_VECTOR:
+ case SensorType::GEOMAGNETIC_ROTATION_VECTOR:
{
dst->u.vec4.x = src.data[0];
dst->u.vec4.y = src.data[1];
@@ -103,148 +103,148 @@
break;
}
- case SensorType::SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED:
- {
- dst->u.uncal.x = src.uncalibrated_gyro.x_uncalib;
- dst->u.uncal.y = src.uncalibrated_gyro.y_uncalib;
- dst->u.uncal.z = src.uncalibrated_gyro.z_uncalib;
- dst->u.uncal.x_bias = src.uncalibrated_gyro.x_bias;
- dst->u.uncal.y_bias = src.uncalibrated_gyro.y_bias;
- dst->u.uncal.z_bias = src.uncalibrated_gyro.z_bias;
- break;
- }
+ case SensorType::MAGNETIC_FIELD_UNCALIBRATED:
+ case SensorType::GYROSCOPE_UNCALIBRATED:
+ case SensorType::ACCELEROMETER_UNCALIBRATED:
+ {
+ dst->u.uncal.x = src.uncalibrated_gyro.x_uncalib;
+ dst->u.uncal.y = src.uncalibrated_gyro.y_uncalib;
+ dst->u.uncal.z = src.uncalibrated_gyro.z_uncalib;
+ dst->u.uncal.x_bias = src.uncalibrated_gyro.x_bias;
+ dst->u.uncal.y_bias = src.uncalibrated_gyro.y_bias;
+ dst->u.uncal.z_bias = src.uncalibrated_gyro.z_bias;
+ break;
+ }
- case SensorType::SENSOR_TYPE_DEVICE_ORIENTATION:
- case SensorType::SENSOR_TYPE_LIGHT:
- case SensorType::SENSOR_TYPE_PRESSURE:
- case SensorType::SENSOR_TYPE_TEMPERATURE:
- case SensorType::SENSOR_TYPE_PROXIMITY:
- case SensorType::SENSOR_TYPE_RELATIVE_HUMIDITY:
- case SensorType::SENSOR_TYPE_AMBIENT_TEMPERATURE:
- case SensorType::SENSOR_TYPE_SIGNIFICANT_MOTION:
- case SensorType::SENSOR_TYPE_STEP_DETECTOR:
- case SensorType::SENSOR_TYPE_TILT_DETECTOR:
- case SensorType::SENSOR_TYPE_WAKE_GESTURE:
- case SensorType::SENSOR_TYPE_GLANCE_GESTURE:
- case SensorType::SENSOR_TYPE_PICK_UP_GESTURE:
- case SensorType::SENSOR_TYPE_WRIST_TILT_GESTURE:
- case SensorType::SENSOR_TYPE_STATIONARY_DETECT:
- case SensorType::SENSOR_TYPE_MOTION_DETECT:
- case SensorType::SENSOR_TYPE_HEART_BEAT:
- {
- dst->u.scalar = src.data[0];
- break;
- }
+ case SensorType::DEVICE_ORIENTATION:
+ case SensorType::LIGHT:
+ case SensorType::PRESSURE:
+ case SensorType::TEMPERATURE:
+ case SensorType::PROXIMITY:
+ case SensorType::RELATIVE_HUMIDITY:
+ case SensorType::AMBIENT_TEMPERATURE:
+ case SensorType::SIGNIFICANT_MOTION:
+ case SensorType::STEP_DETECTOR:
+ case SensorType::TILT_DETECTOR:
+ case SensorType::WAKE_GESTURE:
+ case SensorType::GLANCE_GESTURE:
+ case SensorType::PICK_UP_GESTURE:
+ case SensorType::WRIST_TILT_GESTURE:
+ case SensorType::STATIONARY_DETECT:
+ case SensorType::MOTION_DETECT:
+ case SensorType::HEART_BEAT:
+ {
+ dst->u.scalar = src.data[0];
+ break;
+ }
- case SensorType::SENSOR_TYPE_STEP_COUNTER:
- {
- dst->u.stepCount = src.u64.step_counter;
- break;
- }
+ case SensorType::STEP_COUNTER:
+ {
+ dst->u.stepCount = src.u64.step_counter;
+ break;
+ }
- case SensorType::SENSOR_TYPE_HEART_RATE:
- {
- dst->u.heartRate.bpm = src.heart_rate.bpm;
- dst->u.heartRate.status = (SensorStatus)src.heart_rate.status;
- break;
- }
+ case SensorType::HEART_RATE:
+ {
+ dst->u.heartRate.bpm = src.heart_rate.bpm;
+ dst->u.heartRate.status = (SensorStatus)src.heart_rate.status;
+ break;
+ }
- case SensorType::SENSOR_TYPE_POSE_6DOF: // 15 floats
- {
- for (size_t i = 0; i < 15; ++i) {
- dst->u.pose6DOF[i] = src.data[i];
- }
- break;
- }
+ case SensorType::POSE_6DOF: // 15 floats
+ {
+ for (size_t i = 0; i < 15; ++i) {
+ dst->u.pose6DOF[i] = src.data[i];
+ }
+ break;
+ }
- case SensorType::SENSOR_TYPE_DYNAMIC_SENSOR_META:
- {
- dst->u.dynamic.connected = src.dynamic_sensor_meta.connected;
- dst->u.dynamic.sensorHandle = src.dynamic_sensor_meta.handle;
+ case SensorType::DYNAMIC_SENSOR_META:
+ {
+ dst->u.dynamic.connected = src.dynamic_sensor_meta.connected;
+ dst->u.dynamic.sensorHandle = src.dynamic_sensor_meta.handle;
- memcpy(dst->u.dynamic.uuid.data(),
- src.dynamic_sensor_meta.uuid,
- 16);
+ memcpy(dst->u.dynamic.uuid.data(),
+ src.dynamic_sensor_meta.uuid,
+ 16);
- break;
- }
+ break;
+ }
- case SensorType::SENSOR_TYPE_ADDITIONAL_INFO:
- {
- ::android::hardware::sensors::V1_0::AdditionalInfo *dstInfo =
- &dst->u.additional;
+ case SensorType::ADDITIONAL_INFO:
+ {
+ ::android::hardware::sensors::V1_0::AdditionalInfo *dstInfo =
+ &dst->u.additional;
- const additional_info_event_t &srcInfo = src.additional_info;
+ const additional_info_event_t &srcInfo = src.additional_info;
- dstInfo->type =
- (::android::hardware::sensors::V1_0::AdditionalInfoType)
- srcInfo.type;
+ dstInfo->type =
+ (::android::hardware::sensors::V1_0::AdditionalInfoType)
+ srcInfo.type;
- dstInfo->serial = srcInfo.serial;
+ dstInfo->serial = srcInfo.serial;
- CHECK_EQ(sizeof(dstInfo->u), sizeof(srcInfo.data_int32));
- memcpy(&dstInfo->u, srcInfo.data_int32, sizeof(srcInfo.data_int32));
- break;
- }
+ CHECK_EQ(sizeof(dstInfo->u), sizeof(srcInfo.data_int32));
+ memcpy(&dstInfo->u, srcInfo.data_int32, sizeof(srcInfo.data_int32));
+ break;
+ }
- default:
- {
- CHECK_GE((int32_t)dst->sensorType,
- (int32_t)SensorType::SENSOR_TYPE_DEVICE_PRIVATE_BASE);
+ default:
+ {
+ CHECK_GE((int32_t)dst->sensorType,
+ (int32_t)SensorType::DEVICE_PRIVATE_BASE);
- memcpy(dst->u.data.data(), src.data, 16 * sizeof(float));
- break;
- }
- }
+ memcpy(dst->u.data.data(), src.data, 16 * sizeof(float));
+ break;
+ }
+ }
}
void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
- dst->version = sizeof(sensors_event_t);
- dst->sensor = src.sensorHandle;
- dst->type = (int32_t)src.sensorType;
- dst->reserved0 = 0;
- dst->timestamp = src.timestamp;
- dst->flags = 0;
- dst->reserved1[0] = dst->reserved1[1] = dst->reserved1[2] = 0;
+ dst->version = sizeof(sensors_event_t);
+ dst->sensor = src.sensorHandle;
+ dst->type = (int32_t)src.sensorType;
+ dst->reserved0 = 0;
+ dst->timestamp = src.timestamp;
+ dst->flags = 0;
+ dst->reserved1[0] = dst->reserved1[1] = dst->reserved1[2] = 0;
- switch (src.sensorType) {
- case SensorType::SENSOR_TYPE_META_DATA:
- {
- dst->meta_data.what = (int32_t)src.u.meta.what;
- dst->meta_data.sensor = dst->sensor;
- break;
- }
+ switch (src.sensorType) {
+ case SensorType::META_DATA:
+ {
+ dst->meta_data.what = (int32_t)src.u.meta.what;
+ dst->meta_data.sensor = dst->sensor;
+ break;
+ }
- case SensorType::SENSOR_TYPE_ACCELEROMETER:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_FIELD:
- case SensorType::SENSOR_TYPE_ORIENTATION:
- case SensorType::SENSOR_TYPE_GYROSCOPE:
- case SensorType::SENSOR_TYPE_GRAVITY:
- case SensorType::SENSOR_TYPE_LINEAR_ACCELERATION:
- {
- dst->acceleration.x = src.u.vec3.x;
- dst->acceleration.y = src.u.vec3.y;
- dst->acceleration.z = src.u.vec3.z;
- dst->acceleration.status = (int8_t)src.u.vec3.status;
- break;
- }
+ case SensorType::ACCELEROMETER:
+ case SensorType::MAGNETIC_FIELD:
+ case SensorType::ORIENTATION:
+ case SensorType::GYROSCOPE:
+ case SensorType::GRAVITY:
+ case SensorType::LINEAR_ACCELERATION:
+ {
+ dst->acceleration.x = src.u.vec3.x;
+ dst->acceleration.y = src.u.vec3.y;
+ dst->acceleration.z = src.u.vec3.z;
+ dst->acceleration.status = (int8_t)src.u.vec3.status;
+ break;
+ }
- case SensorType::SENSOR_TYPE_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_GAME_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR:
- {
- dst->data[0] = src.u.vec4.x;
- dst->data[1] = src.u.vec4.y;
- dst->data[2] = src.u.vec4.z;
- dst->data[3] = src.u.vec4.w;
- break;
- }
+ case SensorType::ROTATION_VECTOR:
+ case SensorType::GAME_ROTATION_VECTOR:
+ case SensorType::GEOMAGNETIC_ROTATION_VECTOR:
+ {
+ dst->data[0] = src.u.vec4.x;
+ dst->data[1] = src.u.vec4.y;
+ dst->data[2] = src.u.vec4.z;
+ dst->data[3] = src.u.vec4.w;
+ break;
+ }
- case SensorType::SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED:
+ case SensorType::MAGNETIC_FIELD_UNCALIBRATED:
+ case SensorType::GYROSCOPE_UNCALIBRATED:
+ case SensorType::ACCELEROMETER_UNCALIBRATED:
{
dst->uncalibrated_gyro.x_uncalib = src.u.uncal.x;
dst->uncalibrated_gyro.y_uncalib = src.u.uncal.y;
@@ -255,42 +255,42 @@
break;
}
- case SensorType::SENSOR_TYPE_DEVICE_ORIENTATION:
- case SensorType::SENSOR_TYPE_LIGHT:
- case SensorType::SENSOR_TYPE_PRESSURE:
- case SensorType::SENSOR_TYPE_TEMPERATURE:
- case SensorType::SENSOR_TYPE_PROXIMITY:
- case SensorType::SENSOR_TYPE_RELATIVE_HUMIDITY:
- case SensorType::SENSOR_TYPE_AMBIENT_TEMPERATURE:
- case SensorType::SENSOR_TYPE_SIGNIFICANT_MOTION:
- case SensorType::SENSOR_TYPE_STEP_DETECTOR:
- case SensorType::SENSOR_TYPE_TILT_DETECTOR:
- case SensorType::SENSOR_TYPE_WAKE_GESTURE:
- case SensorType::SENSOR_TYPE_GLANCE_GESTURE:
- case SensorType::SENSOR_TYPE_PICK_UP_GESTURE:
- case SensorType::SENSOR_TYPE_WRIST_TILT_GESTURE:
- case SensorType::SENSOR_TYPE_STATIONARY_DETECT:
- case SensorType::SENSOR_TYPE_MOTION_DETECT:
- case SensorType::SENSOR_TYPE_HEART_BEAT:
+ case SensorType::DEVICE_ORIENTATION:
+ case SensorType::LIGHT:
+ case SensorType::PRESSURE:
+ case SensorType::TEMPERATURE:
+ case SensorType::PROXIMITY:
+ case SensorType::RELATIVE_HUMIDITY:
+ case SensorType::AMBIENT_TEMPERATURE:
+ case SensorType::SIGNIFICANT_MOTION:
+ case SensorType::STEP_DETECTOR:
+ case SensorType::TILT_DETECTOR:
+ case SensorType::WAKE_GESTURE:
+ case SensorType::GLANCE_GESTURE:
+ case SensorType::PICK_UP_GESTURE:
+ case SensorType::WRIST_TILT_GESTURE:
+ case SensorType::STATIONARY_DETECT:
+ case SensorType::MOTION_DETECT:
+ case SensorType::HEART_BEAT:
{
dst->data[0] = src.u.scalar;
break;
}
- case SensorType::SENSOR_TYPE_STEP_COUNTER:
+ case SensorType::STEP_COUNTER:
{
dst->u64.step_counter = src.u.stepCount;
break;
}
- case SensorType::SENSOR_TYPE_HEART_RATE:
+ case SensorType::HEART_RATE:
{
dst->heart_rate.bpm = src.u.heartRate.bpm;
dst->heart_rate.status = (int8_t)src.u.heartRate.status;
break;
}
- case SensorType::SENSOR_TYPE_POSE_6DOF: // 15 floats
+ case SensorType::POSE_6DOF: // 15 floats
{
for (size_t i = 0; i < 15; ++i) {
dst->data[i] = src.u.pose6DOF[i];
@@ -298,7 +298,7 @@
break;
}
- case SensorType::SENSOR_TYPE_DYNAMIC_SENSOR_META:
+ case SensorType::DYNAMIC_SENSOR_META:
{
dst->dynamic_sensor_meta.connected = src.u.dynamic.connected;
dst->dynamic_sensor_meta.handle = src.u.dynamic.sensorHandle;
@@ -311,7 +311,7 @@
break;
}
- case SensorType::SENSOR_TYPE_ADDITIONAL_INFO:
+ case SensorType::ADDITIONAL_INFO:
{
const ::android::hardware::sensors::V1_0::AdditionalInfo &srcInfo =
src.u.additional;
@@ -332,7 +332,7 @@
default:
{
CHECK_GE((int32_t)src.sensorType,
- (int32_t)SensorType::SENSOR_TYPE_DEVICE_PRIVATE_BASE);
+ (int32_t)SensorType::DEVICE_PRIVATE_BASE);
memcpy(dst->data, src.u.data.data(), 16 * sizeof(float));
break;
diff --git a/sensors/1.0/types.hal b/sensors/1.0/types.hal
index 27c9e9c..c8c8dfc 100644
--- a/sensors/1.0/types.hal
+++ b/sensors/1.0/types.hal
@@ -34,10 +34,10 @@
/*
* Sensor HAL modes used in setOperationMode method
*/
-@export(name="")
+@export(name="", value_prefix="SENSOR_HAL_", value_suffix="_MODE")
enum OperationMode : int32_t {
- SENSOR_HAL_NORMAL_MODE = 0,
- SENSOR_HAL_DATA_INJECTION_MODE = 1,
+ NORMAL = 0,
+ DATA_INJECTION = 1,
};
/*
@@ -52,21 +52,22 @@
* Device manufacturers (OEMs) can define their own sensor types, for
* their private use by applications or services provided by them. Such
* sensor types are specific to an OEM and can't be exposed in the SDK.
- * These types must start at SENSOR_TYPE_DEVICE_PRIVATE_BASE.
+ * These types must start at SensorType::DEVICE_PRIVATE_BASE.
*
* All sensors defined outside of the device private range must correspond to
* a type defined in this file, and must satisfy the characteristics listed in
* the description of the sensor type.
*
* Each sensor also has a "typeAsString".
- * - StringType of sensors inside of the device private range MUST be prefixed
+ * - string type of sensors defined in this file is overridden by Android to
+ * values defined in Android API with "android.sensor." prefix.
+ * Example: for an accelerometer,
+ * type = SensorType::Acclerometer
+ * typeAsString = "" (will be replace by "android.sensor.accelerometer" by
+ * Android frameowrk)
+ * - string type of sensors inside of the device private range MUST be prefixed
* by the sensor provider's or OEM reverse domain name. In particular, they
- * cannot use the "android.sensor" prefix.
- * - StringType of sensors outside of the device private range MUST correspond
- * to the one defined in this file (starting with "android.sensor").
- * For example, accelerometers must have
- * type=SENSOR_TYPE_ACCELEROMETER and
- * stringType=SENSOR_STRING_TYPE_ACCELEROMETER
+ * cannot use the "android.sensor." prefix.
*
* When android introduces a new sensor type that can replace an OEM-defined
* sensor type, the OEM must use the official sensor type and stringType on
@@ -76,13 +77,14 @@
* detecting that Glass is on a head.
* - Such a sensor is not officially supported in android KitKat
* - Glass devices launching on KitKat can implement a sensor with
- * type = 0x10001 and stringType = "com.google.glass.onheaddetector"
+ * type = 0x10001
+ * typeAsString = "com.google.glass.onheaddetector"
* - In L android release, if android decides to define
- * SENSOR_TYPE_ON_HEAD_DETECTOR and STRING_SENSOR_TYPE_ON_HEAD_DETECTOR,
+ * SensorType::ON_HEAD_DETECTOR and STRING_SensorType::ON_HEAD_DETECTOR,
* those types should replace the Glass-team-specific types in all future
* launches.
* - When launching Glass on the L release, Google should now use the official
- * type (SENSOR_TYPE_ON_HEAD_DETECTOR) and stringType.
+ * type (SensorType::ON_HEAD_DETECTOR) and stringType.
* - This way, all applications can now use this sensor.
*/
@@ -102,27 +104,27 @@
* previous releases are also wake-up sensors and must be treated as such.
* Wake-up one-shot sensors like SIGNIFICANT_MOTION cannot be batched, hence
* the text about batch above doesn't apply to them. See the definitions of
- * SENSOR_TYPE_PROXIMITY and SENSOR_TYPE_SIGNIFICANT_MOTION for more info.
+ * SensorType::PROXIMITY and SensorType::SIGNIFICANT_MOTION for more info.
*
* Set SENSOR_FLAG_WAKE_UP flag for all wake-up sensors.
*
- * For example, A device can have two sensors both of SENSOR_TYPE_ACCELEROMETER
+ * For example, A device can have two sensors both of SensorType::ACCELEROMETER
* and one of them can be a wake_up sensor (with SENSOR_FLAG_WAKE_UP flag set)
* and the other can be a regular non wake_up sensor. Both of these sensors
* must be activated/deactivated independently of the other.
*/
-@export(name="")
+@export(name="", value_prefix="SENSOR_TYPE_")
enum SensorType : int32_t {
/* META_DATA is a special event type used to populate the MetaData
* structure. It doesn't correspond to a physical sensor. Events of this
* type exist only inside the HAL, their primary purpose is to signal the
* completion of a flush request.
*/
- SENSOR_TYPE_META_DATA = 0,
+ META_DATA = 0,
/*
- * SENSOR_TYPE_ACCELEROMETER
+ * ACCELEROMETER
* reporting-mode: continuous
*
* All values are in SI units (m/s^2) and measure the acceleration of the
@@ -131,10 +133,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_ACCELEROMETER = 1,
+ ACCELEROMETER = 1,
/*
- * SENSOR_TYPE_GEOMAGNETIC_FIELD
+ * MAGNETIC_FIELD
* reporting-mode: continuous
*
* All values are in micro-Tesla (uT) and measure the geomagnetic
@@ -143,10 +145,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GEOMAGNETIC_FIELD = 2,
+ MAGNETIC_FIELD = 2,
/*
- * SENSOR_TYPE_ORIENTATION
+ * ORIENTATION
* reporting-mode: continuous
*
* All values are angles in degrees.
@@ -157,10 +159,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_ORIENTATION = 3,
+ ORIENTATION = 3,
/*
- * SENSOR_TYPE_GYROSCOPE
+ * GYROSCOPE
* reporting-mode: continuous
*
* All values are in radians/second and measure the rate of rotation
@@ -169,20 +171,20 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GYROSCOPE = 4,
+ GYROSCOPE = 4,
/*
- * SENSOR_TYPE_LIGHT
+ * LIGHT
* reporting-mode: on-change
*
* The light sensor value is returned in SI lux units.
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_LIGHT = 5,
+ LIGHT = 5,
/*
- * SENSOR_TYPE_PRESSURE
+ * PRESSURE
* reporting-mode: continuous
*
* The pressure sensor return the athmospheric pressure in hectopascal (hPa)
@@ -190,13 +192,13 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_PRESSURE = 6,
+ PRESSURE = 6,
- /* SENSOR_TYPE_TEMPERATURE is deprecated in the HAL */
- SENSOR_TYPE_TEMPERATURE = 7,
+ /* TEMPERATURE is deprecated in the HAL */
+ TEMPERATURE = 7,
/*
- * SENSOR_TYPE_PROXIMITY
+ * PROXIMITY
* reporting-mode: on-change
*
* The proximity sensor which turns the screen off and back on during calls
@@ -206,10 +208,10 @@
* The value corresponds to the distance to the nearest object in
* centimeters.
*/
- SENSOR_TYPE_PROXIMITY = 8,
+ PROXIMITY = 8,
/*
- * SENSOR_TYPE_GRAVITY
+ * GRAVITY
* reporting-mode: continuous
*
* A gravity output indicates the direction of and magnitude of gravity in
@@ -218,10 +220,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GRAVITY = 9,
+ GRAVITY = 9,
/*
- * SENSOR_TYPE_LINEAR_ACCELERATION
+ * LINEAR_ACCELERATION
* reporting-mode: continuous
*
* Indicates the linear acceleration of the device in device coordinates,
@@ -230,10 +232,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_LINEAR_ACCELERATION = 10,
+ LINEAR_ACCELERATION = 10,
/*
- * SENSOR_TYPE_ROTATION_VECTOR
+ * ROTATION_VECTOR
* reporting-mode: continuous
*
* The rotation vector symbolizes the orientation of the device relative to
@@ -242,10 +244,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_ROTATION_VECTOR = 11,
+ ROTATION_VECTOR = 11,
/*
- * SENSOR_TYPE_RELATIVE_HUMIDITY
+ * RELATIVE_HUMIDITY
* reporting-mode: on-change
*
* A relative humidity sensor measures relative ambient air humidity and
@@ -253,44 +255,44 @@
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_RELATIVE_HUMIDITY = 12,
+ RELATIVE_HUMIDITY = 12,
/*
- * SENSOR_TYPE_AMBIENT_TEMPERATURE
+ * AMBIENT_TEMPERATURE
* reporting-mode: on-change
*
* The ambient (room) temperature in degree Celsius.
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_AMBIENT_TEMPERATURE = 13,
+ AMBIENT_TEMPERATURE = 13,
/*
- * SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED
+ * MAGNETIC_FIELD_UNCALIBRATED
* reporting-mode: continuous
*
- * Similar to SENSOR_TYPE_MAGNETIC_FIELD, but the hard iron calibration is
+ * Similar to MAGNETIC_FIELD, but the hard iron calibration is
* reported separately instead of being included in the measurement.
*
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14,
+ MAGNETIC_FIELD_UNCALIBRATED = 14,
/*
- * SENSOR_TYPE_GAME_ROTATION_VECTOR
+ * GAME_ROTATION_VECTOR
* reporting-mode: continuous
*
- * Similar to SENSOR_TYPE_ROTATION_VECTOR, but not using the geomagnetic
+ * Similar to ROTATION_VECTOR, but not using the geomagnetic
* field.
*
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GAME_ROTATION_VECTOR = 15,
+ GAME_ROTATION_VECTOR = 15,
/*
- * SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
+ * GYROSCOPE_UNCALIBRATED
* reporting-mode: continuous
*
* All values are in radians/second and measure the rate of rotation
@@ -299,10 +301,10 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 16,
+ GYROSCOPE_UNCALIBRATED = 16,
/*
- * SENSOR_TYPE_SIGNIFICANT_MOTION
+ * SIGNIFICANT_MOTION
* reporting-mode: one-shot
*
* A sensor of this type triggers an event each time significant motion
@@ -312,10 +314,10 @@
* significant motion sensor. A non wake-up version is not useful.
* The only allowed value to return is 1.0.
*/
- SENSOR_TYPE_SIGNIFICANT_MOTION = 17,
+ SIGNIFICANT_MOTION = 17,
/*
- * SENSOR_TYPE_STEP_DETECTOR
+ * STEP_DETECTOR
* reporting-mode: special
*
* A sensor of this type triggers an event each time a step is taken
@@ -324,10 +326,10 @@
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_STEP_DETECTOR = 18,
+ STEP_DETECTOR = 18,
/*
- * SENSOR_TYPE_STEP_COUNTER
+ * STEP_COUNTER
* reporting-mode: on-change
*
* A sensor of this type returns the number of steps taken by the user since
@@ -337,22 +339,22 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_STEP_COUNTER = 19,
+ STEP_COUNTER = 19,
/*
- * SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
+ * GEOMAGNETIC_ROTATION_VECTOR
* reporting-mode: continuous
*
- * Similar to SENSOR_TYPE_ROTATION_VECTOR, but using a magnetometer instead
+ * Similar to ROTATION_VECTOR, but using a magnetometer instead
* of using a gyroscope.
*
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20,
+ GEOMAGNETIC_ROTATION_VECTOR = 20,
/*
- * SENSOR_TYPE_HEART_RATE
+ * HEART_RATE
* reporting-mode: on-change
*
* A sensor of this type returns the current heart rate.
@@ -364,7 +366,7 @@
* when heart_rate.bpm or heart_rate.status have changed since the last
* event. In particular, upon the first activation, unless the device is
* known to not be on the body, the status field of the first event must be
- * set to SENSOR_STATUS_UNRELIABLE. The event must not be generated faster
+ * set to SensorStatus::UNRELIABLE. The event should be generated no faster
* than every period_ns passed to setDelay() or to batch().
* See the definition of the on-change reporting mode for more information.
*
@@ -373,10 +375,10 @@
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_HEART_RATE = 21,
+ HEART_RATE = 21,
/*
- * SENSOR_TYPE_WAKE_UP_TILT_DETECTOR
+ * WAKE_UP_TILT_DETECTOR
* reporting-mode: special (setDelay has no impact)
*
* A sensor of this type generates an event each time a tilt event is
@@ -412,10 +414,10 @@
*
* Implement only the wake-up version of this sensor.
*/
- SENSOR_TYPE_TILT_DETECTOR = 22,
+ TILT_DETECTOR = 22,
/*
- * SENSOR_TYPE_WAKE_GESTURE
+ * WAKE_GESTURE
* reporting-mode: one-shot
*
* A sensor enabling waking up the device based on a device specific motion.
@@ -433,10 +435,10 @@
*
* Implement only the wake-up version of this sensor.
*/
- SENSOR_TYPE_WAKE_GESTURE = 23,
+ WAKE_GESTURE = 23,
/*
- * SENSOR_TYPE_GLANCE_GESTURE
+ * GLANCE_GESTURE
* reporting-mode: one-shot
*
* A sensor enabling briefly turning the screen on to enable the user to
@@ -458,10 +460,10 @@
*
* Implement only the wake-up version of this sensor.
*/
- SENSOR_TYPE_GLANCE_GESTURE = 24,
+ GLANCE_GESTURE = 24,
/**
- * SENSOR_TYPE_PICK_UP_GESTURE
+ * PICK_UP_GESTURE
* reporting-mode: one-shot
*
* A sensor of this type triggers when the device is picked up regardless of
@@ -470,10 +472,10 @@
*
* Implement only the wake-up version of this sensor.
*/
- SENSOR_TYPE_PICK_UP_GESTURE = 25,
+ PICK_UP_GESTURE = 25,
/*
- * SENSOR_TYPE_WRIST_TILT_GESTURE
+ * WRIST_TILT_GESTURE
* trigger-mode: special
* wake-up sensor: yes
*
@@ -485,10 +487,10 @@
*
* Implement only the wake-up version of this sensor.
*/
- SENSOR_TYPE_WRIST_TILT_GESTURE = 26,
+ WRIST_TILT_GESTURE = 26,
/*
- * SENSOR_TYPE_DEVICE_ORIENTATION
+ * DEVICE_ORIENTATION
* reporting-mode: on-change
*
* The current orientation of the device. The value is reported in
@@ -519,10 +521,10 @@
*
* Both wake-up and non wake-up versions are useful.
*/
- SENSOR_TYPE_DEVICE_ORIENTATION = 27,
+ DEVICE_ORIENTATION = 27,
/*
- * SENSOR_TYPE_POSE_6DOF
+ * POSE_6DOF
* trigger-mode: continuous
*
* A sensor of this type returns the pose of the device.
@@ -537,10 +539,10 @@
* . Depth Camera
*
*/
- SENSOR_TYPE_POSE_6DOF = 28,
+ POSE_6DOF = 28,
/*
- * SENSOR_TYPE_STATIONARY_DETECT
+ * STATIONARY_DETECT
* trigger mode: one shot
*
* A sensor of this type returns an event if the device is still/stationary
@@ -551,10 +553,10 @@
*
* The only allowed value to return is 1.0.
*/
- SENSOR_TYPE_STATIONARY_DETECT = 29,
+ STATIONARY_DETECT = 29,
/*
- * SENSOR_TYPE_MOTION_DETECT
+ * MOTION_DETECT
* trigger mode: one shot
*
* A sensor of this type returns an event if the device is not still for
@@ -569,10 +571,10 @@
*
* The only allowed value to return is 1.0.
*/
- SENSOR_TYPE_MOTION_DETECT = 30,
+ MOTION_DETECT = 30,
/*
- * SENSOR_TYPE_HEART_BEAT
+ * HEART_BEAT
* trigger mode: continuous
*
* A sensor of this type returns an event everytime a hear beat peak is
@@ -589,10 +591,10 @@
* of the peak where 0.0 represent no information at all, and 1.0 represents
* certainty.
*/
- SENSOR_TYPE_HEART_BEAT = 31,
+ HEART_BEAT = 31,
/**
- * SENSOR_TYPE_DYNAMIC_SENSOR_META
+ * DYNAMIC_SENSOR_META
* trigger-mode: special
*
* A sensor event of this type is received when a dynamic sensor is added to
@@ -607,7 +609,7 @@
* A dynamic sensor connection indicates connection of a physical device or
* instantiation of a virtual sensor backed by algorithm; and a dynamic
* sensor disconnection indicates the the opposite. A sensor event of
- * SENSOR_TYPE_DYNAMIC_SENSOR_META type must be delivered regardless of
+ * DYNAMIC_SENSOR_META type should be delivered regardless of
* the activation status of the sensor in the event of dynamic sensor
* connection and disconnection. In the sensor event, besides the common
* data entries, "dynamic_sensor_meta", which includes fields for connection
@@ -636,10 +638,10 @@
* unit.
*
*/
- SENSOR_TYPE_DYNAMIC_SENSOR_META = 32,
+ DYNAMIC_SENSOR_META = 32,
/**
- * SENSOR_TYPE_ADDITIONAL_INFO
+ * ADDITIONAL_INFO
* reporting-mode: N/A
*
* This sensor type is for delivering additional sensor information aside
@@ -652,9 +654,13 @@
* sensor list can have the type SENSOR_TYPE_ADDITIONAL_INFO. If a
* sensor HAL supports sensor additional information feature, it reports
* sensor_event_t with "sensor" field set to handle of the reporting sensor
- * and "type" field set to SENSOR_TYPE_ADDITIONAL_INFO. Delivery of
+ * and "type" field set to ADDITIONAL_INFO. Delivery of
* additional information events is triggered under two conditions: an
* enable activate() call or a flush() call to the corresponding sensor.
+ * Besides, time varying parameters can update infrequently without being
+ * triggered. Device is responsible to control update rate. The recommend
+ * update rate is less than 1/1000 of sensor event rate or less than once
+ * per minute in average.
*
* A single additional information report consists of multiple frames.
* Sequences of these frames are ordered using timestamps, which means the
@@ -668,13 +674,13 @@
* spans multiple frames. The first frame of the entire report is always of
* type AINFO_BEGIN, and the last frame is always AINFO_END.
*
- * All additional information frames have to be delivered after flush
- * complete event if flush() was triggering the report.
+ * If flush() was triggering the report, all additional information frames
+ * must be delivered after flush complete event.
*/
- SENSOR_TYPE_ADDITIONAL_INFO = 33,
+ ADDITIONAL_INFO = 33,
/*
- * SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT
+ * LOW_LATENCY_OFFBODY_DETECT
* trigger-mode: on-change
* wake-up sensor: yes
*
@@ -694,10 +700,10 @@
* 1.0 for on-body
*
*/
- SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34,
+ LOW_LATENCY_OFFBODY_DETECT = 34,
/*
- * SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
+ * ACCELEROMETER_UNCALIBRATED
* reporting-mode: continuous
*
* All values are in SI units (m/s^2) and measure the acceleration of the
@@ -706,17 +712,17 @@
* Implement the non-wake-up version of this sensor and implement the
* wake-up version if the system possesses a wake up fifo.
*/
- SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35,
+ ACCELEROMETER_UNCALIBRATED = 35,
/*
* Base for device manufacturers private sensor types.
* These sensor types can't be exposed in the SDK.
*/
- SENSOR_TYPE_DEVICE_PRIVATE_BASE = 0x10000
+ DEVICE_PRIVATE_BASE = 0x10000
};
-@export(name="")
-enum SensorFlagBits : uint64_t {
+@export(name="", value_prefix="SENSOR_FLAG_")
+enum SensorFlagBits : uint32_t {
/*
* Whether this sensor wakes up the AP from suspend mode when data is
* available. Whenever sensor events are delivered from a wake_up sensor,
@@ -726,7 +732,7 @@
* SensorService, the driver can safely release the wake_lock. SensorService
* will continue to hold a wake_lock till the app actually reads the events.
*/
- SENSOR_FLAG_WAKE_UP = 1,
+ WAKE_UP = 1,
/*
* Reporting modes for various sensors. Each sensor will have exactly one of
@@ -734,10 +740,10 @@
* The least significant 2nd, 3rd and 4th bits are used to represent four
* possible reporting modes.
*/
- SENSOR_FLAG_CONTINUOUS_MODE = 0,
- SENSOR_FLAG_ON_CHANGE_MODE = 2,
- SENSOR_FLAG_ONE_SHOT_MODE = 4,
- SENSOR_FLAG_SPECIAL_REPORTING_MODE = 6,
+ CONTINUOUS_MODE = 0,
+ ON_CHANGE_MODE = 2,
+ ONE_SHOT_MODE = 4,
+ SPECIAL_REPORTING_MODE = 6,
/*
* Set this flag if the sensor supports data_injection mode and allows data
@@ -747,48 +753,58 @@
* can be set with this flag and SensorService will inject accelerometer
* data and read the corresponding step counts.
*/
- SENSOR_FLAG_SUPPORTS_DATA_INJECTION = 0x10,
+ DATA_INJECTION = 0x10,
/*
* Set this flag if the sensor is a dynamically connected sensor. See
* DynamicSensorInfo and DYNAMIC_SENSOR_META for details.
*/
- SENSOR_FLAG_DYNAMIC_SENSOR = 0x20,
+ DYNAMIC_SENSOR = 0x20,
/*
* Set this flag if sensor additional information is supported.
* See ADDITIONAL_INFO and AdditionalInfo for details.
*/
- SENSOR_FLAG_ADDITIONAL_INFO = 0x40,
+ ADDITIONAL_INFO = 0x40,
/*
* Set this flag if sensor suppor direct channel backed by ashmem.
* See SharedMemType and registerDirectChannel for more details.
*/
- SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM = 0x400,
+ DIRECT_CHANNEL_ASHMEM = 0x400,
/*
* Set this flag if sensor suppor direct channel backed by gralloc HAL memory.
* See SharedMemType and registerDirectChannel for more details.
*/
- SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC = 0x800,
+ DIRECT_CHANNEL_GRALLOC = 0x800,
/*
* Flags mask for reporting mode of sensor.
*/
- SENSOR_FLAG_MASK_REPORTING_MODE = 0xE,
+ MASK_REPORTING_MODE = 0xE,
/*
* Flags mask for direct report maximum rate level support.
* See RateLevel.
*/
- SENSOR_FLAG_MASK_DIRECT_REPORT = 0x380,
+ MASK_DIRECT_REPORT = 0x380,
/*
* Flags mask for all direct channel support bits.
* See SharedMemType.
*/
- SENSOR_FLAG_MASK_DIRECT_CHANNEL = 0xC00,
+ MASK_DIRECT_CHANNEL = 0xC00,
+};
+
+@export(name="sensor_flag_shift_t", value_prefix="SENSOR_FLAG_SHIFT_")
+enum SensorFlagShift : uint8_t {
+ REPORTING_MODE = 1,
+ DATA_INJECTION = 4,
+ DYNAMIC_SENSOR = 5,
+ ADDITIONAL_INFO = 6,
+ DIRECT_REPORT = 7,
+ DIRECT_CHANNEL = 10,
};
struct SensorInfo {
@@ -815,13 +831,14 @@
/* this sensor's type. */
SensorType type;
- /* type of this sensor as a string. Set to corresponding
- * SENSOR_STRING_TYPE_*.
+ /* type of this sensor as a string.
+ *
* When defining an OEM specific sensor or sensor manufacturer specific
* sensor, use your reserve domain name as a prefix.
- * ex: com.google.glass.onheaddetector
- * For sensors of known type, the android framework might overwrite this
- * string automatically.
+ * e.g. com.google.glass.onheaddetector
+ *
+ * For sensors of known type defined in SensorType (value <
+ * SensorType::DEVICE_PRIVATE_BASE), this can be an empty string.
*/
string typeAsString;
@@ -884,16 +901,16 @@
int32_t maxDelay;
/* Bitmask of SensorFlagBits */
- uint64_t flags;
+ bitfield<SensorFlagBits> flags;
};
-@export(name="")
+@export(name="", value_prefix="SENSOR_STATUS_")
enum SensorStatus : int8_t {
- SENSOR_STATUS_NO_CONTACT = -1,
- SENSOR_STATUS_UNRELIABLE = 0,
- SENSOR_STATUS_ACCURACY_LOW = 1,
- SENSOR_STATUS_ACCURACY_MEDIUM = 2,
- SENSOR_STATUS_ACCURACY_HIGH = 3,
+ NO_CONTACT = -1,
+ UNRELIABLE = 0,
+ ACCURACY_LOW = 1,
+ ACCURACY_MEDIUM = 2,
+ ACCURACY_HIGH = 3,
};
struct Vec3 {
@@ -920,8 +937,9 @@
};
struct HeartRate {
- /* Heart rate in beats per minute. Set to 0 when status is
- * SENSOR_STATUS_UNRELIABLE or SENSOR_STATUS_NO_CONTACT.
+ /* Heart rate in beats per minute.
+ * Set to 0 when status is SensorStatus::UNRELIABLE or
+ * SensorStatus::NO_CONTACT
*/
float bpm;
@@ -986,8 +1004,9 @@
*/
AINFO_SAMPLING,
- /* Sampling channel modeling information
- * int32_t: noise type
+ // Sampling channel modeling information section
+
+ /* int32_t: noise type
* float[n]: parameters
*/
AINFO_CHANNEL_NOISE = 0x20000,
@@ -1017,7 +1036,7 @@
AINFO_CHANNEL_LINEAR_TRANSFORM,
/* int32_t[2]: extrapolate method, interpolate method
- * float[n]: mapping key points in paris, (in, out)...
+ * float[n]: mapping key points in pairs, (in, out)...
* (may be used to model saturation).
*/
AINFO_CHANNEL_NONLINEAR_MAP,
@@ -1027,6 +1046,49 @@
*/
AINFO_CHANNEL_RESAMPLER,
+ /* Operation environment parameters section
+ * Types in the following section is sent down (instead of reported from)
+ * device as additional information to aid sensor operation. Data is sent
+ * via injectSensorData() function to sensor handle -1 denoting all sensors
+ * in device.
+ */
+
+ /* Local geomagnetic field information based on device geo location. This
+ * type is primarily for for magnetic field calibration and rotation vector
+ * sensor fusion.
+ * float[3]: strength (uT), declination and inclination angle (rad).
+ */
+ AINFO_LOCAL_GEOMAGNETIC_FIELD = 0x30000,
+
+ /* Local gravitational acceleration strength at device geo location.
+ * float: gravitational acceleration norm in m/s^2.
+ */
+ AINFO_LOCAL_GRAVITY,
+
+ /* Device dock state.
+ * int32_t: dock state following Android API Intent.EXTRA_DOCK_STATE
+ * definition, undefined value is ignored.
+ */
+ AINFO_DOCK_STATE,
+
+ /* High performance mode hint. Device is able to use up more power and take
+ * more reources to improve throughput and latency in high performance mode.
+ * One possible use case is virtual reality, when sensor latency need to be
+ * carefully controlled.
+ * int32_t: 1 or 0, denote if device is in/out of high performance mode,
+ * other values is ignored.
+ */
+ AINFO_HIGH_PERFORMANCE_MODE,
+
+ /* Magnetic field calibration hint. Device is notified when manually
+ * triggered magnetic field calibration procedure is started or stopped. The
+ * calibration procedure is assumed timed out after 1 minute from start,
+ * even if an explicit stop is not received.
+ *
+ * int32_t: 1 for start, 0 for stop, other value is ignored.
+ */
+ AINFO_MAGNETIC_FIELD_CALIBRATION,
+
/* Custom information */
AINFO_CUSTOM_START = 0x10000000,
@@ -1058,53 +1120,53 @@
* relative humidity in percent
*/
union EventPayload {
- /* SENSOR_TYPE_ACCELEROMETER, SENSOR_TYPE_GEOMAGNETIC_FIELD,
- * SENSOR_TYPE_ORIENTATION, SENSOR_TYPE_GYROSCOPE, SENSOR_TYPE_GRAVITY,
- * SENSOR_TYPE_LINEAR_ACCELERATION
+ /* SensorType::ACCELEROMETER, SensorType::MAGNETIC_FIELD,
+ * SensorType::ORIENTATION, SensorType::GYROSCOPE, SensorType::GRAVITY,
+ * SensorType::LINEAR_ACCELERATION
*/
Vec3 vec3;
- /* SENSOR_TYPE_ROTATION_VECTOR, SENSOR_TYPE_GAME_ROTATION_VECTOR,
- * SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
+ /* SensorType::ROTATION_VECTOR, SensorType::GAME_ROTATION_VECTOR,
+ * SensorType::GEOMAGNETIC_ROTATION_VECTOR
*/
Vec4 vec4;
- /* SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED,
- * SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
- * SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
+ /* SensorType::MAGNETIC_FIELD_UNCALIBRATED,
+ * SensorType::GYROSCOPE_UNCALIBRATED
+ * SensorType::ACCELEROMETER_UNCALIBRATED
*/
Uncal uncal;
- /* SENSOR_TYPE_META_DATA */
+ /* SensorType::META_DATA */
MetaData meta;
- /* SENSOR_TYPE_DEVICE_ORIENTATION, SENSOR_TYPE_LIGHT, SENSOR_TYPE_PRESSURE,
- * SENSOR_TYPE_TEMPERATURE, SENSOR_TYPE_PROXIMITY,
- * SENSOR_TYPE_RELATIVE_HUMIDITY, SENSOR_TYPE_AMBIENT_TEMPERATURE,
- * SENSOR_TYPE_SIGNIFICANT_MOTION, SENSOR_TYPE_STEP_DETECTOR,
- * SENSOR_TYPE_TILT_DETECTOR, SENSOR_TYPE_WAKE_GESTURE,
- * SENSOR_TYPE_GLANCE_GESTURE, SENSOR_TYPE_PICK_UP_GESTURE,
- * SENSOR_TYPE_WRIST_TILT_GESTURE, SENSOR_TYPE_STATIONARY_DETECT,
- * SENSOR_TYPE_MOTION_DETECT, SENSOR_TYPE_HEART_BEAT
+ /* SensorType::DEVICE_ORIENTATION, SensorType::LIGHT, SensorType::PRESSURE,
+ * SensorType::TEMPERATURE, SensorType::PROXIMITY,
+ * SensorType::RELATIVE_HUMIDITY, SensorType::AMBIENT_TEMPERATURE,
+ * SensorType::SIGNIFICANT_MOTION, SensorType::STEP_DETECTOR,
+ * SensorType::TILT_DETECTOR, SensorType::WAKE_GESTURE,
+ * SensorType::GLANCE_GESTURE, SensorType::PICK_UP_GESTURE,
+ * SensorType::WRIST_TILT_GESTURE, SensorType::STATIONARY_DETECT,
+ * SensorType::MOTION_DETECT, SensorType::HEART_BEAT
*/
float scalar;
- /* SENSOR_TYPE_STEP_COUNTER */
+ /* SensorType::STEP_COUNTER */
uint64_t stepCount;
- /* SENSOR_TYPE_HEART_RATE */
+ /* SensorType::HEART_RATE */
HeartRate heartRate;
- /* SENSOR_TYPE_POSE_6DOF */
+ /* SensorType::POSE_6DOF */
float[15] pose6DOF;
- /* SENSOR_TYPE_DYNAMIC_SENSOR_META */
+ /* SensorType::DYNAMIC_SENSOR_META */
DynamicSensorInfo dynamic;
- /* SENSOR_TYPE_ADDITIONAL_INFO */
+ /* SensorType::ADDITIONAL_INFO */
AdditionalInfo additional;
- /* undefined/custom sensor type, >= SENSOR_TYPE_DEVICE_PRIVATE_BASE */
+ /* undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE */
float[16] data;
};
diff --git a/sensors/1.0/vts/Sensors.vts b/sensors/1.0/vts/Sensors.vts
index f80fff5..9e90755 100644
--- a/sensors/1.0/vts/Sensors.vts
+++ b/sensors/1.0/vts/Sensors.vts
@@ -47,22 +47,6 @@
}
api: {
- name: "setDelay"
- return_type_hidl: {
- type: TYPE_ENUM
- predefined_type: "::android::hardware::sensors::V1_0::Result"
- }
- arg: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
- }
- arg: {
- type: TYPE_SCALAR
- scalar_type: "int64_t"
- }
- }
-
- api: {
name: "poll"
return_type_hidl: {
type: TYPE_ENUM
@@ -100,10 +84,6 @@
}
arg: {
type: TYPE_SCALAR
- scalar_type: "int32_t"
- }
- arg: {
- type: TYPE_SCALAR
scalar_type: "int64_t"
}
arg: {
@@ -136,4 +116,56 @@
}
}
+ api: {
+ name: "registerDirectChannel"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::Result"
+ }
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::sensors::V1_0::SharedMemInfo"
+ }
+ }
+
+ api: {
+ name: "unregisterDirectChannel"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::Result"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "configDirectReport"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::Result"
+ }
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::RateLevel"
+ }
+ }
+
}
diff --git a/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp b/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
index 17c439e..2edc5c3 100644
--- a/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
+++ b/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
@@ -203,16 +203,16 @@
inline static SensorFlagBits extractReportMode(uint64_t flag) {
return (SensorFlagBits) (flag
- & ((uint64_t) SensorFlagBits::SENSOR_FLAG_CONTINUOUS_MODE
- | (uint64_t) SensorFlagBits::SENSOR_FLAG_ON_CHANGE_MODE
- | (uint64_t) SensorFlagBits::SENSOR_FLAG_ONE_SHOT_MODE
- | (uint64_t) SensorFlagBits::SENSOR_FLAG_SPECIAL_REPORTING_MODE));
+ & ((uint64_t) SensorFlagBits::CONTINUOUS_MODE
+ | (uint64_t) SensorFlagBits::ON_CHANGE_MODE
+ | (uint64_t) SensorFlagBits::ONE_SHOT_MODE
+ | (uint64_t) SensorFlagBits::SPECIAL_REPORTING_MODE));
}
inline static bool isMetaSensorType(SensorType type) {
- return (type == SensorType::SENSOR_TYPE_META_DATA
- || type == SensorType::SENSOR_TYPE_DYNAMIC_SENSOR_META
- || type == SensorType::SENSOR_TYPE_ADDITIONAL_INFO);
+ return (type == SensorType::META_DATA
+ || type == SensorType::DYNAMIC_SENSOR_META
+ || type == SensorType::ADDITIONAL_INFO);
}
inline static bool isValidType(SensorType type) {
@@ -225,14 +225,14 @@
bool SensorsHidlTest::typeMatchStringType(SensorType type, const hidl_string& stringType) {
- if (type >= SensorType::SENSOR_TYPE_DEVICE_PRIVATE_BASE) {
+ if (type >= SensorType::DEVICE_PRIVATE_BASE) {
return true;
}
bool res = true;
switch (type) {
#define CHECK_TYPE_STRING_FOR_SENSOR_TYPE(type) \
- case SensorType::SENSOR_TYPE_ ## type: res = stringType == SENSOR_STRING_TYPE_ ## type;\
+ case SensorType::type: res = stringType == SENSOR_STRING_TYPE_ ## type;\
break;\
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER);
@@ -277,7 +277,7 @@
}
bool SensorsHidlTest::typeMatchReportMode(SensorType type, SensorFlagBits reportMode) {
- if (type >= SensorType::SENSOR_TYPE_DEVICE_PRIVATE_BASE) {
+ if (type >= SensorType::DEVICE_PRIVATE_BASE) {
return true;
}
@@ -290,19 +290,21 @@
int32_t minDelay, int32_t maxDelay, SensorFlagBits reportMode) {
bool res = true;
switch(reportMode) {
- case SensorFlagBits::SENSOR_FLAG_CONTINUOUS_MODE:
+ case SensorFlagBits::CONTINUOUS_MODE:
res = (minDelay > 0) && (maxDelay >= 0);
break;
- case SensorFlagBits::SENSOR_FLAG_ON_CHANGE_MODE:
+ case SensorFlagBits::ON_CHANGE_MODE:
//TODO: current implementation does not satisfy minDelay == 0 on Proximity
res = (minDelay >= 0) && (maxDelay >= 0);
//res = (minDelay == 0) && (maxDelay >= 0);
break;
- case SensorFlagBits::SENSOR_FLAG_ONE_SHOT_MODE:
+ case SensorFlagBits::ONE_SHOT_MODE:
res = (minDelay == -1) && (maxDelay == 0);
break;
- case SensorFlagBits::SENSOR_FLAG_SPECIAL_REPORTING_MODE:
+ case SensorFlagBits::SPECIAL_REPORTING_MODE:
res = (minDelay == 0) && (maxDelay == 0);
+ default:
+ res = false;
}
return res;
@@ -310,44 +312,44 @@
SensorFlagBits SensorsHidlTest::expectedReportModeForType(SensorType type) {
switch (type) {
- case SensorType::SENSOR_TYPE_ACCELEROMETER:
- case SensorType::SENSOR_TYPE_GYROSCOPE:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_FIELD:
- case SensorType::SENSOR_TYPE_ORIENTATION:
- case SensorType::SENSOR_TYPE_PRESSURE:
- case SensorType::SENSOR_TYPE_TEMPERATURE:
- case SensorType::SENSOR_TYPE_GRAVITY:
- case SensorType::SENSOR_TYPE_LINEAR_ACCELERATION:
- case SensorType::SENSOR_TYPE_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_GAME_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
- case SensorType::SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR:
- case SensorType::SENSOR_TYPE_POSE_6DOF:
- case SensorType::SENSOR_TYPE_HEART_BEAT:
- return SensorFlagBits::SENSOR_FLAG_CONTINUOUS_MODE;
+ case SensorType::ACCELEROMETER:
+ case SensorType::GYROSCOPE:
+ case SensorType::MAGNETIC_FIELD:
+ case SensorType::ORIENTATION:
+ case SensorType::PRESSURE:
+ case SensorType::TEMPERATURE:
+ case SensorType::GRAVITY:
+ case SensorType::LINEAR_ACCELERATION:
+ case SensorType::ROTATION_VECTOR:
+ case SensorType::MAGNETIC_FIELD_UNCALIBRATED:
+ case SensorType::GAME_ROTATION_VECTOR:
+ case SensorType::GYROSCOPE_UNCALIBRATED:
+ case SensorType::GEOMAGNETIC_ROTATION_VECTOR:
+ case SensorType::POSE_6DOF:
+ case SensorType::HEART_BEAT:
+ return SensorFlagBits::CONTINUOUS_MODE;
- case SensorType::SENSOR_TYPE_LIGHT:
- case SensorType::SENSOR_TYPE_PROXIMITY:
- case SensorType::SENSOR_TYPE_RELATIVE_HUMIDITY:
- case SensorType::SENSOR_TYPE_AMBIENT_TEMPERATURE:
- case SensorType::SENSOR_TYPE_HEART_RATE:
- case SensorType::SENSOR_TYPE_DEVICE_ORIENTATION:
- case SensorType::SENSOR_TYPE_MOTION_DETECT:
- case SensorType::SENSOR_TYPE_STEP_COUNTER:
- return SensorFlagBits::SENSOR_FLAG_ON_CHANGE_MODE;
+ case SensorType::LIGHT:
+ case SensorType::PROXIMITY:
+ case SensorType::RELATIVE_HUMIDITY:
+ case SensorType::AMBIENT_TEMPERATURE:
+ case SensorType::HEART_RATE:
+ case SensorType::DEVICE_ORIENTATION:
+ case SensorType::MOTION_DETECT:
+ case SensorType::STEP_COUNTER:
+ return SensorFlagBits::ON_CHANGE_MODE;
- case SensorType::SENSOR_TYPE_SIGNIFICANT_MOTION:
- case SensorType::SENSOR_TYPE_WAKE_GESTURE:
- case SensorType::SENSOR_TYPE_GLANCE_GESTURE:
- case SensorType::SENSOR_TYPE_PICK_UP_GESTURE:
- return SensorFlagBits::SENSOR_FLAG_ONE_SHOT_MODE;
+ case SensorType::SIGNIFICANT_MOTION:
+ case SensorType::WAKE_GESTURE:
+ case SensorType::GLANCE_GESTURE:
+ case SensorType::PICK_UP_GESTURE:
+ return SensorFlagBits::ONE_SHOT_MODE;
- case SensorType::SENSOR_TYPE_STEP_DETECTOR:
- case SensorType::SENSOR_TYPE_TILT_DETECTOR:
- case SensorType::SENSOR_TYPE_WRIST_TILT_GESTURE:
- case SensorType::SENSOR_TYPE_DYNAMIC_SENSOR_META:
- return SensorFlagBits::SENSOR_FLAG_SPECIAL_REPORTING_MODE;
+ case SensorType::STEP_DETECTOR:
+ case SensorType::TILT_DETECTOR:
+ case SensorType::WRIST_TILT_GESTURE:
+ case SensorType::DYNAMIC_SENSOR_META:
+ return SensorFlagBits::SPECIAL_REPORTING_MODE;
default:
ALOGW("Type %d is not implemented in expectedReportModeForType", (int)type);
@@ -399,8 +401,8 @@
// Info type, should have no sensor
ASSERT_FALSE(
- s.type == SensorType::SENSOR_TYPE_ADDITIONAL_INFO
- || s.type == SensorType::SENSOR_TYPE_META_DATA);
+ s.type == SensorType::ADDITIONAL_INFO
+ || s.type == SensorType::META_DATA);
// Test fifoMax >= fifoReserved
ALOGV("max reserve = %d, %d", s.fifoMaxEventCount, s.fifoReservedEventCount);
@@ -426,7 +428,7 @@
constexpr int64_t batchingPeriodInNs = 0; // no batching
constexpr useconds_t minTimeUs = 5*1000*1000; // 5 s
constexpr size_t minNEvent = 100; // at lease 100 events
- constexpr SensorType type = SensorType::SENSOR_TYPE_ACCELEROMETER;
+ constexpr SensorType type = SensorType::ACCELEROMETER;
SensorInfo sensor = defaultSensorByType(type);
@@ -437,7 +439,7 @@
int32_t handle = sensor.sensorHandle;
- S()->batch(handle, 0, samplingPeriodInNs, batchingPeriodInNs);
+ S()->batch(handle, samplingPeriodInNs, batchingPeriodInNs);
S()->activate(handle, 1);
events = collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/);
S()->activate(handle, 0);
@@ -480,7 +482,7 @@
constexpr int64_t batchingPeriodInNs = 0; // no batching
constexpr useconds_t minTimeUs = 5*1000*1000; // 5 s
constexpr size_t minNEvent = 200;
- constexpr SensorType type = SensorType::SENSOR_TYPE_GYROSCOPE;
+ constexpr SensorType type = SensorType::GYROSCOPE;
SensorInfo sensor = defaultSensorByType(type);
@@ -491,7 +493,7 @@
int32_t handle = sensor.sensorHandle;
- S()->batch(handle, 0, samplingPeriodInNs, batchingPeriodInNs);
+ S()->batch(handle, samplingPeriodInNs, batchingPeriodInNs);
S()->activate(handle, 1);
events = collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/);
S()->activate(handle, 0);
@@ -533,7 +535,7 @@
constexpr int64_t batchingPeriodInNs = 0; // no batching
constexpr useconds_t minTimeUs = 5*1000*1000; // 5 s
constexpr size_t minNEvent = 50;
- constexpr SensorType type = SensorType::SENSOR_TYPE_ACCELEROMETER;
+ constexpr SensorType type = SensorType::ACCELEROMETER;
SensorInfo sensor = defaultSensorByType(type);
@@ -551,13 +553,13 @@
return;
}
- S()->batch(handle, 0, minSamplingPeriodInNs, batchingPeriodInNs);
+ S()->batch(handle, minSamplingPeriodInNs, batchingPeriodInNs);
S()->activate(handle, 1);
usleep(500000); // sleep 0.5 sec to wait for change rate to happen
events1 = collectEvents(sensor.minDelay * minNEvent, minNEvent, true /*clearBeforeStart*/);
- S()->batch(handle, 0, maxSamplingPeriodInNs, batchingPeriodInNs);
+ S()->batch(handle, maxSamplingPeriodInNs, batchingPeriodInNs);
usleep(500000); // sleep 0.5 sec to wait for change rate to happen
events2 = collectEvents(sensor.maxDelay * minNEvent, minNEvent, true /*clearBeforeStart*/);
@@ -620,7 +622,7 @@
constexpr int64_t oneSecondInNs = 1ull * 1000 * 1000 * 1000;
constexpr useconds_t minTimeUs = 5*1000*1000; // 5 s
constexpr size_t minNEvent = 50;
- constexpr SensorType type = SensorType::SENSOR_TYPE_ACCELEROMETER;
+ constexpr SensorType type = SensorType::ACCELEROMETER;
constexpr int64_t maxBatchingTestTimeNs = 30ull * 1000 * 1000 * 1000;
SensorInfo sensor = defaultSensorByType(type);
@@ -647,7 +649,7 @@
int64_t allowedBatchDeliverTimeNs =
std::max(oneSecondInNs, batchingPeriodInNs / 10);
- S()->batch(handle, 0, minSamplingPeriodInNs, INT64_MAX);
+ S()->batch(handle, minSamplingPeriodInNs, INT64_MAX);
S()->activate(handle, 1);
usleep(500000); // sleep 0.5 sec to wait for initialization
diff --git a/sensors/1.0/vts/types.vts b/sensors/1.0/vts/types.vts
index 37271fd..2980507 100644
--- a/sensors/1.0/vts/types.vts
+++ b/sensors/1.0/vts/types.vts
@@ -15,17 +15,21 @@
scalar_value: {
int32_t: 0
}
- enumerator: "BAD_VALUE"
- scalar_value: {
- int32_t: 1
- }
enumerator: "PERMISSION_DENIED"
scalar_value: {
- int32_t: 2
+ int32_t: -1
+ }
+ enumerator: "NO_MEMORY"
+ scalar_value: {
+ int32_t: -12
+ }
+ enumerator: "BAD_VALUE"
+ scalar_value: {
+ int32_t: -22
}
enumerator: "INVALID_OPERATION"
scalar_value: {
- int32_t: 3
+ int32_t: -38
}
}
}
@@ -36,11 +40,11 @@
enum_value: {
scalar_type: "int32_t"
- enumerator: "SENSOR_HAL_NORMAL_MODE"
+ enumerator: "NORMAL"
scalar_value: {
int32_t: 0
}
- enumerator: "SENSOR_HAL_DATA_INJECTION_MODE"
+ enumerator: "DATA_INJECTION"
scalar_value: {
int32_t: 1
}
@@ -53,147 +57,151 @@
enum_value: {
scalar_type: "int32_t"
- enumerator: "SENSOR_TYPE_META_DATA"
+ enumerator: "META_DATA"
scalar_value: {
int32_t: 0
}
- enumerator: "SENSOR_TYPE_ACCELEROMETER"
+ enumerator: "ACCELEROMETER"
scalar_value: {
int32_t: 1
}
- enumerator: "SENSOR_TYPE_GEOMAGNETIC_FIELD"
+ enumerator: "MAGNETIC_FIELD"
scalar_value: {
int32_t: 2
}
- enumerator: "SENSOR_TYPE_ORIENTATION"
+ enumerator: "ORIENTATION"
scalar_value: {
int32_t: 3
}
- enumerator: "SENSOR_TYPE_GYROSCOPE"
+ enumerator: "GYROSCOPE"
scalar_value: {
int32_t: 4
}
- enumerator: "SENSOR_TYPE_LIGHT"
+ enumerator: "LIGHT"
scalar_value: {
int32_t: 5
}
- enumerator: "SENSOR_TYPE_PRESSURE"
+ enumerator: "PRESSURE"
scalar_value: {
int32_t: 6
}
- enumerator: "SENSOR_TYPE_TEMPERATURE"
+ enumerator: "TEMPERATURE"
scalar_value: {
int32_t: 7
}
- enumerator: "SENSOR_TYPE_PROXIMITY"
+ enumerator: "PROXIMITY"
scalar_value: {
int32_t: 8
}
- enumerator: "SENSOR_TYPE_GRAVITY"
+ enumerator: "GRAVITY"
scalar_value: {
int32_t: 9
}
- enumerator: "SENSOR_TYPE_LINEAR_ACCELERATION"
+ enumerator: "LINEAR_ACCELERATION"
scalar_value: {
int32_t: 10
}
- enumerator: "SENSOR_TYPE_ROTATION_VECTOR"
+ enumerator: "ROTATION_VECTOR"
scalar_value: {
int32_t: 11
}
- enumerator: "SENSOR_TYPE_RELATIVE_HUMIDITY"
+ enumerator: "RELATIVE_HUMIDITY"
scalar_value: {
int32_t: 12
}
- enumerator: "SENSOR_TYPE_AMBIENT_TEMPERATURE"
+ enumerator: "AMBIENT_TEMPERATURE"
scalar_value: {
int32_t: 13
}
- enumerator: "SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED"
+ enumerator: "MAGNETIC_FIELD_UNCALIBRATED"
scalar_value: {
int32_t: 14
}
- enumerator: "SENSOR_TYPE_GAME_ROTATION_VECTOR"
+ enumerator: "GAME_ROTATION_VECTOR"
scalar_value: {
int32_t: 15
}
- enumerator: "SENSOR_TYPE_GYROSCOPE_UNCALIBRATED"
+ enumerator: "GYROSCOPE_UNCALIBRATED"
scalar_value: {
int32_t: 16
}
- enumerator: "SENSOR_TYPE_SIGNIFICANT_MOTION"
+ enumerator: "SIGNIFICANT_MOTION"
scalar_value: {
int32_t: 17
}
- enumerator: "SENSOR_TYPE_STEP_DETECTOR"
+ enumerator: "STEP_DETECTOR"
scalar_value: {
int32_t: 18
}
- enumerator: "SENSOR_TYPE_STEP_COUNTER"
+ enumerator: "STEP_COUNTER"
scalar_value: {
int32_t: 19
}
- enumerator: "SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR"
+ enumerator: "GEOMAGNETIC_ROTATION_VECTOR"
scalar_value: {
int32_t: 20
}
- enumerator: "SENSOR_TYPE_HEART_RATE"
+ enumerator: "HEART_RATE"
scalar_value: {
int32_t: 21
}
- enumerator: "SENSOR_TYPE_TILT_DETECTOR"
+ enumerator: "TILT_DETECTOR"
scalar_value: {
int32_t: 22
}
- enumerator: "SENSOR_TYPE_WAKE_GESTURE"
+ enumerator: "WAKE_GESTURE"
scalar_value: {
int32_t: 23
}
- enumerator: "SENSOR_TYPE_GLANCE_GESTURE"
+ enumerator: "GLANCE_GESTURE"
scalar_value: {
int32_t: 24
}
- enumerator: "SENSOR_TYPE_PICK_UP_GESTURE"
+ enumerator: "PICK_UP_GESTURE"
scalar_value: {
int32_t: 25
}
- enumerator: "SENSOR_TYPE_WRIST_TILT_GESTURE"
+ enumerator: "WRIST_TILT_GESTURE"
scalar_value: {
int32_t: 26
}
- enumerator: "SENSOR_TYPE_DEVICE_ORIENTATION"
+ enumerator: "DEVICE_ORIENTATION"
scalar_value: {
int32_t: 27
}
- enumerator: "SENSOR_TYPE_POSE_6DOF"
+ enumerator: "POSE_6DOF"
scalar_value: {
int32_t: 28
}
- enumerator: "SENSOR_TYPE_STATIONARY_DETECT"
+ enumerator: "STATIONARY_DETECT"
scalar_value: {
int32_t: 29
}
- enumerator: "SENSOR_TYPE_MOTION_DETECT"
+ enumerator: "MOTION_DETECT"
scalar_value: {
int32_t: 30
}
- enumerator: "SENSOR_TYPE_HEART_BEAT"
+ enumerator: "HEART_BEAT"
scalar_value: {
int32_t: 31
}
- enumerator: "SENSOR_TYPE_DYNAMIC_SENSOR_META"
+ enumerator: "DYNAMIC_SENSOR_META"
scalar_value: {
int32_t: 32
}
- enumerator: "SENSOR_TYPE_ADDITIONAL_INFO"
+ enumerator: "ADDITIONAL_INFO"
scalar_value: {
int32_t: 33
}
- enumerator: "SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT"
+ enumerator: "LOW_LATENCY_OFFBODY_DETECT"
scalar_value: {
int32_t: 34
}
- enumerator: "SENSOR_TYPE_DEVICE_PRIVATE_BASE"
+ enumerator: "ACCELEROMETER_UNCALIBRATED"
+ scalar_value: {
+ int32_t: 35
+ }
+ enumerator: "DEVICE_PRIVATE_BASE"
scalar_value: {
int32_t: 65536
}
@@ -204,39 +212,92 @@
name: "::android::hardware::sensors::V1_0::SensorFlagBits"
type: TYPE_ENUM
enum_value: {
- scalar_type: "uint64_t"
+ scalar_type: "uint32_t"
- enumerator: "SENSOR_FLAG_WAKE_UP"
+ enumerator: "WAKE_UP"
scalar_value: {
- uint64_t: 1
+ uint32_t: 1
}
- enumerator: "SENSOR_FLAG_CONTINUOUS_MODE"
+ enumerator: "CONTINUOUS_MODE"
scalar_value: {
- uint64_t: 0
+ uint32_t: 0
}
- enumerator: "SENSOR_FLAG_ON_CHANGE_MODE"
+ enumerator: "ON_CHANGE_MODE"
scalar_value: {
- uint64_t: 2
+ uint32_t: 2
}
- enumerator: "SENSOR_FLAG_ONE_SHOT_MODE"
+ enumerator: "ONE_SHOT_MODE"
scalar_value: {
- uint64_t: 4
+ uint32_t: 4
}
- enumerator: "SENSOR_FLAG_SPECIAL_REPORTING_MODE"
+ enumerator: "SPECIAL_REPORTING_MODE"
scalar_value: {
- uint64_t: 6
+ uint32_t: 6
}
- enumerator: "SENSOR_FLAG_SUPPORTS_DATA_INJECTION"
+ enumerator: "DATA_INJECTION"
scalar_value: {
- uint64_t: 16
+ uint32_t: 16
}
- enumerator: "SENSOR_FLAG_DYNAMIC_SENSOR"
+ enumerator: "DYNAMIC_SENSOR"
scalar_value: {
- uint64_t: 32
+ uint32_t: 32
}
- enumerator: "SENSOR_FLAG_ADDITIONAL_INFO"
+ enumerator: "ADDITIONAL_INFO"
scalar_value: {
- uint64_t: 64
+ uint32_t: 64
+ }
+ enumerator: "DIRECT_CHANNEL_ASHMEM"
+ scalar_value: {
+ uint32_t: 1024
+ }
+ enumerator: "DIRECT_CHANNEL_GRALLOC"
+ scalar_value: {
+ uint32_t: 2048
+ }
+ enumerator: "MASK_REPORTING_MODE"
+ scalar_value: {
+ uint32_t: 14
+ }
+ enumerator: "MASK_DIRECT_REPORT"
+ scalar_value: {
+ uint32_t: 896
+ }
+ enumerator: "MASK_DIRECT_CHANNEL"
+ scalar_value: {
+ uint32_t: 3072
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::sensors::V1_0::SensorFlagShift"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint8_t"
+
+ enumerator: "REPORTING_MODE"
+ scalar_value: {
+ uint8_t: 1
+ }
+ enumerator: "DATA_INJECTION"
+ scalar_value: {
+ uint8_t: 4
+ }
+ enumerator: "DYNAMIC_SENSOR"
+ scalar_value: {
+ uint8_t: 5
+ }
+ enumerator: "ADDITIONAL_INFO"
+ scalar_value: {
+ uint8_t: 6
+ }
+ enumerator: "DIRECT_REPORT"
+ scalar_value: {
+ uint8_t: 7
+ }
+ enumerator: "DIRECT_CHANNEL"
+ scalar_value: {
+ uint8_t: 10
}
}
}
@@ -312,8 +373,11 @@
}
struct_value: {
name: "flags"
- type: TYPE_SCALAR
- scalar_type: "uint64_t"
+ type: TYPE_MASK
+ enum_value: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::SensorFlagBits"
+ }
}
}
@@ -323,23 +387,23 @@
enum_value: {
scalar_type: "int8_t"
- enumerator: "SENSOR_STATUS_NO_CONTACT"
+ enumerator: "NO_CONTACT"
scalar_value: {
int8_t: -1
}
- enumerator: "SENSOR_STATUS_UNRELIABLE"
+ enumerator: "UNRELIABLE"
scalar_value: {
int8_t: 0
}
- enumerator: "SENSOR_STATUS_ACCURACY_LOW"
+ enumerator: "ACCURACY_LOW"
scalar_value: {
int8_t: 1
}
- enumerator: "SENSOR_STATUS_ACCURACY_MEDIUM"
+ enumerator: "ACCURACY_MEDIUM"
scalar_value: {
int8_t: 2
}
- enumerator: "SENSOR_STATUS_ACCURACY_HIGH"
+ enumerator: "ACCURACY_HIGH"
scalar_value: {
int8_t: 3
}
@@ -697,3 +761,82 @@
}
}
+attribute: {
+ name: "::android::hardware::sensors::V1_0::RateLevel"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "STOP"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "NORMAL"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "FAST"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "VERY_FAST"
+ scalar_value: {
+ int32_t: 3
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::sensors::V1_0::SharedMemType"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "ASHMEM"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "GRALLOC"
+ scalar_value: {
+ int32_t: 2
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::sensors::V1_0::SharedMemFormat"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "SENSORS_EVENT"
+ scalar_value: {
+ int32_t: 1
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::sensors::V1_0::SharedMemInfo"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "type"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::SharedMemType"
+ }
+ struct_value: {
+ name: "format"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::sensors::V1_0::SharedMemFormat"
+ }
+ struct_value: {
+ name: "size"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "memoryHandle"
+ type: TYPE_HANDLE
+ }
+}
+
diff --git a/soundtrigger/2.0/default/SoundTriggerHalImpl.cpp b/soundtrigger/2.0/default/SoundTriggerHalImpl.cpp
index 73066e6..afda739 100644
--- a/soundtrigger/2.0/default/SoundTriggerHalImpl.cpp
+++ b/soundtrigger/2.0/default/SoundTriggerHalImpl.cpp
@@ -295,7 +295,7 @@
}
SoundTriggerHalImpl::SoundTriggerHalImpl(const char *moduleName)
- : mModuleName(moduleName), mNextModelId(1)
+ : mModuleName(moduleName), mHwDevice(NULL), mNextModelId(1)
{
}
diff --git a/tests/baz/1.0/IBaz.hal b/tests/baz/1.0/IBaz.hal
index a2d961a..40e4024 100644
--- a/tests/baz/1.0/IBaz.hal
+++ b/tests/baz/1.0/IBaz.hal
@@ -40,6 +40,11 @@
int32_t[3][5] matrix3x5;
};
+ struct NestedStruct {
+ int32_t a;
+ vec<T> matrices;
+ };
+
@Fragile @NoReally(very="yes", array={"a","b","c"})
oneway doThis(float param);
@@ -64,4 +69,6 @@
returnABitField() generates (bitfield<BitField> good);
size(uint32_t size) generates (uint32_t size);
+
+ getNestedStructs() generates(vec<NestedStruct> data);
};
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index e000f55..3ed1b37 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -93,6 +93,15 @@
oneway requestBlockingRead(int32_t count);
/*
+ * This method requests the service to trigger a blocking read using
+ * default Event Flag notification bits defined by the MessageQueue class.
+ *
+ * @param count Number of messages to read.
+ *
+ */
+ oneway requestBlockingReadDefaultEventFlagBits(int32_t count);
+
+ /*
* This method requests the service to repeatedly trigger blocking reads.
*
* @param count Number of messages to read in a single blocking read.