MTP: Add support for reserve storage setting to avoid low storage situations.
Set resource config_mtpReserveSpaceMegabytes to number of megabytes to reserve.
If MTP has dedicated storage this value should be zero, but if MTP is
sharing storage with the rest of the system, set this to a positive value
to ensure that MTP activity does not result in the storage being
too close to full.
BUG: 3250924
Change-Id: I881c87240da268bad1ea1b99ad03673ab85ffdbf
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/media/mtp/MtpStorage.h b/media/mtp/MtpStorage.h
index b13b926..ace720b 100644
--- a/media/mtp/MtpStorage.h
+++ b/media/mtp/MtpStorage.h
@@ -28,11 +28,13 @@
private:
MtpStorageID mStorageID;
const char* mFilePath;
- MtpDatabase* mDatabase;
uint64_t mMaxCapacity;
+ // amount of free space to leave unallocated
+ uint64_t mReserveSpace;
public:
- MtpStorage(MtpStorageID id, const char* filePath, MtpDatabase* db);
+ MtpStorage(MtpStorageID id, const char* filePath,
+ uint64_t reserveSpace);
virtual ~MtpStorage();
inline MtpStorageID getStorageID() const { return mStorageID; }