Commit Graph

25 Commits

Author SHA1 Message Date
openvela-robot 9d0c825cbb Merge commit
Change-Id: If26995eebd18a82ac4cd827e6801458e57a6ead3
2026-04-27 23:14:50 +08:00
chejinxian1 e3303ae0d2 bluetooth: Replace `calloc` with `malloc` for `signal_work_t` allocation
in `thread_loop_work_sync`

Rootcause: Replace `zalloc` with the C standard library function `calloc` to avoid compilation errors.

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
Signed-off-by: miot-robot <miot-robot@xiaomi.com>
2026-04-20 14:52:40 +08:00
v-chenghuijin 4bc6a21afd Bluetooth: Prevent crash when calling uv_run after event loop closure.
Rootcause: uv_loop_close() marks internal data structures as invalid (e.g., set to -1), but pending callbacks in the queue still reference these invalidated structures. When uv_run() is called later, it processes the queue using corrupted pointers, leading to segmentation faults and crashes. Solution: Introduce a new flag in uv_loop_close() to mark the loop as closed and check it in uv_run() and other loop-related functions to prevent execution of callbacks after closure, ensuring memory safety and avoiding invalid pointer access.

Signed-off-by: v-chenghuijin <v-chenghuijin@xiaomi.com>
Signed-off-by: miot-robot <miot-robot@xiaomi.com>
2026-04-20 14:52:40 +08:00
liuxiang18 904d80778e bluetooth: fixed a use-after-free issue caused by ins->client_loop & ins have been released during worker execution.
When the client clears resources, if tasks are still executing in the worker thread at that time, it will lead to a use-after-free issue.

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2026-04-20 14:52:15 +08:00
zhongzhijie1 6770f27102 Adjust the priority of bt_client to always be 1 higher than that of bluetoothd.
Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2026-04-20 14:51:29 +08:00
Haishen Zhang bc1958f97b Vela-Android: fix compiling failure
1. Add bt_config.h in uv_thread_loop.c
2. Follow the changs on Vela to redefine the prio definition

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:51:12 +08:00
Haishen Zhang 764c65400d Bluetooth: adjust prio of BT task/threads
1. bluetoothd
2. bt_client#
3. bluelet_thread
4. bttool
5. default prio: 100->103(>CONFIG_MIWEAR_APPS_PRIORITY=102)

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:51:12 +08:00
fangzhenwei 8b2fb1d60a coverity: fix CHECKED_RETURN issue
Calling uv_loop_close without checking the return value, ignore return value

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:51:11 +08:00
Haishen Zhang 2b61b670a2 Vela-Android: porting bttool over socket(AF_INET) (1/2)
dependson:4036148

1. Enable Socket(AF_INET) first on Android
2. Fix the improper definition of Struct over Socekt between 64 bits and 32 bits system.
3. Modify the bttool to let it work similar to Vela

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:51:01 +08:00
Haishen Zhang 6ed1e5e080 Vela-Android: Porting Vela Bluetooth Framework Socket Client to Android x86_64
1. Port Vela Bluetooth Framework Socket Client onto Android.
2. For Socket Server, Service, SAL, we didn't port them onto Android.
3. For bttool, the function is not ready yet.
4. With this libbt-framework-client.so, we can start working on BTIF wrapper over Vela BT Framework Socket Client API.
5. And, we can also start working on bttool over Vela BT Framework Socket Client API later.

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:51:00 +08:00
Haishen Zhang 19bc307ac2 Clang-format: Update format of all files based on new .clang-format
1. Update format of all files based on new .clang-format

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:50:50 +08:00
duqunbo dd412f6a6b Avoid repeated creation of bluetooth instances during feature registration, and solve the accessing the freed memory during instance destruction
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:41 +08:00
fangzhenwei 9c25651c35 fix: uv_loop_init memory leak
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:40 +08:00
fangzhenwei 8942bceb4c Merge dev-bt and rel-4.0 --> dev
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:36 +08:00
fangzhenwei 6c3c3c5ffe fix crash && memory leak && build issue
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:31 +08:00
fangzhenwei 7564e172ea replace client side default loop
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:31 +08:00
fangzhenwei 85df52c079 fix utils/log.h build error
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:24 +08:00
fangzhenwei 6e6e279ab1 bluetooth framework re-implement adv & scan
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:23 +08:00
fangzhenwei 24ac7f15c0 bluetooth framework re-implement base
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:23 +08:00
gaozihao 5ab4dc6f8c Bluetooth: Code formatted without head file sorted.
Signed-off-by: gaozihao <gaozihao@xiaomi.com>
2026-04-20 14:50:21 +08:00
fangzhenwei 8ba91ef28c fix coverity REVERSE_INULL warning
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:18 +08:00
fangzhenwei d4e67e2059 fix crash && memory leak && build issue
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:07 +08:00
fangzhenwei dafa1ebb58 replace client side default loop
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:07 +08:00
fangzhenwei 21d6cbf38b fix utils/log.h build error
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:49:53 +08:00
fangzhenwei a493f47581 bluetooth framework re-implement base
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:49:51 +08:00