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

Commit a4414818 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "MTP: Add support for device property changed events"

parents 3a0fb34e 0fa848d7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -190,8 +190,8 @@ void MtpProperty::write(MtpDataPacket& packet) {
            if (deviceProp)
                writeValue(packet, mCurrentValue);
    }
    packet.putUInt32(mGroupCode);
    if (!deviceProp)
        packet.putUInt32(mGroupCode);
    packet.putUInt8(mFormFlag);
    if (mFormFlag == kFormRange) {
            writeValue(packet, mMinimumValue);
+6 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ static const MtpEventCode kSupportedEventCodes[] = {
    MTP_EVENT_OBJECT_REMOVED,
    MTP_EVENT_STORE_ADDED,
    MTP_EVENT_STORE_REMOVED,
    MTP_EVENT_DEVICE_PROP_CHANGED,
};

MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp,
@@ -261,6 +262,11 @@ void MtpServer::sendStoreRemoved(MtpStorageID id) {
    sendEvent(MTP_EVENT_STORE_REMOVED, id);
}

void MtpServer::sendDevicePropertyChanged(MtpDeviceProperty property) {
    ALOGV("sendDevicePropertyChanged %d\n", property);
    sendEvent(MTP_EVENT_DEVICE_PROP_CHANGED, property);
}

void MtpServer::sendEvent(MtpEventCode code, uint32_t param1) {
    if (mSessionOpen) {
        mEvent.setEventCode(code);
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public:

    void                sendObjectAdded(MtpObjectHandle handle);
    void                sendObjectRemoved(MtpObjectHandle handle);
    void                sendDevicePropertyChanged(MtpDeviceProperty property);

private:
    void                sendStoreAdded(MtpStorageID id);