Merge "Update API doc w/ high-rate permission requirement" into sc-dev

This commit is contained in:
Anh Pham
2021-06-24 06:22:24 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 4 deletions

View File

@@ -848,8 +848,10 @@ public final class Sensor {
/** /**
* Get the highest supported direct report mode rate level of the sensor. * Get the highest supported direct report mode rate level of the sensor.
* *
* @return Highest direct report rate level of this sensor. If the sensor does not support * @return Highest direct report rate level of this sensor. Note that if the app does not have
* direct report mode, this returns {@link SensorDirectChannel#RATE_STOP}. * the {@link android.Manifest.permission#HIGH_SAMPLING_RATE_SENSORS} permission, the highest
* direct report rate level is {@link SensorDirectChannel#RATE_NORMAL}. If the sensor
* does not support direct report mode, this returns {@link SensorDirectChannel#RATE_STOP}.
* @see SensorDirectChannel#RATE_STOP * @see SensorDirectChannel#RATE_STOP
* @see SensorDirectChannel#RATE_NORMAL * @see SensorDirectChannel#RATE_NORMAL
* @see SensorDirectChannel#RATE_FAST * @see SensorDirectChannel#RATE_FAST
@@ -1002,9 +1004,11 @@ public final class Sensor {
} }
/** /**
* @return the minimum delay allowed between two events in microsecond * @return the minimum delay allowed between two events in microseconds
* or zero if this sensor only returns a value when the data it's measuring * or zero if this sensor only returns a value when the data it's measuring
* changes. * changes. Note that if the app does not have the
* {@link android.Manifest.permission#HIGH_SAMPLING_RATE_SENSORS} permission, the
* minimum delay is capped at 5000 microseconds (200 Hz).
*/ */
public int getMinDelay() { public int getMinDelay() {
return mMinDelay; return mMinDelay;

View File

@@ -46,6 +46,13 @@ import java.util.List;
* at {@link TriggerEventListener}. {@link Sensor#TYPE_SIGNIFICANT_MOTION} * at {@link TriggerEventListener}. {@link Sensor#TYPE_SIGNIFICANT_MOTION}
* is an example of a trigger sensor. * is an example of a trigger sensor.
* </p> * </p>
* <p>
* In order to access sensor data at high sampling rates (i.e. greater than 200 Hz
* for {@link SensorEventListener} and greater than {@link SensorDirectChannel#RATE_NORMAL}
* for {@link SensorDirectChannel}), apps must declare
* the {@link android.Manifest.permission#HIGH_SAMPLING_RATE_SENSORS} permission
* in their AndroidManifest.xml file.
* </p>
* <pre class="prettyprint"> * <pre class="prettyprint">
* public class SensorActivity extends Activity implements SensorEventListener { * public class SensorActivity extends Activity implements SensorEventListener {
* private final SensorManager mSensorManager; * private final SensorManager mSensorManager;