MTP: Add support of ObjectInfoChanged Event

Under MTP mode, new file created at device side shown size zero at PC side
due to file information is not updated to PC in time with ObjectAdded event

Bug: 77883345
Test: 1. Take screenshot of device under MTP mode with Win10 / Linux
    2. file copy, delete, rename between PC and device
    3. file copy, delete, rename on device with adb shell command
Test: adb shell am instrument -w android.mtp/
	android.support.test.runner.AndroidJUnitRunner

Change-Id: If428064fb0104b53b8afd5b050a4fab4a09312f0
gugelfrei
James 6 years ago
parent 93adab132c
commit 5513843dfe

@ -99,6 +99,7 @@ static const MtpEventCode kSupportedEventCodes[] = {
MTP_EVENT_STORE_ADDED,
MTP_EVENT_STORE_REMOVED,
MTP_EVENT_DEVICE_PROP_CHANGED,
MTP_EVENT_OBJECT_INFO_CHANGED,
};
MtpServer::MtpServer(IMtpDatabase* database, int controlFd, bool ptp,
@ -259,6 +260,11 @@ void MtpServer::sendObjectRemoved(MtpObjectHandle handle) {
sendEvent(MTP_EVENT_OBJECT_REMOVED, handle);
}
void MtpServer::sendObjectInfoChanged(MtpObjectHandle handle) {
ALOGV("sendObjectInfoChanged %d\n", handle);
sendEvent(MTP_EVENT_OBJECT_INFO_CHANGED, handle);
}
void MtpServer::sendStoreAdded(MtpStorageID id) {
ALOGV("sendStoreAdded %08X\n", id);
sendEvent(MTP_EVENT_STORE_ADDED, id);

@ -115,6 +115,7 @@ public:
void sendObjectAdded(MtpObjectHandle handle);
void sendObjectRemoved(MtpObjectHandle handle);
void sendObjectInfoChanged(MtpObjectHandle handle);
void sendDevicePropertyChanged(MtpDeviceProperty property);
private:

Loading…
Cancel
Save