Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define and use a "threshold check algorithm" that concrete sensors ca…
…n use. Related to w3c/ambient-light#63, which says the granularity of the data exposed by Ambient Light Sensors should be specified normatively. This commit goes a bit further and lays out some of the scaffolding necessary to specify the anti-fingerprinting measures currently implemented by Chrome -- namely, not only are illuminance values rounded but there's also a threshold value check to avoid storing values that are too close to the latest reading. A new algorithm, the threshold check algorithm, can be defined by concrete sensors and is associated with a sensor type. It is invoked by the "update sensor reading" abstract operation when defined, and if it returns false, "update sensor reading" will abort and not update the `latest reading` map. A few other parts also had to be adjusted to make this work possible: - A platform sensor is now explicitly associated with a sensor type. - Extension sensor attribute getters are no longer normatively required to simply return the value of invoking "get value from latest readings", as `AmbientLightSensor.illuminance`'s getter needs to do extra work. We only require that the attributes be read-only now.
- Loading branch information