EGL BlobCache: Support multifile cache and flexible size limit

This CL introduces the ability to support EGL blob cache using
multiple files. This allows us to increase the amount of cache
available to applications, without increasing process memory
used to get/set from the cache.

In order to support this, entries will be written to a new
directory in the same location:

  $ adb shell
  # cd /data/user_de/0/<packge_name>/code_cache
  # ls -la com.android.opengl.shaders_cache.multifile
  total 53M
  drwx--S--- 2 u0_a276 u0_a276_cache 248K 2022-12-13 15:45 .
  drwxrws--x 3 u0_a276 u0_a276_cache 404K 2022-12-13 11:26 ..
  -rw------- 1 u0_a276 u0_a276_cache 7.1K 2022-12-13 15:43 1000572839
  -rw------- 1 u0_a276 u0_a276_cache 8.9K 2022-12-13 15:43 1000616115
  -rw------- 1 u0_a276 u0_a276_cache 5.0K 2022-12-13 15:43 1001816402
  -rw------- 1 u0_a276 u0_a276_cache 4.3K 2022-12-13 15:44 1002265221
  -rw------- 1 u0_a276 u0_a276_cache 8.2K 2022-12-13 15:44 1002773033
  -rw------- 1 u0_a276 u0_a276_cache 2.8K 2022-12-13 15:45 1004532460
  -rw------- 1 u0_a276 u0_a276_cache 4.3K 2022-12-13 15:45 1005120329
  ...

The filenames are generated by hashing the incoming key.

The cache limit is set in ag/20506291 by GraphicsEnvironment based on
getCacheQuotaBytes from StorageManager. If exceeded, we invoke an LRU
that clears files, oldest first, until under the cap.

The new mode is enable by default, but can be disabled with:

  adb shell setprop debug.egl.blobcache.multifilemode false

The cache limit can also be modified with debug properties:

  adb shell setprop debug.egl.blobcache.bytelimit <bytes>

Test: Multiple apps and ANGLE traces
Test: /data/nativetest64/EGL_test/EGL_test
Bug: b/246966894
Change-Id: I5e946d43728fdcea7dad08a4283129490893a122
diff --git a/opengl/libs/EGL/FileBlobCache.cpp b/opengl/libs/EGL/FileBlobCache.cpp
index 751f3be..3f7ae7e 100644
--- a/opengl/libs/EGL/FileBlobCache.cpp
+++ b/opengl/libs/EGL/FileBlobCache.cpp
@@ -185,4 +185,10 @@
     }
 }
 
+size_t FileBlobCache::getSize() {
+    if (mFilename.length() > 0) {
+        return getFlattenedSize() + cacheFileHeaderSize;
+    }
+    return 0;
+}
 }