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

Commit ab1f0724 authored by Peng Xu's avatar Peng Xu Committed by android-build-merger
Browse files

resolve merge conflicts of 4f33ab9e to stage-aosp-master

am: 3cd9b00a

Change-Id: I06300dc4961d0149cfa869fa4eb9340b21e8ab82
parents 9ef13167 3cd9b00a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ enum {
 * A sensor event.
 */

/* NOTE: Must match hardware/sensors.h */
/* NOTE: changes to these structs have to be backward compatible */
typedef struct ASensorVector {
    union {
        float v[3];
@@ -259,7 +259,7 @@ typedef struct {
    };
} AAdditionalInfoEvent;

/* NOTE: Must match hardware/sensors.h */
/* NOTE: changes to this struct has to be backward compatible */
typedef struct ASensorEvent {
    int32_t version; /* sizeof(struct ASensorEvent) */
    int32_t sensor;

libs/sensor/OWNERS

0 → 100644
+2 −0
Original line number Diff line number Diff line
ashutoshj@google.com
pengxu@google.com
+2 −0
Original line number Diff line number Diff line
ashutoshj@google.com
pengxu@google.com
+18 −3
Original line number Diff line number Diff line
@@ -223,8 +223,13 @@ ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) {
}

void SensorDevice::autoDisable(void *ident, int handle) {
    Info& info( mActivationCount.editValueFor(handle) );
    Mutex::Autolock _l(mLock);
    ssize_t activationIndex = mActivationCount.indexOfKey(handle);
    if (activationIndex < 0) {
        ALOGW("Handle %d cannot be found in activation record", handle);
        return;
    }
    Info& info(mActivationCount.editValueAt(activationIndex));
    info.removeBatchParamsForIdent(ident);
}

@@ -235,7 +240,12 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled) {
    bool actuateHardware = false;

    Mutex::Autolock _l(mLock);
    Info& info( mActivationCount.editValueFor(handle) );
    ssize_t activationIndex = mActivationCount.indexOfKey(handle);
    if (activationIndex < 0) {
        ALOGW("Handle %d cannot be found in activation record", handle);
        return BAD_VALUE;
    }
    Info& info(mActivationCount.editValueAt(activationIndex));

    ALOGD_IF(DEBUG_CONNECTIONS,
             "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%zu",
@@ -329,7 +339,12 @@ status_t SensorDevice::batch(
             ident, handle, flags, samplingPeriodNs, maxBatchReportLatencyNs);

    Mutex::Autolock _l(mLock);
    Info& info(mActivationCount.editValueFor(handle));
    ssize_t activationIndex = mActivationCount.indexOfKey(handle);
    if (activationIndex < 0) {
        ALOGW("Handle %d cannot be found in activation record", handle);
        return BAD_VALUE;
    }
    Info& info(mActivationCount.editValueAt(activationIndex));

    if (info.batchParams.indexOfKey(ident) < 0) {
        BatchParams params(samplingPeriodNs, maxBatchReportLatencyNs);
+8 −2
Original line number Diff line number Diff line
@@ -933,8 +933,14 @@ sp<ISensorEventConnection> SensorService::createSensorEventConnection(const Stri
    }

    uid_t uid = IPCThreadState::self()->getCallingUid();
    sp<SensorEventConnection> result(new SensorEventConnection(this, uid, packageName,
            requestedMode == DATA_INJECTION, opPackageName));
    pid_t pid = IPCThreadState::self()->getCallingPid();

    String8 connPackageName =
            (packageName == "") ? String8::format("unknown_package_pid_%d", pid) : packageName;
    String16 connOpPackageName =
            (opPackageName == String16("")) ? String16(connPackageName) : opPackageName;
    sp<SensorEventConnection> result(new SensorEventConnection(this, uid, connPackageName,
            requestedMode == DATA_INJECTION, connOpPackageName));
    if (requestedMode == DATA_INJECTION) {
        if (mActiveConnections.indexOf(result) < 0) {
            mActiveConnections.add(result);
Loading