prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
se.
*/
#include "applib/graphics/framebuffer.h"
#include "applib/graphics/graphics.h"
#include "applib/ui/time_range_selection_window.h"
#include "applib/ui/time_selection_window.h"
#include "applib/ui/app_window_stack.h"
#include "apps/system_apps/settings/settings_notifications_private.h"
#include "resource/resourc... | gbitmap_create_blank(bitmap_size, CANVAS_GBITMAP_FORMAT) | ;
ctx->dest_bitmap = *s_dest_bitmap;
ctx->draw_state.clip_box.size = bitmap_size;
ctx->draw_state.drawing_box.size = bitmap_size;
// Fill the bitmap with pink (on color) or white (on b&w) so it's easier to see errors
memset(s_dest_bitmap->addr, PBL_IF_COLOR_ELSE(GColorShockingPinkARGB8, GColorWhiteARGB8),
... |
ining - start_offset);
const size_t length_to_copy = MIN(length_after_offset, length);
memcpy(data_out, prv_get_read_pointer(sb) + start_offset, length_to_copy);
return length_to_copy;
}
size_t prv_send_job_impl_get_read_pointer(const SessionSendQueueJob *send_job,
const... | memset(data_out, 0, sizeof(data_out)) | ;
int offset = sizeof(TEST_DATA) + 1;
cl_assert_equal_i(sizeof(data_out),
comm_session_send_queue_copy(s_valid_session, offset,
sizeof(data_out), data_out));
cl_assert_equal_m(data_out, TEST_DATA + (offset % sizeof(TEST_DATA)), sizeof(data_out))... |
essions[i].active_calories,
sessions[i].distance_mm);
}
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16", steps: %"PRIu16", "
"rest_cal: %"PRIu32", active_cal: %"PRIu32", dist: %"PRIu32" ",
(int)exp_session->activity, (int)exp_session->start_utc,
exp_session->len_... | {
file = fopen(filename, "a");
cl_assert(file);
} | |
ct(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_... | (&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi") | |
context_set_stroke_color.call_count);
}
void test_rocky_api_graphics__canvas_state(void) {
prv_global_init_and_set_ctx();
// calling restore if nothing was stored is a no-op
s_context.draw_state.fill_color.argb = 1;
EXECUTE_SCRIPT("ctx.restore()\n");
cl_assert_equal_i(1, s_context.draw_state.fill_color.argb... | (GTextAlignmentLeft, s_rocky_text_state.alignment) | ;
s_rocky_text_state.alignment = (GTextAlignment)-1;
// unsupported values don't change the value
EXECUTE_SCRIPT("ctx.textAlign = 123;\n");
cl_assert_equal_i(-1, s_rocky_text_state.alignment);
EXECUTE_SCRIPT("ctx.textAlign = 'unknown';\n");
cl_assert_equal_i(-1, s_rocky_text_state.alignment);
EXECUTE_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... | prompt_send_response("down") | ;
} else {
prompt_send_response("up");
}
}
|
/*
* 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(AHB2PERIPH_BASE < AHB3_BASE, "Clock mapping assumptions don't hold") | ;
// Note: this works only with peripheral (<...>Typedef_t *) defines, not with RCC defines
static ClockCmd prv_get_clock_cmd(uintptr_t periph_addr) {
PBL_ASSERTN(periph_addr >= APB1PERIPH_BASE);
if (periph_addr < APB2PERIPH_BASE) {
return RCC_APB1PeriphClockCmd;
} else if (periph_addr < AHB1PERIPH_BASE) {
... |
, -104},
{ 1280, 160, -80},
{ 1168, 120, -152},
{ 952, 128, -264},
{ 864, -192, 80},
{ 576, 8, -248},
{ 760, 88, -520},
{ 1144, 96, -272},
{ 1152, 192, -304},
{ 984, 136, -328},
{ 1008, 312, -248},
{ 1232, 376, -192},
{ 1432, 600, -264},
{ 1288, 792, -176},
{ 1016... | { 1480, 832, -240},
{ 1144, 656, -240},
{ 1080, 720, -264},
{ 1032, 840, -152},
{ 1224, 984, -120},
{ 968, 776, -160},
{ 888, 808, -296},
{ 1144, 696, -264},
// 34 seconds
{ 1288, 504, -152},
{ 1184, 448, -72},
{ 1280, 208, -88},
{ 1312, 296, -120},
{ 1256, 184, -... |
{ 784, -400, 0},
{ 1096, -24, 136},
{ 544, -64, -528},
{ 712, -88, -344},
{ 1128, 184, -280},
{ 1048, 80, -320},
{ 992, 232, -440},
{ 1232, 352, -432},
{ 1520, 400, -376},
{ 1496, 640, -344},
{ 1208, 552, -304},
{ 1120, 640, -408},
{ 1080, 872, -328},
{ 1264, 106... |
ssert(animation_get_implementation(h) == &implementation2.base);
// Custom Curve
cl_assert(animation_get_custom_curve(h) != prv_custom_curve);
animation_set_custom_curve(h, prv_custom_curve);
cl_assert(animation_get_custom_curve(h) == prv_custom_curve);
// Reverse
cl_assert(animation_get_reverse(h) == f... | cl_assert(seq == NULL) | ;
seq = animation_sequence_create(a, b, NULL);
animation_set_delay(seq, delay_seq); // This delay not applicable since a was already scheduled
animation_set_handlers(seq, handlers, seq);
animation_schedule(seq);
// The duration of seq should include all of a and b
uint32_t duration = animation_get_duratio... |
// does this info match the key stored in shared resources
SMPairingInfo sprf_info = {};
bool requires_address_pinning;
uint8_t flags;
shared_prf_storage_get_ble_pairing_data(&sprf_info, NULL, &requires_address_pinning,
&flags);
matches_prf = (memcmp(&s... | BT_DEVICE_ADDRESS_XPLODE_PTR(address));
}
} else if (info->key_len == sizeof(BTBondingID)) {
PBL_ASSERTN(sizeof(BtPersistBondingData) == info->val_len);
BTBondingID id;
memcpy(&id, key, sizeof(BTBondingID));
prv_dump_bonding_db_data(display_buf, id, (BtPersistBonding... |
prompt_send_response("");
kernel_free(display_buf);
return true;
}
void bluetooth_persistent_storage_dump_contents(void) {
prv_file_each(prv_dump_bt_persistent_storage_contents, NULL);
}
|
r), 0);
cl_assert_equal_i(circular_buffer_get_read_space_remaining(&buffer), 8);
contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out);
cl_assert_equal_i(contiguous_num_bytes_left, 0);
cl_assert_equal_p(data_out, NULL);
const uint16_t copy_out_size = 8;
uint8_t copy_out[copy_out_si... | (&buffer, sizeof(letterB)) | ;
cl_assert(circular_buffer_read(
&buffer, sizeof(letterB), (const uint8_t **)&data_buf, &num_bytes));
cl_assert_equal_i(num_bytes, sizeof(letterB));
cl_assert_equal_m(data_buf, &letterB, sizeof(letterB));
}
|
ker crash dialog
actionable_dialog_pop(data->actionable_dialog);
}
static void prv_worker_crash_button_down_handler(ClickRecognizerRef recognizer, void *context) {
WorkerCrashDialogData *data = context;
// Have the worker manager launch the next worker
worker_manager_launch_next_worker(data->app_install_id);
... | dialog_set_callbacks(dialog, &callbacks, data) | ;
// Push the worker crash actionable dialog
actionable_dialog_push(data->actionable_dialog, prv_get_window_stack());
light_enable_interaction();
}
void crashed_ui_show_worker_crash(const AppInstallId install_id) {
launcher_task_add_callback(prv_push_worker_crash_dialog, (void *) install_id);
}
// ---------... |
TS);
s_kernel_event_queue = xQueueCreate(MAX_KERNEL_EVENTS, sizeof(PebbleEvent));
PBL_ASSERTN(s_kernel_event_queue != NULL);
s_from_app_event_queue = xQueueCreate(MAX_FROM_APP_EVENTS , sizeof(PebbleEvent));
PBL_ASSERTN(s_from_app_event_queue != NULL);
s_from_worker_event_queue = xQueueCreate(MAX_FROM_WORKE... | (s_from_kernel_event_queue, "from_kernel", saved_lr, event) | ;
} else {
return prv_event_put(s_kernel_event_queue, "kernel", saved_lr, event);
}
}
bool event_put_isr(PebbleEvent* event) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
return prv_event_put_isr(s_kernel_event_queue, "kernel", saved_lr, event);
}
void event_put_from_process(PebbleTask ... |
t the state variables for the given task
static AccelSubscriberState* prv_subscriber_state(AccelSessionRef session) {
if (session == NULL) {
return NULL;
}
// Look for this session in our list of subscribers
ListNode* node = list_find(s_data_subscribers, prv_session_ref_list_filter, (void*)session);
retu... | prv_update_driver_config() | ;
}
mutex_unlock_recursive(s_mutex);
}
// ----------------------------------------------------------------------------------------------
// Reset the FIFO mode restoration timer for another N seconds
static void prv_set_restore_fifo_mode_timer(void) {
s_temp_peek_mode = true;
bool success = new_timer_start(s_... |
or resuming erases should have run
// but is blocked. See PBL-25741 for details
uint32_t erase_suspend_time_remaining;
if (new_timer_scheduled(s_erase_suspend_timer, &erase_suspend_time_remaining) &&
(erase_suspend_time_remaining == 0)) {
prv_erase_suspend_timer_cb(NULL);
}
// An era... | (mode == FLASH_MODE_SYNC_BURST) | |
eps += delta_steps;
// Calculate the distance delta
const time_t delta_ms = (now_ts - wrkt_data->last_movement_event_time_ts) * MS_PER_SECOND;
const int32_t delta_distance_mm = activity_private_compute_distance_mm(delta_steps, delta_ms);
wrkt_data->distance_m += (delta_distance_mm / MM_PER_METER);
... | workout_service_is_workout_ongoing() | ) {
return;
}
if (event->type == PebbleActivityEvent_TrackingStopped) {
workout_service_pause_workout(true);
}
}
// ---------------------------------------------------------------------------------------
void workout_service_workout_event_handler(PebbleWorkoutEvent *event) {
if (!workout_service_is_wo... |
hangedCallbackNode *)s_head_callback_node_list;
while (callback_node) {
if (!strcmp(callback_node->name, file_name) && (callback_node->event_flags & event)) {
callback_node->callback(callback_node->data);
}
callback_node = (PFSFileChangedCallbackNode *)list_get_next(&callback_node->list_node);
}
}... | for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) {
PageHeader pg_hdr;
pg_hdr.page_flags = prv_get_page_flags(pg);
if (!IS_PAGE_TYPE(pg_hdr.page_flags, PAGE_FLAG_START_PAGE)) {
continue; // only start pages contain file name info
}
FileHeader file_hdr;
prv_flash_read((uint8_t *)&file_hd... |
mutex_unlock_recursive(s_pfs_mutex);
return (PFSFileListEntry *)head;
}
void pfs_delete_file_list(PFSFileListEntry *head) {
ListNode *node = (ListNode *)head;
ListNode *next;
while (node) {
next = node->next;
kernel_free(node);
node = next;
}
}
// PBL-19098 Refactor this to share code with pf... |
}
static void prv_invalidate_current_page(void) {
PBL_LOG(LOG_LEVEL_DEBUG, "Invalidating current page: #%"PRIu32, s_valid_page_idx);
// First, check if the page is Unpopulated
SprfMagic magic = prv_get_magic_for_page(s_valid_page_idx);
if (magic == SprfMagic_UnpopulatedEntry) {
// This page is already Unp... | memset(field_ptr, 0xFF, field_size) | ;
prv_persist_field(field_ptr, offset, field_size, false);
prv_dealloc_struct(data);
}
static bool prv_fetch_field(uint8_t *field_out, size_t offset, size_t field_size) {
flash_read_bytes(field_out, prv_current_page_flash_addr() + offset, field_size);
if (!prv_field_valid(field_out, field_size)) {
// If co... |
TrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_neg_w", fb, GColorWhite));
setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H,
... | (&ctx, &GRect(0, 0, 144, 168)) | ;
graphics_context_set_compositing_mode(&ctx, GCompOpSet);
graphics_context_set_text_color(&ctx, GColorBlue);
graphics_draw_text(&ctx, "blue100", &s_font_info, GRect(10, 10, 100, 30),
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
ctx.draw_state.text_color.a = 2;
graphics_d... |
IPT(
"var d = new Date();\n"
"var s = d.toLocaleTimeString();\n"
);
ASSERT_JS_GLOBAL_EQUALS_S("s", "00:04:05");
}
void test_rocky_api_datetime__locale(void) {
rocky_global_init(s_api);
EXECUTE_SCRIPT(
"var d = new Date();\n"
"d.toLocaleTimeString(undefined);\n"
);
EXECUTE_SCRIPT_EXPECT_ER... | EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});") | ;
ASSERT_JS_GLOBAL_EQUALS_S("s", "25");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday");
EXECUTE_SCRIPT("s = d.toLocaleDateString(und... |
(activity_get_sessions(&num_sessions, sessions)) {
for (unsigned int i = 0; i < num_sessions; i++) {
if (sessions[i].ongoing) {
// Don't process incomplete events
continue;
}
switch (sessions[i].type) {
case ActivitySessionType_Nap:
// PBL-36355 Disable nap notif... | if (uuid_equal(id, &s_sleep_pin_state.uuid)) {
s_sleep_pin_state.removed = true;
} |
}
}
// ------------------------------------------------------------------------------------------------
void activity_insights_init(time_t now_utc) {
// Init insight settings file support
activity_insights_settings_init();
// Cache the settings so we don't hit flash every minute
prv_reload_settings(NULL);
... |
/*
* 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... | (should_store == false) | ;
cl_assert(is_invalid == false);
data = HDLC_FLAG;
is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid);
cl_assert(is_complete == true);
cl_assert(should_store == false);
cl_assert(is_invalid == true);
}
void test_hdlc__decode_escaped_special(void) {
// 2 escaped special characte... |
/*
* 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... | {
uart_init(BT_RX_BOOTROM_UART);
uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
} |
periph_config_release_lock();
}
static void prv_deinit_dialog_bootrom_interface(void) {
periph_config_acquire_lock();
if (prv_platform_uses_two_uart_peripherals()) {
uart_deinit(BT_RX_BOOTROM_UART);
uart_deinit(BT_TX_BOOTROM_UART);
} else {
uart_deinit(BT_RX_BOOTROM_UART);
}
periph_config_rel... |
/*
* 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... | (analytics_storage_has_lock()) | ;
AnalyticsHeartbeatList *apps = s_app_heartbeat_list;
s_app_heartbeat_list = NULL;
return apps;
}
///////////
// Search
static bool prv_is_app_node_with_uuid(ListNode *found_node, void *data) {
const Uuid *searching_for_uuid = (const Uuid*)data;
AnalyticsHeartbeatList *app_node = (AnalyticsHeartbeatList*)f... |
/*
* 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... | (img_palettized) | ;
gbitmap_destroy(img_1bit);
}
|
ate_play_animation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
animation_schedule(animation);
animation_set_elapsed(animation, 20);
animation_set_duration(animation, ANIMATION_DURATION_INFINITE);
prv_play_animation_update(animation, 0); // intentionally bad value
cl_assert_... | (animation, 300) | ;
animation_set_elapsed(animation, 20);
prv_play_animation_update(animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE);
}
void test_kino_player__infinite_animation_infinite_reel_reverse(void) {
// Choose duration and elapsed to have clean ... |
2, -320},
{ 1352, 304, -240},
{ 1832, 496, -352},
{ 1792, 832, -384},
{ 1352, 816, -496},
{ 1040, 1040, -624},
{ 952, 1080, -384},
{ 1152, 992, -240},
{ 1072, 760, -312},
{ 1112, 792, -216},
{ 1336, 832, -96},
{ 1376, 480, -80},
{ 1312, 304, -104},
{ 1328, 248, -128},... | { 1064, 288, -88},
// 26 seconds
{ 1040, 288, -8},
{ 1040, 264, -40},
{ 1080, 224, -64},
{ 1152, 232, -72},
{ 944, 240, -184},
{ 720, -24, -208},
{ 680, 16, -232},
{ 832, 176, -376},
{ 1056, 232, -384},
{ 1272, 352, -304},
{ 1176, 400, -272},
{ 1056, 440, -184},
... |
{ 848, 1048, 104},
{ 1152, 1016, 208},
{ 1008, 776, 136},
{ 1040, 728, 96},
{ 1184, 680, 88},
{ 1232, 480, 32},
{ 1120, 320, -64},
{ 1152, 192, -104},
{ 1176, 344, -40},
// 29 seconds
{ 1368, 304, 24},
{ 1304, 232, 8},
{ 1200, 184, -48},
{ 1032, -64, -160},
{... |
beginning of the nearest 32-bit block:
const uint8_t dest_shift_at_line_begin = (dest_rect.origin.x % 32);
const uint32_t * const src_block_x_begin =
((uint32_t*)src_bitmap->addr) +
((src_bitmap->bounds.origin.x + (src_origin_offset.x % src_bitmap->bounds.size.w)) / 32);
const int src_row_length_word... | (&dest_rect, &dest_bitmap->bounds) | ;
GBitmap src_clipped_bitmap = *src_bitmap;
src_clipped_bitmap.bounds.origin = (GPoint) {
src_bitmap->bounds.origin.x + (dest_rect.origin.x - dest_offset.x),
src_bitmap->bounds.origin.y + (dest_rect.origin.y - dest_offset.y)
};
bitblt_bitmap_into_bitmap_tiled(dest_bitmap, &src_clipped_bitmap, dest_rec... |
gument at index 0 is not a JSON.stringify()-able object";
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(undefined);", not_jsonable_error);
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(function() {});", not_jsonable_error);
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage({toJSON: function() {throw 'toJSONErr... | (app_timer_trigger(t), true) | ;
}
ASSERT_JS_GLOBAL_EQUALS_B("didError", true);
ASSERT_JS_GLOBAL_EQUALS_S("dataJSON", "{\"x\":1}");
}
void test_rocky_api_app_message__postmessageerror_while_disconnected(void) {
prv_init_api(false /* start_connected */);
EXECUTE_SCRIPT("var didError = false;"
"var x = " SIMPLE_TEST_OBJEC... |
update_mask(ctx, y, last_pixel_x, last_pixel_x, color,
(uint8_t)x2.fraction);
}
}
T_STATIC void prv_mask_recording_assign_vertical_line(GContext *ctx, int16_t x,
Fixed_S16_3 y1, Fixed_S16_3 y2,
... | (ctx, y, x1.integer, x1.integer, color,
(uint8_t)(FIXED_S16_3_ONE.raw_value * i / left_aa_offset)) | |
ata, part_length);
length_remaining -= part_length;
}
return length_to_copy;
}
static size_t prv_send_job_impl_get_read_pointer(const SessionSendQueueJob *send_job,
const uint8_t **data_out) {
AppMessageSendJob *app_message_send_job = (AppMessageSendJob *)sen... | if (!app_message_send_job->session) {
// Most likely disconnected in the mean time, don't spam our logs about this
app_outbox_service_consume_message(message, (AppOutboxStatus)AppMessageSenderErrorDisconnected);
return;
} |
prv_request_fast_connection(app_message_send_job->session);
comm_session_send_queue_add_job(app_message_send_job->session,
(SessionSendQueueJob **)&app_message_send_job);
}
// -------------------------------------------------------------------------------------------------
void... |
clude "stubs_dialog.h"
#include "stubs_do_not_disturb.h"
#include "stubs_event_loop.h"
#include "stubs_event_service_client.h"
#include "stubs_evented_timer.h"
#include "stubs_generic_layout.h"
#include "stubs_health_layout.h"
#include "stubs_heap.h"
#include "stubs_i18n.h"
#include "stubs_ios_notif_pref_db.h"
#include... | if (s_test_data.app_name) {
attribute_list_add_cstring(attr_list, AttributeIdAppName, s_test_data.app_name);
} | |
_touch_event(r, &(TouchEvent) { .type = TouchEvent_Liftoff });
cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff);
cl_assert_equal_b(updated, true);
cl_assert_equal_i(rec_event, RecognizerEvent_Completed);
r->state = RecognizerState_Possible;
updated = false;
new_state = RecognizerState_Started;
... | (NULL, NULL) | );
cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL));
cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2));
cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2));
recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb);
cl_assert(!recognizer_should_evaluate_simultaneou... |
nagement/app_manager.h"
#include "process_management/worker_manager.h"
#include "prompt.h"
#include "resource/resource_storage_flash.h"
#include "services/common/compositor/compositor.h"
#include "services/common/system_task.h"
#include "services/normal/filesystem/pfs.h"
#include "syscall/syscall.h"
#include "system/bo... | ("Invalid length") | ;
return;
}
// Allocate a 1KB buffer to read data in segments
uint8_t *buffer = (uint8_t *) kernel_malloc(MIN(MAX_READ_FLASH_SIZE,length));
if (buffer == 0) {
prompt_send_response("Unable to allocate read buffer");
return;
}
while (length > 0) {
uint32_t read_length = MAX_READ_FLASH_SIZE;
... |
t.load_start = worker_segment.start;
g_worker_load_address = worker_segment.start;
void *entry_point = process_loader_load(app_md, PebbleTask_Worker,
&worker_segment);
s_worker_task_context.load_end = worker_segment.start;
if (!entry_point) {
PBL_LOG(LOG_LEVEL_WARNI... | PBL_ASSERT_TASK(PebbleTask_KernelMain) | ;
// If no worker running, nothing to do
if (!s_worker_task_context.app_md) {
return;
}
// Make sure the process is safe to kill. If this method returns false, it will have set a timer
// to post another KILL event in a few seconds, thus giving the process a chance to clean up.
if (!process_manager_ma... |
= TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1; i > 0; i--) {
layer->layouts[i] = layer->layouts[i - 1];
layer->layouts_info[i] = layer->layouts_info[i - 1];
}
layer->layouts[0] = NULL;
layer->layouts_info[0] = NULL;
}
layer->move_delta = delta * prv_get_scroll_delta(layer);
// hide other da... | animation_set_duration(animation, TIMELINE_LAYER_SLIDE_MS) | ;
animation_set_handlers(animation, (AnimationHandlers) {
.stopped = timeline_animation_layer_stopped_cut_to_end,
}, animation);
return animation;
}
Animation *timeline_layer_create_bounce_back_animation(TimelineLayer *layer, GPoint direction) {
Animation *animations[TIMELINE_NUM_VISIBLE_ITEMS + 2] = {};
... |
// "the mobile app is connected: %d", s_call_in_progress, s_mobile_app_is_connected);
}
}
static void prv_handle_missed_call(PebblePhoneEvent *event) {
if (s_call_in_progress) {
prv_call_end_common();
phone_ui_handle_missed_call();
analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_INCOMING_COUNT... | if (!s_mobile_app_is_connected && (s_call_source != PhoneCallSource_ANCS)) {
prv_handle_call_end(true /* disconnected */);
} | |
ent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID);
}
bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBondingID bonding,
BTDeviceAddress *address_out,
SM128BitKey *link_key_out,
... | (BLE_BONDING_ID) | ;
if (bt_driver_supports_bt_classic()) {
bt_persistent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID);
}
}
|
p_stop_condition_cb(GContext* ctx, Line* line,
const TextBoxParams* const text_box_params) {
int next_line_max_y = line->origin.y;
int clip_box_min_y = ctx->draw_state.clip_box.origin.y;
return (next_line_max_y < clip_box_min_y);
}
//! @return is_overflow
bool is_c... | gpoint_sub(flow_data->paging.origin_on_screen, line->origin) | |
rawState));
return state;
}
void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) {
return;
}
bool compositor_is_animating(void) {
return false;
}
void *compositor_modal_transition_to_modal_get(bool dest) {
return NULL;
}
void compositor_modal_render_ready(void) {
}
void compositor_... | cl_check(window->parent_window_stack) | ;
cl_assert_equal_i(window->on_screen, true);
cl_assert_equal_i(window->is_loaded, false);
window_stack_pop(window->parent_window_stack, true);
}
static void prv_push_window_unload(Window *window) {
WindowStack *stack = window->parent_window_stack;
prv_window_unload(window);
Window *new_window = window_... |
/*
* 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... | (-6, -310) | ;
check_atan2(15000, -19);
check_atan2(34, -3200);
check_atan2(-1508, 299);
check_atan2(1020, 1002);
}
void test_math__ceil_log_two(void) {
check_ceil_log_two(4);
check_ceil_log_two(5);
check_ceil_log_two(100);
check_ceil_log_two(256);
check_ceil_log_two(123456);
}
void test_math__sign_extend(void) ... |
ss_state/app_state/app_state.h"
#include "syscall/syscall.h"
#include "system/passert.h"
#include <ecma/base/ecma-gc.h>
#include <jmem/jmem-allocator.h>
#include <jmem/jmem-heap.h>
#include <jmem/jmem-poolman.h>
#include <util/math.h>
#include <stdbool.h>
#include <string.h>
#define ROCKY_EVENT_MEMORYPRESSURE "memo... | (level, stats) | |
ta],
BLESubscriptionNotifications,
GAPLEClientKernel);
// Simulate getting the subscription failure:
ppogatt_handle_subscribe(s_characteristics[0][PPoGATTCharacteristicData],
BLESubscriptio... | prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]) | ;
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
fake_gatt_client_op_assert_no_write();
}
void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_own_reset_request(void) {
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PP... |
.is_gateway = true,
};
bt_driver_handle_host_added_bonding(&bonding);
return fake_bt_persistent_storage_add(irk, &identity_device, "Dummy", true /* is_gateway */);
}
static void prv_assert_no_event(void) {
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_NULL_EVENT);
}
static ... | (registered, true) | ;
}
}
}
void test_gap_le_connect__register_null_device(void) {
BTErrno e = gap_le_connect_connect(NULL,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp);
cl_assert_equal_i... |
inoReel *kino_reel = kino_reel_unfold_create(image, false, layer_frame, 0,
UNFOLD_DEFAULT_NUM_DELAY_GROUPS,
UNFOLD_DEFAULT_GROUP_DELAY);
kino_reel_transform_set_from_frame(kino_reel, icon_from);
kino_reel_transform_set_t... | (
kernel_ui_get_graphics_context(),
s_phone_ui_data->caller_id_text_buf,
font,
GRect(0, 0, test_width, SINGLE_LINE_BOUND_HEIGHT),
s_phone_ui_data->caller_id_text_layer.overflow_mode,
GTextAlignmentLeft, NULL) | ;
return (text_size.w > s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w) ||
line_contains_newline;
}
//! Text setters
static void prv_set_caller_id_text(PebblePhoneCaller *caller) {
if (!caller->name && !caller->number) {
return;
}
const char *caller_text = caller->name ?: caller->numb... |
ere will return X, Y, Z data
#define WHO_AM_I_REG 0x07
#define SYSMOD_REG 0x08
#define CTRL_REG1 0x10
#define CTRL_REG2 0x11
static bool mag3110_read(uint8_t reg_addr, uint8_t data_len, uint8_t *data) {
return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data);
}
static bool mag3... | if (s_use_refcount == 0) {
mutex_unlock(s_mag_mutex);
return (MagReadMagOff);
} |
MagReadStatus rv = MagReadSuccess;
uint8_t raw_data[7];
// DR_STATUS_REG is immediately before data registers
if (!mag3110_read(DR_STATUS_REG, sizeof(raw_data), raw_data)) {
rv = MagReadCommunicationFail;
goto done;
}
// TODO: shouldn't happen at low sample rate, but handle case where some data
... |
er_get_content_size(ctx, &peek_layer->subtitle.text_layer);
GPoint cursor = { (layer_bounds.size.w - subtitle_size.w) / 2,
-(subtitle_size.h + MAX(number_size.h, title_size.h)) / 2 };
const int font_height_fuzz = 5; // Replace with font descenders
layer_set_frame((Layer *)&peek_layer->subtitl... | (&peek_layer->subtitle.text_layer) | ;
layer_deinit(&peek_layer->layer);
}
void peek_layer_set_frame(PeekLayer *peek_layer, const GRect *frame) {
layer_set_frame(&peek_layer->layer, frame);
layer_set_frame((Layer *)&peek_layer->kino_layer,
&(GRect) { { 0, peek_layer->icon_offset_y }, frame->size });
}
void peek_layer_set_backgrou... |
wo */
/* entries. */
/* * NOTE * If there is not enough room to make another */
/* entry then we will not adjust the size of */
/* this entry to match the amount requested. */
if (heap_info_ptr->Size < (n_units + HEAP_INFO_BLOCK_SIZE... | snprintf(buffer, sizeof(buffer), "Heap largest free block: %lu", largest_free) | ;
util_dbgserial_str(buffer);
heap_unlock(heap);
}
#endif
|
izerState_Cancelled);
cl_assert_equal_i(event_type, RecognizerEvent_Cancelled);
cl_assert_equal_i(r->state, RecognizerState_Cancelled);
cl_assert(!s_manager_state_change);
r->state = RecognizerState_Started;
recognizer_transition_state(r, RecognizerState_Completed);
cl_assert_equal_i(event_type, Recognizer... | cl_assert_equal_i(r->state, RecognizerState_Cancelled) | ;
cl_assert_equal_b(cancelled, false);
cl_assert_equal_i(rec_event, -1);
r->state = RecognizerState_Completed;
recognizer_cancel(r);
cl_assert_equal_i(r->state, RecognizerState_Completed);
cl_assert_equal_b(cancelled, false);
cl_assert_equal_i(rec_event, -1);
r->state = RecognizerState_Started;
reco... |
to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "misc.h"
#include "system/loggi... | (next_value, max_value) | ;
}
// Based on DJB2 Hash
uint32_t hash(const uint8_t *bytes, const uint32_t length) {
uint32_t hash = 5381;
if (length == 0) {
return hash;
}
uint8_t c;
const uint8_t *last_byte = bytes + length;
while (bytes++ != last_byte) {
c = *bytes;
hash = ((hash << 5) + hash) + c;
}
return hash;
}... |
start(s_abusive_timer, 100, prv_waste_time_cb,
(void *)data_pack, 0)) {
prompt_send_response("OK");
} else {
prompt_send_response("ERROR");
}
}
#ifndef RELEASE
#include "system/profiler.h"
void command_audit_delay_us(void) {
profiler_init();
// don't let context switches skew ou... | bt_driver_gatt_stop_discovery(conn) | ;
}
}
bt_unlock();
}
#if BT_CONTROLLER_DA14681
static TimerID s_sleep_test_timer = TIMER_INVALID_ID;
static uint32_t s_num_sleep_iters = 0;
static void prv_sleep_timer_test_cb(void *data) {
uint32_t count = (uint32_t)data;
for (int j = 0; j < 10; j++) {
bt_driver_send_sleep_test_cmd(true);
psleep(... |
/*
* 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... | rtc_get_time() | ;
// copy out app ID to a char buffer
char app_id_buffer[app_id->length + 1];
pstring_pstring16_to_string(&app_id->pstr, app_id_buffer);
PBL_LOG(LOG_LEVEL_WARNING, "No valid date. Offending iOS app: %s", app_id_buffer);
}
return timestamp;
}
static bool prv_should_ignore_because_calendar_reminder... |
);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible);
// A touchdown occurs and a child of the previous active recognizer becomes the active layer. The
// c... | r1->state = RecognizerState_Possible;
r2->state = RecognizerState_Started;
manager.active_layer = &layer_a;
manager.triggered = r2;
manager.state = RecognizerManagerState_RecognizersTriggered;
recognizer_manager_deregister_recognizer(&manager, r1);
cl_assert_equal_p(manager.triggered, r2);
cl_assert_equ... |
void test_recognizer_manager__handle_state_change(void) {
const int k_rec_count = 2;
s_dummy_impl.handle_touch_event = prv_handle_touch_event_test;
s_dummy_impl.reset = prv_reset_test;
Recognizer **r = prv_create_recognizers(k_rec_count);
Window window = {};
layer_init(&window.layer, &GRectZero);
Layer... |
/*
* 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 (!button_is_pressed(button_id)) {
button_counter[button_id] = 0;
continue;
}
if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) {
dbgserial_putstr("Stuck button register is invalid, clearing.");
dbgserial_print_hex(button_counter_register);
RTC_WriteBackupRegister(... |
if (button_counter_register != 0) {
dbgserial_print("Button was pushed on boot. Button counter: ");
dbgserial_print_hex(button_counter_register);
dbgserial_newline();
}
RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter_register);
return result;
}
bool is_flash_broken(void) {
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... | {
struct tm t;
gmtime_r(&time, &t);
// Just die if sanitization is necessary.
PBL_ASSERTN(!rtc_sanitize_struct_tm(&t));
RTC_TimeTypeDef rtc_time_struct = {
.RTC_Hours = t.tm_hour,
.RTC_Minutes = t.tm_min,
.RTC_Seconds = t.tm_sec
};
RTC_DateTypeDef rtc_date_struct = {
.RTC_Month = t.tm_m... |
void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) {
uint32_t sub_seconds = 0;
RTC_DateTypeDef rtc_date;
RTC_TimeTypeDef rtc_time;
// NOTE: There is a tricky rollover situation that can occur here if the date rolls over
// between when we read the date and time registers. For example:
// read... |
/*
* 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... | progress_callback(0, count, progress_context) | ;
}
FLASH_Unlock();
for (int sector = first_sector; sector <= last_sector; ++sector) {
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
if (FLASH_EraseSector(
s_sectors[sector], VoltageRange_1... |
error) {
ANCSCharacteristic characteristic_id = prv_get_id_for_characteristic(subscribed_characteristic);
if (characteristic_id != ANCSCharacteristicNotification &&
characteristic_id != ANCSCharacteristicData) {
// Only Notification and Data characteristics are expected to be subscribed to
WTF;
}
... | BLE_LOG_DEBUG("> EventFlags: <%d>", nsnotification->event_flags) | ;
BLE_LOG_DEBUG("> CategoryID: <%d>", nsnotification->category_id);
BLE_LOG_DEBUG("> CategoryCount: <%d>", nsnotification->category_count);
BLE_LOG_DEBUG("> NotificationUID: <%"PRIu32">", nsnotification->uid);
BLE_HEXDUMP((uint8_t *)nsnotification, sizeof(NSNotification));
// Handle the CategoryID
if (nsno... |
/*
* 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_set_serial_number(info) | ;
prv_set_firmware_revision(info);
prv_set_software_revision(info);
}
|
audio_endpoint_setup_transfer(prv_test_setup_complete_callback,
prv_test_stop_transfer_callback) | ;
cl_assert(s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID);
}
void test_audio_endpoint__setup_complete_callback_call_once(void) {
ResponsivenessGrantedHandler granted_handler =
fake_comm_session_get_last_responsiveness_granted_handler();
cl_assert_equal_i(s_setup_complete_call_count, 0);
granted_han... | |
/*
* 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... | (4, s_override_to) | ;
}
int64_t prv_override_times_two(AnimationProgress p, int64_t a, int64_t b) {
return interpolate_int64_linear(p, a, b) * 2;
}
void test_animation_interpolate__override_gets_clipped(void) {
s_animation_private_current_interpolate_override = prv_override_times_two;
cl_assert_equal_i(INT16_MIN, interpolate_int1... |
8_BOLD,
[TextStyleFont_Caption] = FONT_KEY_GOTHIC_14,
[TextStyleFont_Footer] = FONT_KEY_GOTHIC_14,
//! @note this is the same as the Title key (as that's what it's cloned from) until Small
//! is designed
[TextStyleFont_MenuCellTitle] = FONT_KEY_GOTHIC_18_BOLD,
//! @note this i... | (LOG_LEVEL_ERROR, "Requested a content size that is out of bounds (%d)", content_size) | ;
goto fail;
} else if (font >= TextStyleFontCount) {
PBL_LOG(LOG_LEVEL_ERROR, "Requested a style font that is out of bounds (%d)", font);
goto fail;
}
return s_text_styles[content_size].fonts[font];
fail:
PRIVILEGE_WAS_ELEVATED ? syscall_failed() : WTF;
}
////////////////////
// Public API
// ***... |
/*
* 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... | (0, 0, 150, 600) | );
layer_set_frame(&l, &GRect(10, 20, 100, 700));
cl_assert_equal_grect(l.bounds, GRect(0, 0, 150, 700));
}
|
PBL_ASSERTN(s_layer_up) | ;
BestEffortPacket *packet = pulse_link_send_begin(
PULSE2_BEST_EFFORT_TRANSPORT_PROTOCOL);
packet->protocol = hton16(app_protocol);
return &packet->information;
}
void pulse_best_effort_send(void *buf, const size_t length) {
PBL_ASSERTN(s_layer_up);
PBL_ASSERT(length <= pulse_link_max_send_size() - si... | |
(char *)data) == 0);
}
PFSCallbackHandle pfs_watch_file(const char* filename, PFSFileChangedCallback callback,
uint8_t event_flags, void* data) {
mutex_lock_recursive(s_pfs_mutex);
PFSFileChangedCallbackNode *node = kernel_malloc_check(sizeof(PFSFileChangedCallbackNode));
*node... | (file_name) | ;
}
}
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
status_t pfs_remove(const char *name) {
if (name == NULL) {
return E_INVALID_ARGUMENT;
}
size_t namelen = strlen(name);
if ((namelen < 1) || (namelen > FILE_MAX_NAME_LEN)) {
return (E_INVALID_ARGUMENT);
}
mutex_lock_recursive(s_... |
>implementation = &s_complex_implementation;
return prv_complex_init(parent_h, animation_array, array_len,
type);
}
// -------------------------------------------------------------------------------------------
static Animation *prv_animation_clone(AnimationState *state, AnimationPrivate *... | {
applib_free(state->aux);
} | |
/*
* 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... | layer_add_child(&window->window.layer, &window->text.layer) | |
IN_RECT GPointPrecise(5, 5)
#define END_ON_ORIGIN_RECT GPointPrecise(25, 25)
#define START_ON_ORIGIN_RECT_XY GPointPrecise(15, 15)
#define END_ON_ORIGIN_RECT_XY GPointPrecise(35, 35)
#define START_ON_ORIGIN_RECT_NXNY GPointPrecise(-5, -5)
#define END_ON_ORIGIN_RECT_NXNY GPointPrecise(15, 15)
... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEPTH_NAME}.pbi"));
// TOD... |
/*
* 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 (timer_data) {
prv_timer_cleanup(timer_data);
} |
return jerry_create_undefined();
}
static void prv_init_apis(void) {
rocky_add_global_function(ROCKY_SETINTERVAL, setInterval_handler);
rocky_add_global_function(ROCKY_SETTIMEOUT, setTimeout_handler);
rocky_add_global_function(ROCKY_CLEARTIMEOUT, clearTimer_handler);
rocky_add_global_function(ROCKY_CLEARIN... |
/*
* 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_disable(bus->spi, bus->state->spi_clock_periph) | ;
}
static void prv_spi_clear_flags(const SPIBus *bus) {
prv_spi_receive_data(bus);
prv_spi_get_flag_status(bus, (SpiI2sFlag)0);
}
static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma dma_bits, bool enable) {
if (enable) {
bus->spi->CR2 |= (uint16_t)dma_bits;
} else {
bus->spi->CR2 &= (uint16_t)~d... |
/*
* 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... | for (int i = 0; i < c->total_items; ++i) {
uint8_t* ours = prv_get_item_at_index(c, i);
if (c->compare_cb(ours, theirs) == 0) {
return ours;
}
} |
return NULL;
}
void circular_cache_push(CircularCache* c, void* new_item) {
uint8_t* old_item = prv_get_item_at_index(c, c->next_erased_item_idx);
if (c->item_destructor) {
c->item_destructor(old_item);
}
memcpy(old_item, new_item, c->item_size);
++c->next_erased_item_idx;
UTIL_ASSERT(c->next_erased... |
et(ANALYTICS_APP_METRIC_FLASH_READ_COUNT, analytics_read_count, AnalyticsClient_Worker);
analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, analytics_read_bytes_count, AnalyticsClient_Worker);
analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, analytics_write_bytes_count, AnalyticsClient_Worker... | {
assert_usable_state();
if (!s_flash_state.deep_sleep) {
flash_start_cmd();
flash_send_and_receive_byte(FLASH_CMD_DEEP_SLEEP);
flash_end_cmd();
// guarantee we have actually transitioned to deep sleep
delay_us(5);
s_flash_state.deep_sleep = true;
}
} |
static void flash_deep_sleep_exit(void) {
assert_usable_state();
if (s_flash_state.deep_sleep) {
flash_start_cmd();
flash_send_and_receive_byte(FLASH_CMD_WAKE);
flash_end_cmd();
// wait a sufficient amount of time to enter standby mode
// It appears violating these timing conditions can lead... |
/*
* 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... | applib_free(anim_ctx) | |
metric_duration_info(StringList *headings, int headings_buf_size,
StringList *values, int values_buf_size,
ActivitySession *session) {
const size_t duration_buffer_size = sizeof("00:00:00");
char duration_str[duration_buffer_size];
... | i18n_get("Active Calories", headings) | |
/*
* 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 (cmd == APP_RUN_STATE_STATUS_COMMAND) {
launcher_app_message_send_app_state_deprecated(uuid, RUNNING);
} |
}
// Helpers
////////////////////////////////////
static const uint8_t *prv_build_push_message(uint32_t key, uint8_t value, uint32_t *size) {
// Using static buffer is OK because tests are single-threaded
static uint8_t buffer[sizeof(AppMessagePush) + sizeof(Tuple) + sizeof(uint8_t)];
AppMessagePush *push_mess... |
layout) {
return GSizeZero;
}
uint32_t resource_storage_get_num_entries(ResAppNum app_num, uint32_t resource_id) {
return 0;
}
static bool s_skip_mem_leak_check;
static void prv_init(void) {
rocky_runtime_context_init();
jerry_init(JERRY_INIT_EMPTY);
}
static void prv_deinit(void) {
jerry_cleanup();
ro... | {
Layer *root_layer = &s_app_window_stack_get_top_window.layer;
root_layer->bounds = GRect(10, 20, 30, 40);
cl_assert(root_layer->update_proc);
GContext ctx = {.lock = true};
root_layer->update_proc(root_layer, &ctx);
if (s_tictoc_callback_is_color) {
cl_assert_equal_i(1, s_graphics_fill_rect.call_coun... |
void test_js__rocky_tictoc_color(void) {
prv_deinit(); // engine will be re-initialized in rocky_event_loop~
char *script = prv_load_js("color");
s_tictoc_callback_is_color = true;
s_app_event_loop_callback = prv_rocky_tictoc_callback;
bool result = rocky_event_loop_with_string_or_snapshot(script, strlen(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... | {
portBASE_TYPE result;
do {
HcProtocolMessageHandlerEvent e;
result = xQueueReceive(s_dispatcher.job_queue, &e, 0);
if (result == pdTRUE) {
kernel_free(e.msg);
}
} while (result == pdTRUE);
vQueueDelete(s_dispatcher.job_queue);
s_dispatcher.job_queue = NULL;
s_dispatcher.task = NULL;... | |
w.text_layer, data->mic_window.text_buffer);
}
static void prv_kino_reel_stopped_handler(KinoLayer *layer, bool finished, void *context) {
if (!finished) {
return;
}
// This stopped handler is used to defer the transition from recording to the wait for response
// screen until the folding animation is com... | grect_align(&dot_frame, root_frame, GAlignCenter, false) | ;
GRect from;
GRect to;
if (fly_in) {
to = dot_frame;
from = dot_frame;
from.origin.x = -to.size.w;
} else {
from = dot_frame;
to = dot_frame;
to.origin.x = -from.size.w;
}
data->mic_window.mic_dot_radius = MIC_DOT_MAX_RADIUS;
PropertyAnimation *anim = property_animation_create_la... |
/*
* 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_resource_mutex) | ;
return rv;
}
void resource_init(void) {
// see if there's a system bank waiting to be loaded
resource_storage_init();
s_resource_mutex = mutex_create_recursive();
}
uint32_t resource_get_and_cache(ResAppNum app_num, uint32_t resource_id) {
PBL_ASSERTN(app_num == SYSTEM_APP);
// get from resource store
... |
{
.argv = {
[0] = jerry_create_number(-0.5),
[1] = jerry_create_number(-0.2),
[2] = jerry_create_number(0.3),
[3] = jerry_create_number(0.5),
},
.argc = 4,
.expected_output = PP(-4, -2, 2, 4),
},
{
.argv = {
[0] = jerry_create_number(-4096.... | (output.b, cases[i].expected_output.b) | ;
}
jerry_release_value(cases[i].input);
cases[i].input = 0;
}
}
|
SCRATCH_BEGIN, sizeof(dummy_data));
profiler_start();
status_t result = flash_impl_erase_sector_begin(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN);
flash_impl_get_erase_status();
if (result == S_SUCCESS) {
while (flash_impl_get_erase_status() == E_BUSY) {
was_busy = true;
}
}
profiler_stop();
uint32... | prompt_send_response("ERROR: Data read (SDR mode) did not match data written!") | ;
}
}
void command_flash_signal_test_run(void) {
if (!s_signal_test_initialized) {
prompt_send_response("ERROR: 'flash signal test init' must be run first!");
return;
}
QSPIFlash *dev = QSPI_FLASH;
qspi_use(QSPI);
// set to DDR
prv_set_fast_read_ddr_enabled(dev, true);
// issue the read
ui... |
((Layer *)swap_layer->current, SWAP_MS, dy,
NULL) | ;
Animation *next_down = prv_create_anim_frame_scroll((Layer *)swap_layer->next, SWAP_MS, dy,
NULL);
return animation_spawn_create(prev_down, current_down, next_down, NULL);
}
static bool prv_setup_swap_up(SwapLayer *swap_layer) {
LayoutLayer *new_previous = ... | |
C_InitStructure);
NVIC_EnableIRQ(OTG_FS_WKUP_IRQn);
// Trigger it. This transfers control to our ISR handler OTG_FS_WKUP_IRQHandler
NVIC_SetPendingIRQ(OTG_FS_WKUP_IRQn);
} else if (index == 6) {
PBL_LOG(LOG_LEVEL_INFO, "Forcing bus fault during core dump");
core_dump_test_force_bus_fault();
... | (data->window) | ;
GRect bounds = window_layer->bounds;
data->menu_layer = simple_menu_layer_create(bounds, data->window, &data->menu_section, 1,
NULL);
layer_add_child(window_layer, simple_menu_layer_get_layer(data->menu_layer));
}
// ===========================================... |
prv_assert_permissions_ui_and_respond(true /* is_granted */) | ;
cl_assert_equal_b(true, regular_timer_is_scheduled(timer));
bt_driver_cb_hrm_service_update_subscription(s_device_a, false);
cl_assert_equal_b(false, regular_timer_is_scheduled(timer));
bt_driver_cb_hrm_service_update_subscription(s_device_a, true);
cl_assert_equal_b(true, regular_timer_is_scheduled(time... | |
&nap_count);
PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count);
if (nap_count > 0 || sleep_count == 0) {
PBL_LOG(LOG_LEVEL_ERROR, "FAILED: expected only sleep but got %d naps and %d sleep", nap_count,
sleep_count);
prv_test_end(context, false);
... | (time_util_get_midnight_of(rtc_get_time()) + 1 * SECONDS_PER_DAY) | ;
ActivityInsightSettings original_settings;
activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings);
ActivityInsightSettings disabled_settings = original_settings;
disabled_settings.enabled = false;
activity_insights_settings_write(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY... |
,
AVERAGE_SLEEP
};
memcpy(&s_data.metric_history[ActivityMetricSleepTotalSeconds], sleep_history,
sizeof(sleep_history));
}
// ---------------------------------------------------------------------------------------
// Test that the activity reward triggers when it should, and doesn't trigger when it s... | rtc_get_time() | );
cl_assert_equal_i(s_data.pins_added, 0);
}
// ---------------------------------------------------------------------------------------
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 = {
// ... |
ype = PEBBLE_BATTERY_CONNECTION_EVENT,
.battery_connection = {
.is_connected = battery_is_usb_connected(),
},
};
event_put(&event);
}
// Read the interrupt status registers to clear pending bits.
static void prv_clear_pending_interrupts(void) {
uint8_t throwaway_read_result;
prv_read_register(Pmi... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id);
} |
return found;
}
static void prv_set_sd1_voltage(void) {
// STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power supply has a
// tolerance of 3%. Set the voltage rail to 1.825V so our theoretical minimum should be 1.77V
uint8_t sd1_vsel;
if (prv_read_register(PmicRegisters_SD1_VOLTAGE, &s... |
1) * 2;
s_custom_res_list.custom_resources = realloc(s_custom_res_list.custom_resources, new_size);
s_custom_res_list.array_size = new_size;
}
s_custom_res_list.custom_resources[s_custom_res_list.next_index] = *res;
++s_custom_res_list.next_index;
}
static void prv_custom_resource_remove(uint32_t resou... | {
printf("Error: Failed to open resources file\n");
return false;
} |
return true;
}
void emx_resources_deinit(void) {
fclose(s_resource_file);
}
uint32_t emx_resources_register_custom(ResourceReadCb read_cb, ResourceGetSizeCb get_size_cb) {
EmxCustomResource custom_res = {
.resource_id = ++s_custom_res_list.last_id,
.read = read_cb,
.get_size = get_size_cb,
};
... |
nclude "settings_vibe_patterns.h"
#include "settings_window.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "services/common/analytics/analytics_event.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/notifications/alerts_preferences_private.h"
#include "services/normal/vibes/vib... | (LOG_LEVEL_ERROR, "Null VibeScore!") | ;
return;
}
vibe_score_do_vibe(score);
vibe_score_destroy(score);
}
static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) {
vibes_cancel();
SettingsVibePatternsData *data = (SettingsVibePatternsData *)context;
VibeClient client;
switch (row) {
case VibeSettingsRow_Notificatio... |
SlaveSelect_Soft = 0x0200,
SpiSlaveSelect_Hard = 0x0000
} SpiSlaveSelect;
typedef enum {
SpiDisable = 0,
SpiEnable
} SpiFunctionalState;
//
// Private SPI bus functions. No higher level code should
// get access to SPIBus functions or data directly
//
static bool prv_spi_get_flag_status(const SPIBus *bus, Spi... | prv_spi_transmit_is_idle(bus) | ) continue;
}
void prv_spi_receive_wait_ready_blocking(const SPIBus *bus) {
while (!prv_spi_receive_is_ready(bus)) continue;
}
static void prv_configure_spi_sclk(const AfConfig *clk_pin, uint16_t spi_sclk_speed) {
gpio_af_init(clk_pin, GPIO_OType_PP, spi_sclk_speed, GPIO_PuPd_NOPULL);
}
static void prv_spi_bus_d... |
EMULATED_PPOGATT_SERVICE_HDL + EMULATED_DATA_CHAR_OFFSET)
#define EMULATED_PPOGATT_OFFSET 0xFF
// An emulated GATTService blob for a PPoGATT server which would usually be on the phone
static const uint8_t s_emulated_ppogatt_gatt_service[] = {
// GATTService
// UUID
0x10, 0x00, 0x00, 0x00, 0x32, 0x8e, 0x0f, 0xbb... | {
return false;
} |
return true;
}
static void prv_build_write_complete_payload(const HcGattHdr *hdr, uint16_t att_hdl,
PPoGATTWorkAroundState *state) {
if (state->pending_response_data) {
PBL_LOG(LOG_LEVEL_DEBUG, "WOAH");
kernel_free(state->pending_response_data);
}
const ui... |
o in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "applib/ui/lay... | prv_clear_recognizers_processed(&s_recognizers_handled) | ;
prv_clear_recognizers_processed(&s_recognizers_reset);
}
static void prv_store_recognizer_idx(Recognizer *recognizer, ListNode **list) {
int *idx = recognizer_get_impl_data(recognizer, &s_dummy_impl);
if (idx) {
RecognizerHandled *rec = malloc(sizeof(RecognizerHandled));
cl_assert(rec);
*rec = (Rec... |
/*
* 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... | (app_id->value, app_id->length,
&new_attr_list, &existing_notif_prefs->action_group) | ;
// Dismiss the notification so the user is oblivious to this process
ancs_perform_action(uid, ActionIDNegative);
}
|
t_client_subscriptions_get_notification_header(GAPLEClientApp, NULL);
cl_assert_equal_b(has_notification, false);
}
void test_gatt_client_subscriptions__zero_length_notification(void) {
// Subscribe app:
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
BTErrno e = gatt_client_subscripti... | prv_confirm_cccd_write(BLEGATTErrorSuccess) | ;
fake_event_clear_last();
// We had a bug at some point where the header size was not taken into account correctly, take
// a value that won't fit by 1 byte, so this bug does not happen again:
const size_t too_big = GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE -
sizeof(GATTBufferedNotificati... |
clock_init() | ;
static const time_t jan1st_noon_2015 = 1420113600;
for (int dstid = 0; dstid < DST_ID_COUNT; dstid++) {
TimezoneInfo tz_info = {
.dst_id = dstid,
.tm_gmtoff = s_dst_correct_values[dstid][2]
};
prv_update_dstrule_timestamps_by_dstzone_id(&tz_info, jan1st_noon_2015);
if (tz_info.dst_... | |
///////////////////////////////////
static void prv_assert_initial_playback_state(void) {
cl_assert_equal_i(music_get_playback_state(), MusicPlayStateUnknown);
uint32_t track_pos_ms;
uint32_t track_duration_ms;
music_get_pos(&track_pos_ms, &track_duration_ms);
cl_assert_equal_i(track_pos_ms, 0);
cl_assert... | music_is_playback_state_reporting_supported() | , true);
cl_assert_equal_b(music_is_progress_reporting_supported(), true);
cl_assert_equal_b(music_is_volume_reporting_supported(), true);
cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), true);
for (MusicCommand cmd = 0; cmd < NumMusicCommand; ++cmd) {
cl_assert_equal_b(music_is_command_sup... |
yer.layer);
}
static void prv_update_progress(ProgressUIData *data) {
switch (data->progress_source) {
case PROGRESS_UI_SOURCE_COREDUMP: {
break;
}
case PROGRESS_UI_SOURCE_LOGS: {
break;
}
case PROGRESS_UI_SOURCE_FW_UPDATE: {
if (firmware_update_current_status() == FirmwareUpdat... | window_set_overrides_back_button(window, true) | |
40, -304, -664},
{ -720, -280, -664},
{ -656, -360, -632},
{ -600, -272, -616},
{ -616, -344, -640},
{ -632, -320, -672},
{ -704, -360, -656},
{ -664, -368, -688},
{ -656, -304, -664},
{ -688, -344, -696},
{ -672, -336, -744},
{ -664, -480, -456},
{ -616, -640, -728},
... | { -424, -216, -768},
{ -472, -208, -712},
{ -488, -184, -736},
{ -496, -152, -800},
{ -424, -224, -824},
{ -528, -208, -808},
{ -480, -224, -848},
{ -568, -96, -848},
{ -544, -200, -848},
{ -536, -184, -856},
{ -608, -168, -800},
{ -608, -192, -776},
{ -648, -152, -80... |
{ -432, -40, -912},
{ -456, -72, -792},
{ -440, -88, -832},
{ -488, 16, -840},
{ -480, -48, -920},
{ -512, -40, -896},
{ -440, -56, -840},
{ -472, -104, -848},
{ -480, -120, -912},
{ -520, -16, -768},
{ -512, -120, -840},
{ -432, -104, -864},
{ -448, -120, -824},
... |
0, -24, -208},
{ -1096, 400, -576},
{ -1064, 112, -280},
{ -1936, 456, -728},
{ -1568, -64, 0},
{ -1256, 112, -176},
{ -1056, 432, -248},
{ -680, 64, 32},
{ -376, 32, -64},
{ -344, 88, -96},
{ -480, 720, -216},
{ -1000, -224, 176},
{ -944, 200, -80},
{ -1240, 368, -22... | { -1208, 120, -96},
{ -1288, 200, -176},
{ -1672, 216, -176},
// 18 seconds
{ -696, 400, -168},
{ -984, 0, -176},
{ -920, -40, -112},
{ -528, 88, -216},
{ -448, 160, -208},
{ -568, 200, -168},
{ -744, 248, -256},
{ -1208, 8, -312},
{ -928, 256, -336},
{ -888, 320,... |
{ -1136, -168, -232},
{ -1760, 312, -720},
{ -1328, 32, -184},
{ -1120, 192, -320},
{ -840, 304, -336},
{ -648, 32, 32},
{ -520, 64, -16},
{ -440, -112, 80},
{ -600, -200, -88},
{ -872, 24, -8},
{ -968, 336, -272},
{ -1240, 264, -320},
{ -1456, 0, -152},
{ -1568,... |
white, dark_grey, light_grey, transparent)
// Tests 1-bit jazzberry_jam colored palettized PNG loading into gbitmap
// tests covers an old bug in image tooling where 1 color was 2 power 0
// so bitdepth was detected as 0 (incorrectly)
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_1_bit_ja... | (gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette))) | ;
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette);
}
// Tests 2-bit greyscale PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__greyscale_2_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette));
cl_assert(gbitmap_pbi_eq(bi... |
result");
sys_voice_stop_dictation(data->session_id);
prv_set_mic_window_state(data, StateWaitForResponse);
prv_update_analytics_metrics(data);
app_timer_cancel(data->dictation_timeout);
}
static void prv_cancel_dictation(VoiceUiData *data) {
if ((data->state != StateStart) && (data->state != StateFinished) ... | property_animation_destroy(revert) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.