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

Commit 346d6d91 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add hinge angle sensor type to sensor NDK"

parents 9c2cc9d2 fdb1fc8f
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: