|
PebbleOS v4.47.0-512-g5285d4236
|
Installed apps (BlobDBIdApps). More...
Data Structures | |
| struct | AppDBEntry |
| App database record, as sent by the phone. More... | |
Macros | |
| #define | APP_DB_LEGACY_ENTRY_SIZE offsetof(AppDBEntry, permissions) |
| #define | APP_DB_PERMISSION_MICROPHONE (1u << 0) |
| #define | APP_DB_PERMISSION_HEALTH_ENFORCED (1u << 1) |
| Without it health is allowed, as it is for a phone that never sends permissions. | |
| #define | APP_DB_PERMISSION_HEALTH_GRANTED (1u << 2) |
Typedefs | |
| typedef void(* | AppDBEnumerateCb) (AppInstallId install_id, AppDBEntry *entry, void *data) |
| Callback of app_db_enumerate_entries(). | |
Functions | |
| bool | app_db_microphone_granted (const Uuid *uuid) |
| bool | app_db_health_allowed (const Uuid *uuid) |
| AppInstallId | app_db_get_install_id_for_uuid (const Uuid *uuid) |
| Find the install id of an app. | |
| int | app_db_get_app_entry_for_uuid (const Uuid *uuid, AppDBEntry *entry) |
| Read the record of an app by UUID. | |
| int | app_db_get_app_entry_for_install_id (AppInstallId app_id, AppDBEntry *entry) |
| Read the record of an app by install id. | |
| void | app_db_enumerate_entries (AppDBEnumerateCb cb, void *data) |
| Call a function for every app in the database. | |
| bool | app_db_exists_install_id (AppInstallId app_id) |
| Check whether an install id is in the database. | |
| void | app_db_init (void) |
| Initialize the app database. | |
| int | app_db_insert (const uint8_t *key, int key_len, const uint8_t *val, int val_len) |
| Insert or replace a record in the app database. | |
| int | app_db_get_len (const uint8_t *key, int key_len) |
| Get the length of a record in the app database. | |
| int | app_db_read (const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) |
| Read a record from the app database. | |
| int | app_db_delete (const uint8_t *key, int key_len) |
| Delete a record from the app database. | |
| int | app_db_flush (void) |
| Delete all records of the app database. | |
| int | app_db_compact (void) |
| Compact the settings file backing the app database. | |
| AppInstallId | app_db_check_next_unique_id (void) |
| Get the next install id to be assigned, for tests. | |
Installed apps (BlobDBIdApps).
Records are keyed by app UUID on the wire and stored keyed by AppInstallId.
| struct AppDBEntry |
App database record, as sent by the phone.
| Data Fields | ||
|---|---|---|
| GColor8 | app_face_bg_color | Background color of the app face. |
| Version | app_version | App version. |
| uint32_t | icon_resource_id | Resource id of the app icon. |
| uint32_t | info_flags | Process info flags (visibility, process type, worker), as in the app binary. |
| char | name[APP_NAME_SIZE_BYTES] | App name. |
| uint32_t | permissions |
Optional phone-authorized permissions; absent on legacy records. Only app_db_read() fills it; use app_db_microphone_granted() or app_db_health_allowed() to check a grant. |
| Version | sdk_version | SDK version the app was built with. |
| uint8_t | template_id | Template id, unused by the firmware. |
| Uuid | uuid | App UUID. |
| #define APP_DB_LEGACY_ENTRY_SIZE offsetof(AppDBEntry, permissions) |
| #define APP_DB_PERMISSION_HEALTH_ENFORCED (1u << 1) |
Without it health is allowed, as it is for a phone that never sends permissions.
| #define APP_DB_PERMISSION_HEALTH_GRANTED (1u << 2) |
| #define APP_DB_PERMISSION_MICROPHONE (1u << 0) |
| typedef void(* AppDBEnumerateCb) (AppInstallId install_id, AppDBEntry *entry, void *data) |
Callback of app_db_enumerate_entries().
| install_id | Install id of the app. |
| entry | Record; only valid during the call. |
| data | User data. |
| AppInstallId app_db_check_next_unique_id | ( | void | ) |
Get the next install id to be assigned, for tests.
| int app_db_compact | ( | void | ) |
Compact the settings file backing the app database.
| int app_db_delete | ( | const uint8_t * | key, |
| int | key_len | ||
| ) |
Delete a record from the app database.
The key is the app UUID. Notifies the app install manager.
| key | Key data. |
| key_len | Length of key in bytes. |
| void app_db_enumerate_entries | ( | AppDBEnumerateCb | cb, |
| void * | data | ||
| ) |
Call a function for every app in the database.
The database is locked during the iteration.
| cb | Callback. |
| data | User data passed to cb. |
| bool app_db_exists_install_id | ( | AppInstallId | app_id | ) |
Check whether an install id is in the database.
| app_id | Install id. |
| int app_db_flush | ( | void | ) |
Delete all records of the app database.
Also cancels any app fetch and clears the app install manager state.
| int app_db_get_app_entry_for_install_id | ( | AppInstallId | app_id, |
| AppDBEntry * | entry | ||
| ) |
Read the record of an app by install id.
| app_id | Install id. | |
| [out] | entry | Record. |
| int app_db_get_app_entry_for_uuid | ( | const Uuid * | uuid, |
| AppDBEntry * | entry | ||
| ) |
Read the record of an app by UUID.
| uuid | App UUID. | |
| [out] | entry | Record. |
| AppInstallId app_db_get_install_id_for_uuid | ( | const Uuid * | uuid | ) |
Find the install id of an app.
| uuid | App UUID. |
INSTALL_ID_INVALID if the app is not in the database, or a negative errno if the database could not be opened. | int app_db_get_len | ( | const uint8_t * | key, |
| int | key_len | ||
| ) |
Get the length of a record in the app database.
The key is the app UUID.
| key | Key data. |
| key_len | Length of key in bytes. |
| bool app_db_health_allowed | ( | const Uuid * | uuid | ) |
| void app_db_init | ( | void | ) |
Initialize the app database.
Scans the database to pick the next unused install id.
| int app_db_insert | ( | const uint8_t * | key, |
| int | key_len, | ||
| const uint8_t * | val, | ||
| int | val_len | ||
| ) |
Insert or replace a record in the app database.
The key is the app UUID and the value an AppDBEntry. A new app gets the next unused install id; an existing one keeps its id, and an in-progress fetch of it is cancelled. Notifies the app install manager.
| key | Key data. |
| key_len | Length of key in bytes. |
| val | Value data. |
| val_len | Length of val in bytes. |
| bool app_db_microphone_granted | ( | const Uuid * | uuid | ) |
| int app_db_read | ( | const uint8_t * | key, |
| int | key_len, | ||
| uint8_t * | val_out, | ||
| int | val_out_len | ||
| ) |
Read a record from the app database.
The key is the app UUID.
| key | Key data. | |
| key_len | Length of key in bytes. | |
| [out] | val_out | Buffer for the value. |
| val_out_len | Size of val_out in bytes. |