Merge "Add @Nullable to SensorManager.getDefaultSensor's return value" am: 29aa6b8a72 am: 64a8b8356f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2377608 Change-Id: I907a3bec80d7249b7d7ee452015872515cd7ae1b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -17088,8 +17088,8 @@ package android.hardware {
|
||||
method public boolean flush(android.hardware.SensorEventListener);
|
||||
method public static float getAltitude(float, float);
|
||||
method public static void getAngleChange(float[], float[], float[]);
|
||||
method public android.hardware.Sensor getDefaultSensor(int);
|
||||
method public android.hardware.Sensor getDefaultSensor(int, boolean);
|
||||
method @Nullable public android.hardware.Sensor getDefaultSensor(int);
|
||||
method @Nullable public android.hardware.Sensor getDefaultSensor(int, boolean);
|
||||
method public java.util.List<android.hardware.Sensor> getDynamicSensorList(int);
|
||||
method public static float getInclination(float[]);
|
||||
method public static float[] getOrientation(float[], float[]);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.hardware;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.SystemService;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
@@ -496,7 +497,7 @@ public abstract class SensorManager {
|
||||
* @see #getSensorList(int)
|
||||
* @see Sensor
|
||||
*/
|
||||
public Sensor getDefaultSensor(int type) {
|
||||
public @Nullable Sensor getDefaultSensor(int type) {
|
||||
// TODO: need to be smarter, for now, just return the 1st sensor
|
||||
List<Sensor> l = getSensorList(type);
|
||||
boolean wakeUpSensor = false;
|
||||
@@ -544,7 +545,7 @@ public abstract class SensorManager {
|
||||
* and the application has the necessary permissions, or null otherwise.
|
||||
* @see Sensor#isWakeUpSensor()
|
||||
*/
|
||||
public Sensor getDefaultSensor(int type, boolean wakeUp) {
|
||||
public @Nullable Sensor getDefaultSensor(int type, boolean wakeUp) {
|
||||
List<Sensor> l = getSensorList(type);
|
||||
for (Sensor sensor : l) {
|
||||
if (sensor.isWakeUpSensor() == wakeUp) {
|
||||
|
||||
Reference in New Issue
Block a user