MTP: Add support for dynamically adding and removing storage units

BUG: 3402847

Change-Id: I7da266061d949abcb6bb11c6faaa47b5e4a2a977
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 @@
     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();