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

Commit 502ce374 authored by Daniel Zheng's avatar Daniel Zheng Committed by Android (Google) Code Review
Browse files

Merge changes from topic "moistureIntrusion" into main

* changes:
  Add moisture sensor to sensor framework
  add permission for moisture sensor
parents 514afc2b daed1fb1
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@

package android.hardware;

import com.android.tradeinmode.flags.Flags;


import android.annotation.FlaggedApi;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
@@ -812,6 +816,27 @@ public final class Sensor {
     */
    public static final String STRING_TYPE_HEADING = "android.sensor.heading";

    /**
     * A constant describing a moisture intrusion sensor.
     *
     * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details.
     *
     * This sensor requires permission {@code android.permission.READ_MOISTURE_INTRUSION}.
     * It will not be returned by {@code SensorManager.getSensorsList} nor
     * {@code SensorManager.getDefaultSensor} if the application doesn't have this permission.
     * @hide This sensor is only expected to be used by platform services
     */
    @FlaggedApi(Flags.FLAG_TRADE_IN_MODE_2025Q4)
    public static final int TYPE_MOISTURE_INTRUSION = 43;

    /**
     * A constant string describing a moisture intrusion sensor.
     *
     * @see #TYPE_MOISTURE_INTRUSION
     * @hide This sensor is only expected to be used by platform services
     */
    @FlaggedApi(Flags.FLAG_TRADE_IN_MODE_2025Q4)
    public static final String STRING_TYPE_MOISTURE_INTRUSION = "android.sensor.moisture_intrusion";
    /**
     * A constant describing all sensor types.
     */
@@ -938,6 +963,7 @@ public final class Sensor {
            9, // SENSOR_TYPE_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED
            9, // SENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED
            2, // SENSOR_TYPE_HEADING
            1, // SENSOR_TYPE_MOISTURE_INTRUSION
    };

    /**
@@ -1410,6 +1436,9 @@ public final class Sensor {
            case TYPE_HEADING:
                mStringType = STRING_TYPE_HEADING;
                return true;
            case TYPE_MOISTURE_INTRUSION:
                mStringType = STRING_TYPE_MOISTURE_INTRUSION;
                return true;
            default:
                return false;
        }
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ android_app {
        "telephony_flags",
        "update_engine_aconfig_declarations",
        "appsearch_aconfig_flags",
        "aconfig_trade_in_mode_flags",
    ],
}

+9 −0
Original line number Diff line number Diff line
@@ -1853,6 +1853,15 @@
                android:description="@string/permdesc_highSamplingRateSensors"
                android:protectionLevel="normal" />

    <!-- Allows an app to access moisture intrusion sensor data
        <p>Protection level: normal
         @hide
    -->
    <permission android:name="android.permission.READ_MOISTURE_INTRUSION"
                android:permissionGroup="android.permission-group.SENSORS"
                android:protectionLevel="normal"
                android:featureFlag="com.android.tradeinmode.flags.trade_in_mode_2025q4"/>

    <!-- Allows an application to access data from sensors that the user uses to
         measure what is happening inside their body, such as heart rate.
         <p>Protection level: dangerous -->