Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64a8b835 authored by Matthew Sedam's avatar Matthew Sedam Committed by Automerger Merge Worker
Browse files

Merge "Add @Nullable to SensorManager.getDefaultSensor's return value" am: 29aa6b8a

parents e18b410d 29aa6b8a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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[]);
+3 −2
Original line number Diff line number Diff line
@@ -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) {