ambient: Use cached photos for display
There are several situations we can use cached photos for display: 1. No internet. 2. No access token. 3. Failed to fetch topics. 4. Failed to download photos. When failure happens, we use cache as a ring buffer to get next available photo on disk. The cached photos are saved during normal workflow when fetching topics and photos succeeds. When reading from cache, for simplicity, we can try to read max times, e.g. loop from index 0 to 99, for all possible file names. If failed, means no disk cache available, reading from disk will pause until next time the photo is downloaded successfully. Cache will be cleared when Settings changes. Bug: b/162945419 Test: Added new AmbientPhotoControllerTest. Change-Id: I7d4d04ee1f6e9f40c64a23f6e04c35d0ce46c01f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348689 Commit-Queue: Tao Wu <wutao@chromium.org> Reviewed-by:Xiaohui Chen <xiaohuic@chromium.org> Cr-Commit-Position: refs/heads/master@{#799540}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment