Tracks the applications whose binaries are stored on the watch.
More...
Tracks the applications whose binaries are stored on the watch.
Each entry records an app's size, install date, last launch and launch count, persisted in a settings file. When storage runs low, the entries with the lowest priority (least recently installed or launched) are evicted and their binaries deleted; the default watchface and worker and the quick launch apps are only evicted as a last resort. Removing an entry deletes the app's binaries and emits a PEBBLE_APP_CACHE_EVENT.
◆ app_cache_add_entry()
| int app_cache_add_entry |
( |
AppInstallId |
app_id, |
|
|
uint32_t |
total_size |
|
) |
| |
Add an entry for a newly installed app.
Schedules an eviction on SysWorkq if free space is now too low.
- Parameters
-
| app_id | App to add. |
| total_size | Size of the app's binaries, in bytes. |
- Return values
-
- Returns
- Negative errno from the settings file on failure.
◆ app_cache_app_launched()
| int app_cache_app_launched |
( |
AppInstallId |
app_id | ) |
|
Record a launch of an app.
Updates the last launch time and launch count. If the app has no entry, its binaries are deleted.
- Parameters
-
- Return values
-
- Returns
- Negative errno from the settings file on failure.
◆ app_cache_entry_exists()
| bool app_cache_entry_exists |
( |
AppInstallId |
app_id | ) |
|
Check whether an app has an entry in the cache.
An entry whose binaries are missing from storage is removed.
- Parameters
-
- Returns
- true if the entry exists and the app's binaries are stored.
◆ app_cache_flush()
| void app_cache_flush |
( |
void |
| ) |
|
Clear the whole cache and delete all cached app binaries.
Must be called from SysWorkq.
◆ app_cache_free_up_space()
| int app_cache_free_up_space |
( |
uint32_t |
bytes_needed | ) |
|
Evict apps until at least bytes_needed bytes of binaries are freed.
- Parameters
-
| bytes_needed | Number of bytes to free. |
- Return values
-
| 0 | Success. |
| -EINVAL | bytes_needed is 0. |
- Returns
- Other negative errno values come from the settings file.
◆ app_cache_init()
| void app_cache_init |
( |
void |
| ) |
|
Initialize the app cache.
Deletes leftover app binaries when no cache file exists and purges orphaned resource files.
◆ app_cache_remove_entry()
| int app_cache_remove_entry |
( |
AppInstallId |
app_id | ) |
|
Remove an app's entry and delete its binaries.
- Parameters
-
- Return values
-
- Returns
- Negative errno from the settings file on failure.