Add a delete cache entry

We need to be able to remove a cache entry in case it is
corrupted.

Bug: 6485734
Change-Id: I1888fc1a7b03e83d32cd86970e5802ebe6280392
diff --git a/src/com/android/tradefed/build/FileDownloadCache.java b/src/com/android/tradefed/build/FileDownloadCache.java
index 9b3439a..144edd7 100644
--- a/src/com/android/tradefed/build/FileDownloadCache.java
+++ b/src/com/android/tradefed/build/FileDownloadCache.java
@@ -373,4 +373,21 @@
     long getMaxFileCacheSize() {
         return mMaxFileCacheSize;
     }
+
+    /**
+     * Allow deleting an entry from the cache. In case the entry is invalid or corrupted.
+     */
+    public void deleteCacheEntry(String remoteFilePath) {
+        mCacheMapLock.lock();
+        try {
+            File file = mCacheMap.remove(remoteFilePath);
+            if (file != null) {
+                FileUtil.recursiveDelete(file);
+            } else {
+                CLog.i("No cache entry to delete for %s", remoteFilePath);
+            }
+        } finally {
+            mCacheMapLock.unlock();
+        }
+    }
 }