Wrappers for the Accelerometer Sensor, LinearAccelerationSensor, and GravitySensor.
More...
Wrappers for the Accelerometer Sensor, LinearAccelerationSensor, and GravitySensor.
- See also
- https://www.w3.org/TR/accelerometer/
-
https://www.w3.org/TR/accelerometer/#linearaccelerationsensor
-
https://www.w3.org/TR/accelerometer/#gravitysensor
- Author
- Copyright (C) 2021 Radek Hranicky
- License:
- SPDX-License-Identifier: GPL-3.0-or-later
MOTIVATION Readings from the Accelerometer, LinearAccelerationSensor, and GravitySensor of the Generic Sensor API should be secured as they provide a potentially valuable data for creating fingerprints. There are multiple options. A unique fingerprint can be obtained by describing the device's vibrations (See https://link.springer.com/chapter/10.1007/978-3-319-30806-7_7). Using trajectory inference and matching of the model to map data, one may use the readings from the Accelerometer to determing the device's position (See https://www.researchgate.net/publication/220990763_ACComplice_Location_ inference_using_accelerometers_on_smartphones). Accelerometer readings can also be used for determining human walking patterns (See https://www.researchgate.net/publication/322835708_Classifying_Human_ Walking_Patterns_using_Accelerometer_Data_from_Smartphone).
WRAPPING The wrapper replaces the "XYZ" getters of the Accelerometer sensor, LinearAccelerationSensor, and GravitySensor. The wrapping's goal is to simulate a stationary device that can be possibly rotated. The rotation of the device is represented by the fake rotation matrix "orient.rotMat".
The GravitySensor should provide readings of gravity acceleration applied to the device. This is represented by a vector made of x, y, z portions. To get this faked gravity vector for the device, the reference vector [0, 0, 9.8] is multipled with the rotation matrix. Wrappers for the GravitySensor's getters return x, y, z portions of the fake gravity vector.
Next, the LinearAccelerationSensor should return acceleration values without the contribution of gravity. For a stationary device, it should be all zeroes. Yet, there could be vibrations that may change values a little bit, e.g., spin around -0.1 to +0.1, as seen on the examined devices. This usually does not happed with every reading but only in intervals of seconds. And thus, after a few seconds we pseudo-randomly change these values.
Finally, the Accelerometer sensor combines the previous two. Our wrappers thus return tha values from the LinearAccelerationSensor with the fake gravity vector portions added.
POSSIBLE IMPROVEMENTS Support for simulation of a non-stationary device where the rotation can change. Currently, the calculation of the gravity vector is done only once by the initDataGenerator() where the reference vector is multiplied with the rotation matrix. If orient.rotMat could change, the dataGen would have to be updated periodically. Moreover, such a change should also be taken into account in wrappers for other movement-related sensors (Gyroscope, etc.).