diff options
author | Tom Marshall <tdm@cyngn.com> | 2016-06-06 10:09:50 -0700 |
---|---|---|
committer | Tom Marshall <tdm@cyngn.com> | 2016-06-07 14:18:01 -0700 |
commit | b3fbce13d6a0c30012e069c4a2131407beb31ab7 (patch) | |
tree | 0984607347d3228b710613cbffa72bcfb2121ec5 /media/mtp/MtpServer.h | |
parent | 9bdc0f69492d90fbceca68d3b40716b4722a3222 (diff) | |
download | frameworks_av-b3fbce13d6a0c30012e069c4a2131407beb31ab7.zip frameworks_av-b3fbce13d6a0c30012e069c4a2131407beb31ab7.tar.gz frameworks_av-b3fbce13d6a0c30012e069c4a2131407beb31ab7.tar.bz2 |
MtpServer: Fix concurrent access to mStorages
* getStorage is called both internally with mMutex held and externally
without mMutex held. Create getStorageLocked for internal use and
make getStorage a wrapper.
* hasStorage is only called internally with mMutex held. Make it a
private method.
Change-Id: I8f73310ad6cca14cd88b8e29f20cc181b3a4fac3
Diffstat (limited to 'media/mtp/MtpServer.h')
-rw-r--r-- | media/mtp/MtpServer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h index 8bd0472..a79e199 100644 --- a/media/mtp/MtpServer.h +++ b/media/mtp/MtpServer.h @@ -95,8 +95,6 @@ public: virtual ~MtpServer(); MtpStorage* getStorage(MtpStorageID id); - inline bool hasStorage() { return mStorages.size() > 0; } - bool hasStorage(MtpStorageID id); void addStorage(MtpStorage* storage); void removeStorage(MtpStorage* storage); @@ -108,6 +106,10 @@ public: void sendObjectUpdated(MtpObjectHandle handle); private: + MtpStorage* getStorageLocked(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); |