prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
p, make it so the kernel can do it on the worker's behalf and put
// the call at the bottom of prv_worker_cleanup.
worker_state_deinit();
sys_exit();
}
//! Heap locking function for our app heap. Our process heaps don't actually
//! have to be locked because they're the sole property of the process and no
//! o... | {
PBL_LOG(LOG_LEVEL_WARNING, "Tried to launch an invalid worker in bank %u!",
process_metadata_get_code_bank_num(app_md));
return false;
} |
// The rest of worker_ram is available for worker state to use as it sees fit.
if (!worker_state_configure(&worker_ram)) {
PBL_LOG(LOG_LEVEL_ERROR, "Worker state configuration failed");
return false;
}
// The remaining space in worker_segment is assigned to the worker's
// heap. Worker state needs t... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return data->list_copy;
} |
prv_free_list_copy(data);
data->list_copy = gdraw_command_list_clone(list);
return data->list_copy;
}
static void prv_destructor(KinoReel *reel) {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
if (data->impl->destructor) {
data->impl->destructor(data->context);
}
if (data->owns_from... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
#if CAPABILITY_HAS_JAVASCRIPT && !RECOVERY_FW
if (!prv_is_current_task_app_or_worker()) {
return;
}
jmem_heap_stats_t jerry_mem_stats = {};
jmem_heap_get_stats(&jerry_mem_stats);
const size_t requested_size = 0; // not available unfortunately
const size_t free = (jerry_mem_stats.size - jerry_mem_stat... |
void app_heap_analytics_log_stats_to_app_heartbeat(bool is_rocky_app) {
Heap *const heap = task_heap_get_for_current_task();
sys_analytics_max(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_SIZE, heap_size(heap),
AnalyticsClient_CurrentTask);
sys_analytics_max(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_PEAK... |
prv_is_custom_day_scheduled(AlarmEditorData *data);
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Helper functions
static void prv_remove_windows(AlarmEditorData *data) {
if (app_window_stack_contains_window(&data->time_picker_window.window)) {
app_windo... | i18n_free_all(&data->custom_day_picker_window) | ;
}
static void prv_handle_custom_day_selection(int index, void *callback_context) {
AlarmEditorData *data = (AlarmEditorData *)callback_context;
prv_setup_custom_day_picker_window(data);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Menu Layer Callbacks... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if ((prev_state == SmartstrapStateReadDisabled) &&
(new_state == SmartstrapStateReadInProgress)) {
} else if ((prev_state == SmartstrapStateReadDisabled) &&
(new_state == SmartstrapStateReadReady)) {
} else if ((prev_state == SmartstrapStateReadInProgress) &&
(new_state == Sma... |
}
SmartstrapState smartstrap_fsm_state_get(void) {
return s_fsm_state;
}
void smartstrap_fsm_state_reset(void) {
s_fsm_state = SmartstrapStateReadReady;
}
bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) {
if (s_fsm_state != expected_state) {
return false;... |
ure we detected a reset of the elapsed after rescheduling
cl_assert(s_stopped_handler_calls.num_calls == 2);
cl_assert(detected_reset_of_elapsed);
// Make sure the frame reached the "to" state
cl_assert_equal_point(layer.frame.origin, to_r.origin);
#endif
}
// -----------------------------------------------... | animation_get_context(h) | == NULL);
// Make sure no animations exist
cl_assert_equal_i(prv_count_animations(), 0);
#endif
}
// --------------------------------------------------------------------------------------
// Stopped handler that calls destroy
static void prv_stopped_handler_destroy(Animation *animation, bool finished, void *con... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (s_pra_cycling_pause_count == 0) {
PBL_LOG(LOG_LEVEL_INFO, "Pausing address cycling (pinned_addr="BT_DEVICE_ADDRESS_FMT")",
BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr));
prv_allow_cycling(false);
} |
++s_pra_cycling_pause_count;
}
bt_unlock();
}
void bt_local_addr_resume_cycling(void) {
bt_lock();
{
PBL_ASSERTN(s_pra_cycling_pause_count);
--s_pra_cycling_pause_count;
if (s_pra_cycling_pause_count == 0) {
PBL_LOG(LOG_LEVEL_INFO, "Resuming address cycling (pinned_addr="BT_DEVICE_ADDRES... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | _Static_assert(sizeof(GSize) == sizeof(GValue[2]),
"TextNode requires a GSize to be equivalent to a GValue[2]") | ;
typedef enum {
GAxis_X = 0,
GAxis_Y,
GAxis_W = GAxis_X,
GAxis_H = GAxis_Y,
} GAxis;
typedef enum {
GAxisAlign_Min = 0,
GAxisAlign_Center,
GAxisAlign_Max,
} GAxisAlign;
_Static_assert((((int)GAxisAlign_Min == GTextAlignmentLeft) &&
((int)GAxisAlign_Center == GTextAlignmentCenter) &&... |
, &GRect(4, 2, 16, 8));
}
static void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_rect(ctx, &GRect(10, 2, 18, 4));
}
static void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GC... | (&ctx, fb) | |
0, 912, 264},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 912, 264},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -32, 920, 256}... | { -40, 912, 264},
{ -32, 920, 248},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 920, 256},
{ -32, 920, 256},
{ -32, 920, 264},
{ -32, 912, 256},
{ -40, 920, 248},
{ -32, 912, 264},
{ -32, 912, 256},
{ -32, 920, 240},
{ -40, 920, 264},
{ -32, 920, 256},
{ -32, 9... |
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, 920, 256},
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, 920, 256},
{ -40, 920, 264},
{ -32, 920, 256},
{ -40, 920, 248},
{ -32, 912, 256},
{ -32, 912, 256},
{ -32, ... |
uration_a + total_duration_b + delay_seq);
// Create 2 test animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
animation_set_delay(a, delay_a);
animation_set_play_count(a, play_count_a);
Animation *b = prv_create_test_animation();
animation_set_duration(b, dur... | MAX(total_duration_a, total_duration_b) | );
cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total);
animation_destroy(spawn);
#endif
}
// --------------------------------------------------------------------------------------
// Test unschedule all when we have multiple animations, some complex
void test_animation__unschedule_all(... |
se {
prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer,
word_buffer_size, timestamp);
}
} else { // past
time_t difference = now - timestamp;
if (now < timestamp || difference < SECONDS_PER_MINUTE) {
i18n_get_with_buffer("Now", word_buffer, word_buffer_size)... | if (clock_is_timezone_set()) {
int region_id = clock_get_timezone_region_id();
if (region_id != UNKNOWN_TIMEZONE_ID) {
timezone_database_load_region_name(region_id, region_name);
} else {
// Show something like UTC-4 or UTC-10.25
// This will typically happen in the emulator when we know t... |
}
int16_t clock_get_timezone_region_id(void) {
return rtc_get_timezone_id();
}
void clock_set_timezone_by_region_id(uint16_t region_id) {
TimezoneInfo tz_info;
prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info);
prv_update_time_info_and_generate_event(NULL, &tz_info);
}
void clo... |
HB1PeriphResetCmd(ahb1_periphs, DISABLE);
RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE);
RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE);
RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE);
RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE);
RCC_APB1PeriphResetCmd(apb1_periph... | boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE) | ) {
dbgserial_putstr("Failed to start firmware, strike two.");
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
} else {
dbgserial_putstr("Failed to start firmware, strike one.");
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
}
return false;
}
static bool check_force_boot_recovery(void) {
i... |
{ 1184, 352, 80},
// 2 seconds
{ 1048, 264, 128},
{ 960, 240, 152},
{ 896, 264, 184},
{ 848, 320, 184},
{ 888, 368, 96},
{ 984, 424, 96},
{ 1224, 464, 160},
{ 1200, 592, 304},
{ 1120, 680, 368},
{ 672, 600, 120},
{ 696, 608, 96},
{ 1008, 584, 144},
{ 1480, 376,... | { 1072, 296, -176},
{ 1104, 376, -192},
{ 1392, 464, -184},
{ 1240, 688, -104},
{ 1440, 912, -200},
{ 1176, 560, -256},
{ 968, 488, -264},
{ 1048, 456, -320},
{ 1296, 336, -200},
{ 1248, 136, -56},
{ 1088, 72, -16},
{ 1120, 96, -104},
{ 1248, 120, -120},
{ 1224, 6... |
{ 1176, -8, -224},
{ 1000, -224, -224},
{ 848, -360, -216},
{ 1056, -256, -72},
{ 992, -168, -200},
{ 1112, -96, -264},
{ 1192, -24, -272},
{ 976, -8, -288},
{ 824, 48, -304},
{ 864, 96, -240},
{ 1072, 152, -232},
{ 1128, 208, -216},
{ 1208, 256, -280},
{ 1576, 4... |
UBSECTOR_SIZE_BYTES - 1)) == 0,
"Sections divide into subsectors evenly, size is 0x%" PRIx16, CHUNK_SIZE_BYTES);
for (unsigned int i = 0; i < (CHUNK_SIZE_BYTES / SUBSECTOR_SIZE_BYTES); ++i) {
flash_erase_subsector_blocking(addr + (i * SUBSECTOR_SIZE_BYTES));
}
LogChunkHeader chunk_header = {
.inva... | if (i == 0 || serial_distance(lowest_chunk_id, chunk_header.chunk_id, CHUNK_ID_BIT_WIDTH) < 0) {
lowest_chunk_index = i;
lowest_chunk_id = chunk_header.chunk_id;
} |
++num_valid_chunks;
}
bool success = true;
for (int i = 0; success && i < num_valid_chunks; ++i) {
success = dump_chunk(generation, lowest_chunk_index, cb);
lowest_chunk_index = (lowest_chunk_index + 1) % NUM_CHUNKS;
}
completed_cb(num_valid_chunks != 0);
return true;
}
void flash_logging_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | periph_config_release_lock() | ;
gpio_release(GPIOC);
s_initialized = true;
}
static void prv_putchar(uint8_t c) {
if (!s_initialized) {
return;
}
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) continue;
USART_SendData(USART3, c);
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) continue;
}
static void p... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return "TextLayer";
} | |
active_calories, uint32_t distance_mm) {
int entry_idx = s_num_captured_activity_sessions;
// Ignore sleep activities for this test
if ((activity_type == KAlgActivityType_Sleep)
|| (activity_type == KAlgActivityType_RestfulSleep)) {
return;
}
// If this activity already exists, update it
KAlgTest... | (steps - entry->exp_steps) | ;
float weighted_error = (float)error * entry->weight;
printf("\nRESULTS: exp_steps: %d, act_steps: %d, ref_steps: %d, error: %d, weighted_error: %f",
entry->exp_steps, (int)steps, (int)ref_steps, (int)error, weighted_error);
printf("\n min: (steps, vmc, orientation)");
for (int j = 0... |
action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, &s_bar_icon_up_bitmap) | ;
action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, &s_bar_icon_down_bitmap);
action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, &s_bar_icon_check_bitmap);
action_bar_layer_add_to_window(action_bar, &nw->window);
action_bar_layer_set_click_config_provider(action_bar, (ClickConfigProvider) click_config_... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (rect_to_clip->origin.x > rect_clipper->origin.x + rect_clipper->size.w) {
rect_to_clip->origin.x = rect_clipper->origin.x + rect_clipper->size.w;
rect_to_clip->size.w = 0;
} | |
iter_state_with_timeline_idx(4));
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 3);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equ... | timeline_model_get_iter_state(1) | == timeline_model_get_iter_state_with_timeline_idx(2));
}
void test_timeline_model__graceful_delete_first(void) {
TimelineModel model = {0};
model.direction = TimelineIterDirectionFuture;
time_t first_time = 1421178000;
// Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015
timeline_model_init(first_time, &mode... |
buffer), "%c: %"PRIi8, 'X' + i,
data->axis_offsets[X_AdjustState + i]);
graphics_draw_text(ctx, data->text_buffer, font,
GRect(bounds->origin.x, bounds->origin.y + 35 + LINE_HEIGHT * i,
pixel_max, pixel_max),
GTextOverflowModeWo... | prv_display_serial_number(layer, ctx) | |
}
static char *prv_get_timezone_title(void) {
/// Title of the menu for changing the watch's timezone.
return i18n_noop("Timezone");
}
// Timezone Region Menu
/////////////////////////
static void prv_region_menu_select(OptionMenu *option_menu, int selection, void *context) {
SettingsTimeData *data = ((Settin... | (title, data) | , i18n_get(subtitle, data), NULL);
}
static void prv_selection_will_change_cb(SettingsCallbacks *context, uint16_t *new_row,
uint16_t old_row) {
if (!clock_timezone_source_is_manual() && *new_row == TimeRow_Timezone) {
*new_row = old_row;
}
}
static uint16_t prv_num_ro... |
//////////////////////////////////////////////////////////////////////////////////////
//! Fakes
bool system_task_add_callback(SystemTaskEventCallback cb, void *data) {
cb(data);
return true;
}
void event_put(PebbleEvent* event) {
s_num_dnd_events_put++;
}
// Thursday, March 12, 2015, 00:00 UTC
static const in... | (s_num_dnd_events_put, 1) | |
vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile));
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(!alerts_should_vibrate_for_type(AlertReminder));
alerts_set_notification_vibe_timestamp... | (alerts_should_enable_backlight_for_type(AlertMobile)) | ;
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(alerts_should_vibrate_for_type(AlertReminder));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(alerts_should_enable_backlight_for_type(AlertReminder));
cl_assert... |
animation_set_curve(h, AnimationCurveEaseOut);
cl_assert(animation_get_curve(h) == AnimationCurveEaseOut);
static const PropertyAnimationImplementation implementation2 = {
.base = {
.setup = prv_setup_handler,
.update = (AnimationUpdateImplementation) property_animation_update_gpoint,
.te... | prv_count_handler_entries(&s_started_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
animation_set_elapsed(a, duration_a - leftover_a);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
// --------------... |
.text_node;
cl_assert(text_node);
cl_assert_equal_s(text_node->text, text);
cl_assert_equal_p(text_node->font, font);
cl_assert_equal_p(text_node->overflow, overflow_mode);
cl_assert_equal_p(text_node->alignment, alignment);
TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref;
cl_assert_equal_p... | cl_assert_equal_i(s_num_draw_custom_calls, 1) | ;
}
void test_graphics_text_node__create_container_nodes_buffer(void) {
GTextNodeHorizontal *h_empty = graphics_text_node_create_horizontal(0);
cl_assert_equal_i(h_empty->container.max_nodes, 0);
cl_assert_equal_p(NULL, h_empty->container.nodes);
GTextNodeHorizontal *h_nodes = graphics_text_node_create_horizo... |
(2, 0) - no negative offset
setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "aaa", &s_font_info, RECT_TEXT_2_0,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(gbitmap_pb... | (framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)) | ;
// Test negative context boxes - ensure nothing is rendered
setup_test_aa_sw(&ctx, fb, RECT_NEG, RECT_NEG, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NU... |
change callback
static void prv_health_service_event_handler(HealthEventType event, void *context) {
SportsAppData *sports_app_data = context;
if (event == HealthEventHeartRateUpdate) {
sports_app_data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM);;
}
}
static void prv_sync_error... | app_sync_get(s, SPORTS_ACTIVITY_STATE_KEY) | |
_file();
if (rv != S_SUCCESS) {
return;
}
AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry));
EnumerateData cb_data = {
.cb = cb,
.data = data,
.entry_buf = db_entry,
};
settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data);
prv_close_file_and_unlock_m... | (LOG_LEVEL_WARNING, "Tried to delete an app that is currently being fetched, %"PRId32,
app_id) | ;
rv = prv_cancel_app_fetch(app_id);
}
if (rv == S_SUCCESS) {
rv = settings_file_delete(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId));
}
prv_close_file_and_unlock_mutex();
if (rv == S_SUCCESS) {
// uuid will be free'd by app_install_manager
Uuid *uuid_copy = kernel_mal... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (connection->ppogatt_wa_state) {
ppogatt_destroy_state(connection->ppogatt_wa_state);
} |
kernel_free(connection);
}
}
prv_unlock();
}
bool connection_is_valid(Connection *connection) {
bool rv;
prv_lock();
{
rv = list_contains((ListNode *)s_connections, (const ListNode *)connection);
}
prv_unlock();
return rv;
}
static bool prv_connection_by_idx_list_filter_cb(ListNode *fo... |
t_node.node, ctx, &TEST_TEXT_BOX, NULL, &size);
cl_assert(size.w > 0);
cl_assert(size.h > 0);
cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w);
cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h);
}
void test_graphics_text_node__text_size(void) {
GContext *ctx = &s_data.gcontext;
GTextNodeText text_node = {};
text_no... | graphics_text_node_container_add_child(&horizontal_a->container, &text_c.node) | );
cl_assert(!graphics_text_node_container_add_child(&horizontal_a->container, &custom_a->node));
cl_assert_equal_i(horizontal_a->container.num_nodes, 3);
GTextNodeVertical *vertical_a = graphics_text_node_create_vertical(2);
cl_assert(vertical_a->container.node.free_on_destroy);
cl_assert_equal_i(vertical_a... |
le_connect_is_connected_as_slave()) {
memmove(&data->name_text_buffer[1], &data->name_text_buffer[0], BT_DEVICE_NAME_BUFFER_SIZE);
data->name_text_buffer[0] = '-';
strcat(data->name_text_buffer, "-");
}
}
text_layer_set_text(&data->name_text_layer, data->name_text_buffer);
// Set the name f... | (window, prv_click_configure, window) | ;
window_set_fullscreen(window, true);
window_set_overrides_back_button(window, true);
const bool animated = false;
app_window_stack_push(window, animated);
}
////////////////////
// App Event Handler + Loop
static void prv_allow_pairing(RecoveryFUAppData* data, bool allow) {
if (data->is_pairing_allowed ... |
uchEvent_Touchdown);
cl_assert_equal_b(updated, true);
cl_assert_equal_i(rec_event, RecognizerEvent_Started);
updated = false;
new_state = RecognizerState_Updated;
recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_PositionUpdate });
cl_assert_equal_i(last_touch_event.type, TouchEvent_Posi... | (!recognizer_should_evaluate_simultaneously(NULL, r2)) | ;
cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2));
s_simultaneous = true;
cl_assert(!recognizer_should_evaluate_simultaneously(NULL, NULL));
cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL));
cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2));
cl_assert(recognizer_s... |
{
WakeupId wakeup_id = 0;
sys_wakeup_cancel_all_for_app();
// Schedule 8 (max), at 1 minute offsets, then fail on 9th
for (int i = 1; i <= MAX_WAKEUP_EVENTS_PER_APP; i++) {
wakeup_id = sys_wakeup_schedule(sys_get_time() + (i * WAKEUP_EVENT_WINDOW), 0, false);
cl_assert_equal_i(sys_wakeup_query(wakeup_... | (first_timer, test_timer) | ;
// Schedule another in the future
time_t third_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 3;
WakeupId third_wakeup_id = sys_wakeup_schedule(third_event, 0, false);
cl_assert_equal_i(sys_wakeup_query(third_wakeup_id), third_event);
// Schedule another in the future
time_t fourth_event = sys_get_time... |
ed PBI
void test_bitblt_circular__color_1_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE);
GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx);
cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular);
cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944);
bitblt_bitmap_into_bitm... | gbitmap_get_bounds(native_framebuffer) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (charge.is_charging) {
next_dialog_state = DialogState_Charging;
} else if (charge.is_plugged) {
next_dialog_state = DialogState_FullyCharged;
} else {
// Unplugged. We'll be shutting down in a couple seconds if the user doesn't
// plug the charger back in, so don't change the dialog.
next_di... |
Dialog *dialog = simple_dialog_get_dialog(data->dialog);
if (next_dialog_state != data->last_dialog_state) {
// Setting the dialog icon to itself restarts the animation, which looks
// bad, so we want to avoid that if we can help it.
switch (next_dialog_state) {
case DialogState_FullyCharged:
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | event_service_client_unsubscribe(&session->dictation_result_sub) | ;
voice_window_lose_focus(session->voice_window);
}
}
static void prv_stop_session(DictationSession *session) {
session->in_progress = false;
event_service_client_unsubscribe(&session->dictation_result_sub);
if (pebble_task_get_current() == PebbleTask_App) {
event_service_client_unsubscribe(&session->a... |
ReservedServiceManagement;
const uint16_t attribute_id = ManagementServiceAttributeServiceDiscovery;
if (s_reserved_read_mbuf) {
// already a read in progress
return;
}
s_reserved_read_mbuf = mbuf_get(s_read_buffer, sizeof(s_read_buffer), MBufPoolSmartstrap);
SmartstrapResult result = prv_do_send(Gene... | app_install_get_id_for_uuid(app_uuid) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | va_end(fmt_args) | ;
}
|
cl_assert_equal_i(standby_timer_get_timeout(), 30000);
fake_battery_set_charging(true);
fake_battery_set_connected(true);
periodic_timer_trigger(1);
standby_timer_trigger(1);
cl_assert(!s_entered_standby);
}
void test_battery_monitor__increase_discharging(void) {
int low_mv = battery_curve_lookup_volta... | periodic_timer_trigger(1) | ;
result = battery_get_charge_state();
// due to fudge factors we merely check that the percentage is in range and
// that it is monotonically increasing
cl_assert((result.charge_percent >= 0) && (result.charge_percent <= 100));
cl_assert(result.charge_percent >= last_charge_percent);
cl_assert(... |
ries(&s_started_handler_calls, inner_seq), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, inner_seq), 0);
cl_assert_equal_i(prv_... | (prv_last_update_distance(a), ANIMATION_NORMALIZED_MIN) | ;
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MIN);
#endif
}
// --------------------------------------------------------------------------------------
// Test the get_duration call on a sequence animation
void test_animation__sequence_get_duration(void) {
#ifdef TEST_INCLUDE_COMPLEX
const... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
*out = 0;
--ctx->zeros_remaining;
return true;
} |
uint8_t byte = *(ctx->sle_buffer++);
if (byte != ctx->escape) {
*out = byte;
} else {
byte = *(ctx->sle_buffer++);
if (byte == 0x00) {
// end of stream
ctx->sle_buffer = NULL;
return false;
} else if (byte == 0x01) {
// literal escape byte
*out = ctx->escape;
} e... |
const ANCSAttribute *subtitle,
const ANCSAttribute *app_id,
const TimelineItemActionGroup *pebble_actions,
ANCSProperty properties) {
TimelineItemAction *action = item->action_group.actions;
... | (negative_action) | ;
required_space_for_strings += prv_max_ellipsified_cstring_size(app_id);
if (prv_should_add_sender_attr(app_id, title)) {
required_space_for_strings += prv_max_ellipsified_cstring_size(title);
}
int num_pebble_actions = 0;
if (notif_prefs) {
for (int i = 0; i < notif_prefs->action_group.num_actions... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
if (highlight) {
graphics_context_set_fill_color(ctx, SETTINGS_MENU_HIGHLIGHT_COLOR);
graphics_context_set_text_color(ctx, GColorWhite);
} else {
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_context_set_text_color(ctx, GColorBlack);
}
graphics_fill_rect(ctx, &cell_layer->bounds)... | |
*prev_item = (WindowStackItem *)(window_stack->list_head);
// Insert before the found previous item, provided that it exists.
ListNode *list_node_closest_to_head = &stack_item->list_node;
list_init(list_node_closest_to_head);
if (prev_item) {
ListNode *prev_list_node = &prev_item->list_node;
list_nod... | if (window_manager_is_window_visible(pop_item->window)) {
window_from = pop_item->window;
// If no transition is explicitly provided, use the one specified when pushed.
transition = transition ?: pop_item->pop_transition_implementation;
PBL_ASSERTN(transition);
} else {
// We don't intentionally c... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ALWAYS, "__TINTIN__ - RECOVERY MODE") | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
prompt_send_response("LoggingSession not found");
return;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return 70;
} | |
ata);
}
DEFINE_SYSCALL(int, sys_accel_manager_peek, AccelData *accel_data) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(accel_data, sizeof(*accel_data));
}
// bump peek analytics
analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_System);
PebbleTask task = pebble_... | (min_rate_mHz <= ONLY_SUPPORTED_JITTERFREE_RATE_MILLIHZ) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
char dstbuf[256];
// Simple %d
snprintf(dstbuf, 256, "There are %d lights, %d", 4, -4);
cl_assert_equal_s(dstbuf, "There are 4 lights, -4");
// Alternate form
snprintf(dstbuf, 256, "There are %#d lights, %#d", 4, -4);
cl_assert_equal_s(dstbuf, "There are 4 lights, -4");
// Zero padded minimum chara... |
// Minimum digits output (negative digits, acts as zero)
snprintf(dstbuf, 256, "%.-3dzero%.-3d", 0, 1);
cl_assert_equal_s(dstbuf, "zero1");
// Minimum digits output (non-zero digits outputting zero)
snprintf(dstbuf, 256, "%.1dzero%.1d", 0, 1);
cl_assert_equal_s(dstbuf, "0zero1");
// Variable length cha... |
#else
#define DBG(fmt, ...)
#endif
#define DEBUG_VERBOSE_ROCKY_APPMESSAGE 1
#if DEBUG_VERBOSE_ROCKY_APPMESSAGE
#define DBG_VERBOSE(fmt, ...) PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__)
#else
#define DBG_VERBOSE(fmt, ...)
#endif
#define ROCKY_EVENT_MESSAGE "message"
#define ROCKY_EVENT_MESSAGE_DATA "data"
#de... | DBG("Transport Disconnected") | |
context, GPoint(50, 50), 10));
#else
ASSERT_CALLED(graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10));
#endif
setup_test(&context, true, 1, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4);
#if PBL_COLOR
ASSERT_CALLED(prv_draw_round_rect_aa(&context, &... | graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD) | );
setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4);
ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD));
}
void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_2(void) {... |
HRMSessionRef hrm_manager_subscribe_with_callback(AppInstallId app_id, uint32_t update_interval_s,
uint16_t expire_s, HRMFeature features,
HRMSubscriberCallback callback, void *context) {
if (!s_hrm_present) {
re... | {
if (app_id) {
*app_id = state->app_id;
}
if (update_interval_s) {
*update_interval_s = state->update_interval_s;
}
if (expire_s) {
int16_t expire_in_s = 0;
if (state->expire_utc != 0) {
expire_in_s = MAX(0, state->expire_utc - rtc_get_time());
}
*expire_... |
mutex_unlock_recursive(s_manager_state.lock);
return (state != NULL);
}
DEFINE_SYSCALL(bool, sys_hrm_manager_set_features, HRMSessionRef session, HRMFeature features) {
bool success = false;
mutex_lock_recursive(s_manager_state.lock);
HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session);
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_vibe_history_mutex) | |
GRect(x_offset, y_offset_progress, load_bar_length, 8) | ;
ProgressLayer *progress_layer = &data->progress_layer;
progress_layer_init(progress_layer, &progress_bounds);
progress_layer_set_corner_radius(progress_layer, 3);
layer_add_child(&window->layer, &progress_layer->layer);
TextLayer *percent_done_text_layer = &data->percent_done_text_layer;
text_layer_init_... | |
yer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) -
offsetof(MenuLayer, scroll_layer.content_sublayer));
const GSize frame_size = menu_layer->scroll_layer.layer.frame.size;
const int16_t content_top_y = -scroll_layer_get_content_offset(&menu_layer->scroll_layer).y;
const int16_t content_bottom... | (menu_layer, true) | |
data->resource_id_25);
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_set_select_action(expandable_dialog,
RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_my_select_click_handler);
app_expandable_dialog_push(expandable_dialog);
}
////////////////////////////////
// Expandable Dialog with header
sta... | (simple_dialog) | ;
dialog_set_text(dialog, "Pop!");
dialog_set_background_color(dialog, GColorRed);
dialog_set_icon(dialog, data->resource_id_80);
dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT);
app_simple_dialog_push(simple_dialog);
}
static void prv_show_transcription_dialog(DialogsData *data) {
TranscriptionDialog ... |
d the driver
// will configure the accelerometer in the highest power mode and with the highest sampling rate
// required according which operating modes are enabled and what the requirements are thereof.
typedef enum {
AccelOperatingModeData,
AccelOperatingModeShakeDetection,
AccelOperatingModeDoubleTapDetectio... | (readings[cfg->axes_offsets[AXIS_Z]]) | ;
}
static uint64_t prv_get_curr_system_time_ms(void) {
time_t time_s;
uint16_t time_ms;
rtc_get_time_ms(&time_s, &time_ms);
return (((uint64_t)time_s) * 1000 + time_ms);
}
static uint32_t prv_sensortime_to_timestamp(uint8_t sensor_time[3]) {
return (sensor_time[0] | (sensor_time[1] << 8) | (sensor_time[2] ... |
_management/app_install_manager.h"
#include "process_management/process_manager.h"
#include "services/normal/activity/activity.h"
#include "services/normal/activity/activity_insights.h"
#include "services/normal/activity/insights_settings.h"
#include "services/normal/settings/settings_file.h"
#include "shell/prefs.h"
#... | watchface_set_default_install_id(entry->install_id) | |
(kino_padding, 0,
kino_width, STATUS_BAR_LAYER_HEIGHT) | );
kino_layer_set_alignment(&data->connectivity_icon, GAlignLeft);
layer_add_child(&window->layer, kino_layer_get_layer(&data->connectivity_icon));
kino_layer_init(&data->battery_icon, &GRect(DISP_COLS - kino_width - kino_padding, 0,
kino_width, STATUS_BAR_LAYER_HEIGH... | |
dma_clock();
setup_dma_read(buffer, buffer_size);
do_dma_transfer();
disable_flash_dma_clock();
}
flash_end_cmd();
disable_flash_spi_clock();
power_tracking_stop(PowerSystemFlashRead);
flash_unlock();
}
void flash_write_bytes(const uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) {
... | flash_unlock() | ;
return;
}
enable_flash_spi_clock();
s_flash_state.sleep_when_idle = enable;
if (enable) {
if (!s_flash_state.deep_sleep) {
flash_deep_sleep_enter();
}
} else {
if (s_flash_state.deep_sleep) {
flash_deep_sleep_exit();
}
}
disable_flash_spi_clock();
flash_unlock();
}
... |
r_start(s_heartbeat_timer, HEARTBEAT_INTERVAL, prv_timer_callback, NULL, 0);
}
static void prv_schedule_retry() {
new_timer_start(s_heartbeat_timer, 5000, prv_timer_callback, NULL, 0);
}
static DataLoggingSessionRef prv_create_dls(AnalyticsBlobKind kind, uint32_t item_length) {
Uuid system_uuid = UUID_SYSTEM;
b... | rtc_get_ticks() | ;
AnalyticsHeartbeat *device_hb = NULL;
AnalyticsHeartbeatList *app_hbs = NULL;
{
analytics_storage_take_lock();
extern void analytics_stopwatches_update(uint64_t current_ticks);
analytics_stopwatches_update(current_ticks);
// Hijack the device_hb and app_hb heartbeats from analytics_storage.
... |
5);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid... | (&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id) | |
nePeekItemConfig) {
.title = "Trash up the Place 🔥",
.icon = TIMELINE_RESOURCE_TIDE_IS_HIGH,
.num_concurrent = 0,
});
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void test_timeline_peek__peek_title_only_concurrent_1(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.titl... | (false, false /* animated */) | ;
// For simplicity, the implementation also moves the layer even though it is not necessary.
cl_assert(layer->frame.origin.y >= DISP_ROWS);
// Peek service shows the peek UI using the animated code path.
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",... |
ne_id();
}
void clock_set_timezone_by_region_id(uint16_t region_id) {
TimezoneInfo tz_info;
prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info);
prv_update_time_info_and_generate_event(NULL, &tz_info);
}
void clock_get_friendly_date(char *buffer, int buf_size, time_t timestamp) {
c... | i18n_noop("%B %e") | ;
}
break;
}
} else {
switch (style) {
case FullStyleLower12h:
case FullStyleCapital12h:
if (with_fulltime) {
time_fmt = i18n_noop("%a, %l:%M %p");
} else {
time_fmt = i18n_noop("%A");
}
break;
case FullStyleLower24h:
... |
184},
{ 1200, 528, 96},
{ 1296, 280, 88},
{ 1768, 80, 240},
{ 1840, -152, 368},
{ 1648, -192, 232},
{ 1448, -112, 176},
{ 1248, -80, 152},
{ 1168, -120, 72},
{ 1136, -216, 80},
{ 1024, -304, -56},
{ 904, -440, -136},
{ 1016, -712, -72},
{ 808, -520, 24},
{ 1112, -... | { 984, 696, -32},
{ 736, 648, -80},
{ 680, 504, 24},
{ 536, 512, -104},
{ 688, 576, -176},
{ 936, 424, -80},
{ 1248, 352, 0},
{ 1856, 216, 88},
{ 1200, 320, 40},
{ 1392, 48, 16},
{ 1464, -56, 72},
{ 1256, -152, 104},
{ 864, -112, 48},
{ 608, -40, -104},
{ 504,... |
{ 488, -448, -8},
{ 1008, -288, 8},
{ 1336, -256, 40},
{ 2088, -120, -88},
{ 2184, -88, 56},
{ 1480, -112, 224},
// 51 seconds
{ 1096, -144, 224},
{ 920, 128, 192},
{ 848, 272, 88},
{ 1080, 136, 120},
{ 1256, 120, 144},
{ 1272, 216, 184},
{ 1384, 504, 120},
{... |
&new_offset);
PBL_ASSERTN(item_layer->animation);
animation_set_auto_destroy(property_animation_get_animation(item_layer->animation), false);
}
Animation *animation = property_animation_get_animation(item_layer->animation);
if (is_first_scroll) {
animation_set_duration(animation, interpolate_moook_dur... | (BUTTON_ID_DOWN, 100, prv_handle_down_click) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} |
stop_mode_disable(InhibitorCommMode);
#if CAPABILITY_HAS_BUILTIN_HRM
ble_hrm_deinit();
#endif
gap_le_deinit();
// Should be the last thing to happen that touches the Bluetooth controller directly
bt_driver_stop();
stop_mode_enable(InhibitorCommMode);
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BT_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (s_call_source == PhoneCallSource_ANCS_Legacy) {
// Schedule/reschedule the watchdog
if (!new_timer_start(s_call_watchdog, poll_interval_ms, prv_timer_callback,
NULL, TIMER_START_FLAG_REPEATING)) {
PBL_LOG(LOG_LEVEL_ERROR, "Could not start the phone call watchdog timer");
... |
}
static void prv_cancel_call_watchdog(void) {
new_timer_stop(s_call_watchdog);
pp_get_phone_state_set_enabled(false);
}
static bool prv_can_answer(void) {
// We can't answer calls with Android
return prv_call_is_ancs();
}
static bool prv_should_show_ongoing_call_ui(void) {
// We only want to show the ong... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (LOG_LEVEL_DEBUG, "Disabling MCO1") | |
const uint16_t endpoint_id) {
MetaResponseInfo meta_response_info;
meta_response_info.payload.error_code = prv_error_for_endpoint(endpoint, session);
if (MetaResponseCodeNoError != meta_response_info.payload.error_code) {
meta_response_info.payload.endpoint_id = endpoint_id;
meta_response_info.sess... | prv_skip_message(rtr, payload_length) | ;
continue; // while (data_size)
}
PBL_LOG_D(LOG_DOMAIN_COMM, LOG_LEVEL_DEBUG,
"Receiving message: endpoint_id 0x%"PRIx16" (%"PRIu16"), payload_length %"PRIu32,
endpoint_id, endpoint_id, payload_length);
if (prv_prepare_receiver(payload_length, endpoint, end... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | while (other) {
if (other->rssi < result->rssi) {
if (!prev) {
// Need to insert as the head, this is handled at the end.
break;
}
// Insert before "other":
prev->next = result;
result->next = other;
return;
}
// Iterate:
prev = other;
other = oth... |
// Broke out of the loop, this can happen at the head or the tail, handle it:
if (s_head == other) {
// Insert as head of the list:
result->next = s_head;
s_head = result;
} else {
// Insert as tail:
prev->next = result;
result->next = NULL;
}
}
static ScanResult *list_get_by_index(ui... |
ist *attributes) {
if (item->header.from_watch) {
// remove it via BlobDB
blob_db_delete(BlobDBIdPins, (uint8_t *)&item->header.id, UUID_SIZE);
// TODO: PBL-23915
// We leak this i18n'd string because not leaking it is really hard.
// We make sure we only ever allocate it once though, so it's not... | attribute_get_string(&action->attr_list, AttributeIdBody,
(char *)i18n_get("Thanks!", &i18n_key)) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_iter_to_valid_mbuf(iter) | ;
}
bool mbuf_iterator_is_finished(MBufIterator *iter) {
if (!prv_iter_to_valid_mbuf(iter)) {
return true;
}
if (iter->data_index >= mbuf_get_length(iter->m)) {
// we're at the end of this MBuf so move to the next one
iter->m = mbuf_get_next(iter->m);
iter->data_index = 0;
// make sure this M... |
_animation_set_from_int16(anim, &from);
property_animation_set_to_int16(anim, &to);
animation_set_duration((Animation *) anim, duration);
animation_set_curve((Animation *) anim, AnimationCurveEaseInOut);
return anim;
}
static const PropertyAnimationImplementation s_animated_dot_impl = {
.base = {
... | if (to.size.w < from.size.w) {
// swap frames so that we unfold from a dot
kino_reel_transform_set_from_frame(reel, to);
kino_reel_transform_set_to_frame(reel, from);
} | |
workout service got
cl_assert_equal_i(calculated_active_kcalories, new_active_kcalories - active_kcalories);
workout_service_stop_workout();
// Pull out the saved session and make sure it matches our numbers
ActivitySession *stored_session = &s_saved_session;
cl_assert_equal_i(stored_session->start_utc, se... | cl_assert(workout_service_stop_workout()) | |
sn't need to be increased as it's not used anymore in this function
}
// last pixel with blending (don't render first *and* last pixel if line length is 1)
if (x2.fraction != 0) {
prv_blend_color_and_update_mask(ctx, y, last_pixel_x, last_pixel_x, color,
(uint8_t)x2.fracti... | if (x1.integer < clip_box_min_x) {
x1.integer++;
continue;
} |
if (x1.integer > clip_box_max_x) {
break;
}
prv_blend_color_and_update_mask(ctx, y, x1.integer, x1.integer, color,
(uint8_t)(FIXED_S16_3_ONE.raw_value * i / left_aa_offset));
x1.integer++;
}
}
// middle pixels
if (x1.integer < x2.integer ... |
------------------------------------------------------
void test_activity_insights__sleep_summary(void) {
// Use reasonable insight settings
prv_set_sleep_history_avg();
// Let's start at 11:30pm
struct tm start_tm = {
// Thursday, Jan 1, 2015, 11:30pm
.tm_hour = 23,
.tm_min = 30,
.tm_mday = 1,... | (rtc_get_time()) | ;
cl_assert_equal_i(s_data.pins_added, 1);
}
// ---------------------------------------------------------------------------------------
// Make sure that if you wake up for a short period of time, we'll move the sleep pin
void test_activity_insights__sleep_summary_merge(void) {
prv_set_sleep_history_avg();
activ... |
description =
firmware_storage_read_firmware_description(flash_new_fw_addr);
if (!firmware_storage_check_valid_firmware_description(&firmware_description)) {
dbgserial_print("Desclen ");
dbgserial_print_hex(firmware_description.description_length);
dbgserial_print("\nFirmlen ");
dbgserial_print... | (BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | sys_get_time() | ;
time_t legacy_time = sys_time_utc_to_local(t);
if (tloc) {
*tloc = legacy_time;
}
return (legacy_time);
}
DEFINE_SYSCALL(time_t, pbl_override_mktime, struct tm *tb) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(tb, sizeof(struct tm));
}
return mktime(tb);
}
uint16_t time_ms(... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | blob_db_init_dbs() | ;
app_cache_init();
phone_call_service_init();
music_init();
alarm_init();
timeline_event_init();
dls_init();
wakeup_init();
app_order_storage_init();
#if CAPABILITY_HAS_HEALTH_TRACKING
activity_init();
#endif
notifications_init();
alerts_init();
send_text_service_init();
protobuf_log_init... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | mfg_get_pcba_serial_number() | , pcba_serial_number_size);
if (pcba_serial_number_size > MFG_PCBA_SERIAL_NUMBER_SIZE) {
// same assumption as in mfg_info_get_pcba_serialnumber
pcba_serial_number[MFG_PCBA_SERIAL_NUMBER_SIZE] = '\0';
}
}
void mfg_info_get_hw_version(char *hw_version, size_t hw_version_size) {
strncpy(hw_version, mfg_get... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (bounds.size.w/2, bounds.size.h/2) | ;
int outer_radius = 50;
int inner_radius = 35;
GPath *mask = gpath_create(&s_triangle_mask);
gpath_move_to(mask, center);
GColor color = { .argb = (uint8_t) rand() };
GColor bg_color = { .argb = (uint8_t) rand() };
graphics_context_set_fill_color(ctx, color);
graphics_fill_circle(ctx, center, outer_r... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0);
dbgserial_print("*** WTF ");
dbgserial_print_hex(saved_lr);
dbgserial_putstr("");
reset_due_to_software_failure();
} |
//! Assert function called by the STM peripheral library's
//! 'assert_param' method. See stm32f2xx_conf.h for more information.
void assert_failed(uint8_t* file, uint32_t line) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
prv_handle_passert_failed((const char*) file, line, saved_lr, "STM32", ... |
static void prv_set_header_status(SerializedTimelineItemHeader *header, uint8_t status, int fd);
void notification_storage_init(void) {
PBL_ASSERTN(s_notif_storage_mutex == NULL);
//Clear notifications storage on reset
pfs_remove(FILENAME);
// Create a new file and close it (removes delay when receiving first... | iter_init(&iter, (IteratorCallback)&prv_iter_next, NULL, &iter_state) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return ((TestReelData*)kino_reel_custom_get_data(reel))->elapsed_ms;
} |
static bool prv_elapsed_setter(KinoReel *reel, uint32_t elapsed_ms) {
((TestReelData*)kino_reel_custom_get_data(reel))->elapsed_ms = elapsed_ms;
return true;
}
static uint32_t prv_duration_getter(KinoReel *reel) {
return ((TestReelData*)kino_reel_custom_get_data(reel))->duration_ms;
}
static struct TestReelDa... |
tificationsItem_Count,
};
// Filter Alerts
//////////////////////////
#define NUM_ALERT_MODES_IN_LIST 3
// These aren't all of the values of AlertMask, so to add extra ones you have to update both of
// these arrays
static const AlertMask s_alert_mode_values[NUM_ALERT_MODES_IN_LIST] = {
AlertMaskAllOn,
AlertMas... | ("Text Size") | ;
const SettingsContentSize index =
settings_content_size_from_preferred_size(system_theme_get_content_size());
settings_option_menu_push(
title, OptionMenuContentType_SingleLine, index, &callbacks, SettingsContentSizeCount,
true /* icons_enabled */, s_text_size_names, data);
}
// Text Size
/////... |
{ 104, 832, -312},
{ 104, 952, -256},
{ 112, 776, -312},
{ 120, 912, -368},
{ 64, 720, -344},
{ 192, 744, -512},
{ 136, 720, -368},
{ 120, 768, -384},
{ 168, 808, -544},
{ 136, 824, -360},
{ 144, 760, -344},
{ 152, 736, -448},
// 13 seconds
{ 128, 848, -320},
{... | { -184, 472, -704},
{ -192, 488, -688},
{ -216, 456, -680},
{ -176, 456, -712},
{ -120, 488, -656},
{ -8, 504, -576},
{ -64, 696, -640},
{ -136, 720, -448},
{ -120, 672, -488},
{ -280, 528, -472},
{ -360, 392, -608},
{ -320, 216, -800},
{ -320, 80, -776},
{ -416, ... |
{ 1032, 1288, -720},
{ 840, 1016, -480},
{ 696, 1104, -696},
{ 480, 864, -736},
{ 408, 1072, -776},
{ 272, 608, -768},
{ 96, 168, -768},
{ 104, 80, -808},
// 21 seconds
{ 80, 24, -776},
{ 32, 64, -712},
{ -104, -48, -640},
{ -96, -40, -640},
{ -48, 8, -720},
... |
m_p1 = far_bottom;
}
if (y > rm_p1.y.integer) {
// We're crossing far_right point, time to swap...
rm_p0 = far_right;
rm_p1 = far_bottom;
}
// Starting and ending point of the line, initialized with extremes
Fixed_S16_3 left_margin = {.raw_value = INT16_MAX};
... | CLIP((MAX(p0.x.raw_value, p1.x.raw_value) + radius.raw_value)
>> FIXED_S16_3_PRECISION, clip_min_x, clip_max_x) | ;
// Blending of first line
if (fraction_for_left != 0) {
int16_t x = x_min;
if (x > tm_p1.x.integer) {
// We're crossing far_top point, time to swap...
tm_p0 = far_top;
tm_p1 = far_right;
}
if (x > bm_p1.x.integer) {
// We're crossing far_bottom point,... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
char *dup = heap_zalloc(heap, strlen(s) + 1, lr);
if (dup) {
strcpy(dup, s);
}
return dup;
} |
// task_* functions that map to other heaps depending on the current task
///////////////////////////////////////////////////////////
#if defined(MALLOC_INSTRUMENTATION)
void *task_malloc_with_pc(size_t bytes, uintptr_t client_pc) {
return heap_malloc(task_heap_get_for_current_task(), bytes, client_pc);
}
#endif
v... |
, GPoint(0, 18), 22);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_even_rows_no_clip")));
// Od... | GPoint(0, 22) | , MAX_NUM_COLS + 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_rows_no_clip")));
// Odd rows of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), ... |
}
}
// -----------------------------------------------------------------------------------------------
void handle_accel(AccelRawData *accel_data, uint32_t num_samples, uint64_t timestamp) {
// Display data
//for (uint32_t i=0; i<num_samples; i++) {
// APP_LOG(APP_LOG_LEVEL_INFO, "Got accel data: %d, %d, %d",... | accel_data_service_unsubscribe() | ;
health_service_events_unsubscribe();
}
|
headings_buf_size);
string_list_add_string(values, values_buf_size, duration_str, values_buf_size);
}
static void prv_add_avg_pace_metric_info(StringList *headings, int headings_buf_size,
StringList *values, int values_buf_size,
Activ... | string_list_add_string(values, values_buf_size, hr_str, values_buf_size) | ;
}
const int zone_2_minutes = ROUND(hr_zone_time_s[HRZone_Zone2], SECONDS_PER_MINUTE);
if (zone_2_minutes) {
snprintf(hr_str, hr_buf_size, i18n_get("%d Min", headings), zone_2_minutes);
string_list_add_string(headings, headings_buf_size,
i18n_get("Endurance", headin... |
n(animation, interpolate_moook_duration());
}
animation_set_auto_destroy(animation, false);
}
animation_schedule(animation);
} else {
prv_scroll_layer_set_content_offset_internal(scroll_layer, offset);
}
}
void scroll_layer_set_content_size(ScrollLayer *scroll_layer, GSize size) {
GRect b... | {
return layer_get_hidden(&scroll_layer->shadow_sublayer);
} |
void scroll_layer_set_paging(ScrollLayer *scroll_layer, bool paging_enabled) {
PBL_ASSERTN(scroll_layer);
if (paging_enabled) {
// Deinit shadow_sublayer to enable paging
if (!prv_scroll_layer_is_paging_enabled(scroll_layer)) {
layer_deinit(&scroll_layer->shadow_sublayer);
}
// paging and s... |
PropertyAnimation *result = property_animation_create(&s_dirty_layer_implementation,
layer, NULL, NULL);
return result;
}
// -----------------------------------------------------------------------------------------
void property_animation_destroy(PropertyAnima... | {
memcpy(&property_animation->values.to, value, size);
} | else {
memcpy(value, &property_animation->values.to, size);
}
return true;
}
|
(SettingsFile *file) {
AlarmId id_out = ALARM_INVALID_ID;
for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) {
AlarmStorageKey key = { .id = i, .type = ALARM_DATA_CONFIG };
if (settings_file_get_len(file, &key, sizeof(key)) == 0) {
id_out = i;
break;
}
}
return id_out;
}
// -------------... | {
SetAlarmTimeContext *ctx = context;
if (config->kind == ALARM_KIND_JUST_ONCE) {
// We have to re-calculate the correct day
prv_set_day_for_just_once_alarm(config, ctx->hour, ctx->minute);
}
config->hour = ctx->hour;
config->minute = ctx->minute;
return true;
} |
void alarm_set_time(AlarmId id, int hour, int minute) {
prv_assert_alarm_params(hour, minute);
prv_alarm_operation(id, prv_set_alarm_time_op, &(SetAlarmTimeContext) { hour, minute });
}
// ----------------------------------------------------------------------------------------------
static bool prv_set_alarm_sma... |
h_into_deep_pin ?
timeline_layer_create_speed_lines_animation(&data->timeline_layer) : NULL;
return animation_spawn_create(peek_out, sidebar_slide, speed_lines, NULL);
}
static void prv_play_peek_in(TimelineAppData *data) {
// Skip the first frame since the icon is offscreen
const int num_frames_skip = 1;... | {
data->intro_timer_id = evented_timer_register(PEEK_SHOW_TIME_MS,
false,
prv_intro_timer_callback,
data);
} |
}
static void prv_setup_peek_animation(TimelineAppData *data, TimelineResourceInfo *timeline_res,
bool use_pin) {
PeekLayer *peek_layer = &data->peek_layer;
#if ANIMATION_DOT
peek_layer_set_icon(peek_layer, timeline_res);
#elif ANIMATION_SLIDE
GRect icon_from;
GRect icon_t... |
ent_stack,
true);
cl_assert_equal_p(aa, actual);
cl_assert_equal_i(1, current_stack);
cl_assert_equal_p(a, stack[0]);
cl_assert_equal_p(aa, stack[1]);
// go to child if possible
actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), ¤t_stack, true);
cl_assert_equal_p(a... | layer_add_child(&parent, &child_a) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_p(r->fail_after, NULL) | ;
cl_assert_passert(recognizer_create_with_data(NULL, &s_test_impl_data,
sizeof(s_test_impl_data), dummy,
NULL));
cl_assert_passert(recognizer_create_with_data(&s_test_impl, NULL,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.