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

Commit fdb1fc8f authored by Anthony Stange's avatar Anthony Stange
Browse files

Add hinge angle sensor type to sensor NDK

Bug: 144139857
Test: N/A
Change-Id: Id809a8f65b31143759978702d18e6ac944d62ac3
parent 31ba2a96
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -245,6 +245,10 @@ enum {
     * {@link ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED}
     */
    ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35,
    /**
     * {@link ASENSOR_TYPE_HINGE_ANGLE}
     */
    ASENSOR_TYPE_HINGE_ANGLE = 36,
};

/**
+4 −0
Original line number Diff line number Diff line
@@ -268,6 +268,10 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi
        mStringType = SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED;
        mFlags |= SENSOR_FLAG_CONTINUOUS_MODE;
        break;
    case SENSOR_TYPE_HINGE_ANGLE:
        mStringType = SENSOR_STRING_TYPE_HINGE_ANGLE;
        mFlags |= SENSOR_FLAG_ON_CHANGE_MODE;
        break;
    default:
        // Only pipe the stringType, requiredPermission and flags for custom sensors.
        if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor.stringType) {
+1 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ Sensor const* SensorManager::getDefaultSensor(int type)
            type == SENSOR_TYPE_TILT_DETECTOR || type == SENSOR_TYPE_WAKE_GESTURE ||
            type == SENSOR_TYPE_GLANCE_GESTURE || type == SENSOR_TYPE_PICK_UP_GESTURE ||
            type == SENSOR_TYPE_WRIST_TILT_GESTURE ||
            type == SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT) {
            type == SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT || type == SENSOR_TYPE_HINGE_ANGLE) {
            wakeUpSensor = true;
        }
        // For now we just return the first sensor of that type we find.
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ size_t eventSizeBySensorType(int type) {
        case SENSOR_TYPE_MOTION_DETECT:
        case SENSOR_TYPE_HEART_BEAT:
        case SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT:
        case SENSOR_TYPE_HINGE_ANGLE:
            return 1;

        default: