diff options
author | Mike Lockwood <lockwood@android.com> | 2011-02-18 09:07:14 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-02-22 13:57:23 -0800 |
commit | a849440ca96e93f700d62c6e41d48905b4d405b6 (patch) | |
tree | 4df33307f6d972f4465c542390dd7ef3606eea58 /media/mtp/MtpServer.h | |
parent | 39a5f1bbf88c124dc24b34d718a2d95f577b5bf1 (diff) | |
download | frameworks_av-a849440ca96e93f700d62c6e41d48905b4d405b6.zip frameworks_av-a849440ca96e93f700d62c6e41d48905b4d405b6.tar.gz frameworks_av-a849440ca96e93f700d62c6e41d48905b4d405b6.tar.bz2 |
MTP: Add support for dynamically adding and removing storage units
BUG: 3402847
Change-Id: I7da266061d949abcb6bb11c6faaa47b5e4a2a977
Diffstat (limited to 'media/mtp/MtpServer.h')
-rw-r--r-- | media/mtp/MtpServer.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h index 605d5a2..1efa715 100644 --- a/media/mtp/MtpServer.h +++ b/media/mtp/MtpServer.h @@ -22,9 +22,10 @@ #include "MtpResponsePacket.h" #include "MtpEventPacket.h" #include "mtp.h" - #include "MtpUtils.h" +#include <utils/threads.h> + namespace android { class MtpDatabase; @@ -62,20 +63,29 @@ private: MtpString mSendObjectFilePath; size_t mSendObjectFileSize; + Mutex mMutex; + public: MtpServer(int fd, MtpDatabase* database, int fileGroup, int filePerm, int directoryPerm); virtual ~MtpServer(); - void addStorage(const char* filePath, uint64_t reserveSpace); - inline void addStorage(MtpStorage* storage) { mStorages.push(storage); } - MtpStorage* getStorage(MtpStorageID id); + void addStorage(MtpStorage* storage); + void removeStorage(MtpStorage* storage); + void run(); void sendObjectAdded(MtpObjectHandle handle); void sendObjectRemoved(MtpObjectHandle handle); private: + MtpStorage* getStorage(MtpStorageID id); + inline bool hasStorage() { return mStorages.size() > 0; } + bool hasStorage(MtpStorageID id); + void sendStoreAdded(MtpStorageID id); + void sendStoreRemoved(MtpStorageID id); + void sendEvent(MtpEventCode code, uint32_t param1); + bool handleRequest(); MtpResponseCode doGetDeviceInfo(); |