PebbleOS
Loading...
Searching...
No Matches
Functions
App cache

Tracks the applications whose binaries are stored on the watch. More...

Functions

void app_cache_init (void)
 Initialize the app cache.
 
status_t app_cache_add_entry (AppInstallId app_id, uint32_t total_size)
 Add an entry for a newly installed app.
 
status_t app_cache_remove_entry (AppInstallId app_id)
 Remove an app's entry and delete its binaries.
 
bool app_cache_entry_exists (AppInstallId app_id)
 Check whether an app has an entry in the cache.
 
status_t app_cache_app_launched (AppInstallId app_id)
 Record a launch of an app.
 
status_t app_cache_free_up_space (uint32_t bytes_needed)
 Evict apps until at least bytes_needed bytes of binaries are freed.
 
void app_cache_flush (void)
 Clear the whole cache and delete all cached app binaries.
 

Detailed Description

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.

Function Documentation

◆ app_cache_add_entry()

status_t app_cache_add_entry ( AppInstallId  app_id,
uint32_t  total_size 
)

Add an entry for a newly installed app.

Schedules an eviction on KernelBackground if free space is now too low.

Parameters
app_idApp to add.
total_sizeSize of the app's binaries, in bytes.
Returns
S_SUCCESS or an error from the settings file.

◆ app_cache_app_launched()

status_t 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
app_idLaunched app.
Returns
S_SUCCESS or an error from the settings file.

◆ 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
app_idApp to look up.
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 KernelBackground.

◆ app_cache_free_up_space()

status_t app_cache_free_up_space ( uint32_t  bytes_needed)

Evict apps until at least bytes_needed bytes of binaries are freed.

Parameters
bytes_neededNumber of bytes to free.
Return values
S_SUCCESSSuccess.
E_INVALID_ARGUMENTbytes_needed is 0.
Returns
Other errors 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()

status_t app_cache_remove_entry ( AppInstallId  app_id)

Remove an app's entry and delete its binaries.

Parameters
app_idApp to remove.
Returns
S_SUCCESS or an error from the settings file.