[英]How is sensor refresh rate, limited on Android 12, related to security problems?
To protect potentially sensitive information about users, if your app targets Android 12 (API level 31) or higher, the system places a limit on the refresh rate of data from certain motion sensors and position sensors. This data includes values recorded by the device's accelerometer, gyroscope, and geomagnetic field sensor.
The refresh rate limit depends on how you access sensor data:
If you call the registerListener() method to monitor sensor events, the sensor sampling rate is limited to 200 Hz. This is true for all overloaded variants of the registerListener() method.
If you use the SensorDirectChannel class, the sensor sampling rate is limited to RATE_NORMAL, which is usually about 50 Hz.
If your app needs to gather motion sensor data at a higher rate, you must declare the HIGH_SAMPLING_RATE_SENSORS permission, as shown in the following code snippet. Otherwise, if your app tries to gather motion sensor data at a higher rate without declaring this permission, a SecurityException occurs.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.