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

Commit 943de2f7 authored by Aravind Akella's avatar Aravind Akella Committed by Android (Google) Code Review
Browse files

Merge "Enable wakeup sensors."

parents e4d97611 9a844cf7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -157,7 +157,9 @@ typedef struct ASensorEvent {
            uint64_t        step_counter;
        } u64;
    };
    int32_t reserved1[4];

    uint32_t flags;
    int32_t reserved1[3];
} ASensorEvent;

struct ASensorManager;
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public:
                                   nsecs_t maxBatchReportLatencyNs, int reservedFlags) = 0;
    virtual status_t setEventRate(int handle, nsecs_t ns) = 0;
    virtual status_t flush() = 0;
    virtual void decreaseWakeLockRefCount() = 0;
};

// ----------------------------------------------------------------------------
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public:
    int32_t getFifoMaxEventCount() const;
    const String8& getStringType() const;
    const String8& getRequiredPermission() const;
    bool isWakeUpSensor() const;

    // LightFlattenable protocol
    inline bool isFixedSize() const { return false; }
@@ -93,6 +94,8 @@ private:
    int32_t mFifoMaxEventCount;
    String8 mStringType;
    String8 mRequiredPermission;
    // Todo: Surface this in java SDK.
    bool    mWakeUpSensor;
    static void flattenString8(void*& buffer, size_t& size, const String8& string8);
    static bool unflattenString8(void const*& buffer, size_t& size, String8& outputString8);
};
+3 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <gui/BitTube.h>

// ----------------------------------------------------------------------------

#define WAKE_UP_SENSOR_EVENT_NEEDS_ACK (1 << 31)
struct ALooper;
struct ASensorEvent;

@@ -75,7 +75,8 @@ public:
                          int reservedFlags) const;
    status_t disableSensor(int32_t handle) const;
    status_t flush() const;

    // Send an ack for every wake_up sensor event that is set to WAKE_UP_SENSOR_EVENT_NEEDS_ACK.
    void sendAck(const ASensorEvent* events, int count);
private:
    sp<Looper> getLooper() const;
    sp<ISensorEventConnection> mSensorEventConnection;
+14 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ enum {
    GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
    ENABLE_DISABLE,
    SET_EVENT_RATE,
    FLUSH_SENSOR
    FLUSH_SENSOR,
    DECREASE_WAKE_LOCK_REFCOUNT
};

class BpSensorEventConnection : public BpInterface<ISensorEventConnection>
@@ -83,6 +84,13 @@ public:
        remote()->transact(FLUSH_SENSOR, data, &reply);
        return reply.readInt32();
    }

    virtual void decreaseWakeLockRefCount() {
        Parcel data, reply;
        data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor());
        remote()->transact(DECREASE_WAKE_LOCK_REFCOUNT, data, &reply, IBinder::FLAG_ONEWAY);
        return;
    }
};

IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection");
@@ -125,6 +133,11 @@ status_t BnSensorEventConnection::onTransact(
            reply->writeInt32(result);
            return NO_ERROR;
        } break;
        case DECREASE_WAKE_LOCK_REFCOUNT: {
            CHECK_INTERFACE(ISensorEventConnection, data, reply);
            decreaseWakeLockRefCount();
            return NO_ERROR;
        } break;
    }
    return BBinder::onTransact(code, data, reply, flags);
}
Loading