Code Read [statusbar]

本文深入探讨了Android系统UI框架中资源管理、图标应用及处理函数的交互过程,详细解析了设置图标与xml文件的对应关系,以及在不同组件如StatusBarManagerService和PhoneStatusBar中的实现方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Resource 资源:

frameworks/base/packages/SystemUI/res/drawable-hdpi

QuickSetting:ic_qs_***.png

对应每个setting有xml

处理函数为:QuickSettings.java

 

icons:

ic_notify_settings_normal~~~~进入setting

Ic_notifications

Ic_notify_quicksettings

 

 

Code:                                                                                                                                               

./services/java/com/android/server/StatusBarManagerService.java

./packages/SystemUI/src/com/android/systemui/statusbar

./core/java/com/android/internal/statusbar

 

 

PhoneStatusBar.java

makeStatusBarView()

statusbarxml--> super_status_bar.xml

 

<com.android.systemui.statusbar.phone.StatusBarWindowView>

    <com.android.systemui.statusbar.phone.PhoneStatusBarView >  [R.id.status_bar~~mStatusBarView]

    <com.android.systemui.statusbar.phone.PanelHolder>  [R.id.panel_holder~~holder]

        <com.android.systemui.statusbar.phone.NotificationPanelView >  [R.id.notification_panel~~mNotificationPanel]

        <com.android.systemui.statusbar.phone.SettingsPanelView>  [R.id.quick_settings_stub~~mSettingsPanel]

   </com.android.systemui.statusbar.phone.PanelHolder>

</com.android.systemui.statusbar.phone.StatusBarWindowView>

 

Expand上面一行:

status_bar_expanded_header.xml

 

int oppo_ui_status_bar_event_treat(const struct __win_context_t* p_win, win_event_t event, void *p_param) { uint32_t ret = 0; win_param_t *init_param = (win_param_t *)p_param; switch (event.payload) { case WIN_EXIT: { if (init_param) { if (init_param->is_user) { uint32_t p = init_param->payload; if (p >= JUMP_ANDROID_FLAG) { lv_event_code_t click_type = (p) & 0xff; uint32_t id = ((p) >> 8) & 0xff; // set_send_fb_on(false); statusbar_smartmode_start_app(id, click_type); } } if (g_sbar && !init_param->is_user) { add_statusbar_event_point((char*)"rx_close_status_panel", true, g_sbar->cur_page); } } if (g_sbar && g_sbar->tabview) { lv_tabview_set_act(g_sbar->tabview, 0, LV_ANIM_OFF); } break; } case WIN_USER_EVENT: { if (!p_param ) { break; } wm_user_msg_t *payload = (wm_user_msg_t *)p_param; OPLUS_UI_INFO_LOG("[sbar] payload->msg_id: %d, payload->len:%d\n", payload->msg_id, payload->len); sbar_user_evend_handle(payload->msg_id, payload); break; } case WIN_SWIPE_UP_IS_ALLOW: { bool is_need_refr = true; if (is_need_refr) { window_ui_display_repaint(true); } // set_send_fb_on(old); ret = WM_SWIPE_IS_ALLOW; break; } case WIN_INIT: OPLUS_UI_WARN_LOG("statusbar win_init"); clear_and_refresh_top_icon(); if (init_param && !init_param->is_user) { add_statusbar_event_point((char*)"rx_show_status_panel", false, 0); } #if (defined(PRODUCT_OWW242) && (PRODUCT_OWW242)) uint8_t guide_status = 0; if (g_sbar && g_sbar->statusbar_api) { uint8_t guide_status = g_sbar->statusbar_api->srv_read(STATUSBAR_GET_GUIDE_STATUS, NULL, 0); OPLUS_UI_WARN_LOG("statusbar read guide status:%d", guide_status); if (STATUS_SHOW_BAND_GUIDE_MODE == guide_status) { statusbar_guide_anim_create(); } } else { OPLUS_UI_ERROR_LOG("statusbar guide g_sbar err"); } #endif break; case EVENT_KEY_POW_LONG_PRESS: case EVENT_KEY_POW_SHORT_CLICK: case EVENT_KEY_POW_DOUBLE_CLICK: { sbar_exit_main_page(); // wm_event_hanlde(false); } break; default: break; } return ret; } 这个函数什么时候出触发add_statusbar_event_point
07-08
static void btn_handler(lv_event_t* event) { if(NULL == event){ OPLUS_UI_ERROR_LOG("[sbar] event err\n"); return; } lv_event_code_t code = lv_event_get_code(event); OPLUS_UI_INFO_LOG("[sbar] code:%d\n",code); if (LV_EVENT_LONG_PRESSED == code) { uint32_t school_status; oppo_service_intf_t *school_mode_srv = oppo_get_service(SRV_SCHOOLMODE); if(NULL == school_mode_srv){ return; } school_mode_srv->read(SCHOOL_MODE_GET_STATUS, &school_status, sizeof(school_status)); // oppo_school_mode_get_status(0, &school_status, 4); if (OPPO_SCHOOL_MODE_ON == school_status || OPPO_SCHOOL_MODE_PRE_OFF == school_status) { sbar_flex_motor_run_custom_vibrate(); return; } } if (LV_EVENT_SHORT_CLICKED == code || LV_EVENT_LONG_PRESSED == code) { uint32_t num = (uint32_t)lv_event_get_user_data(event); status_win_btn_t *btn = find_btn_table_member(num); if(NULL == btn){ OPLUS_UI_ERROR_LOG("[sbar] btn err\n"); return; } if (btn->imgbtn && LV_EVENT_LONG_PRESSED == code) { lv_obj_clear_state(btn->imgbtn, LV_STATE_PRESSED_50MS | LV_STATE_PRESSED); } OPLUS_UI_WARN_LOG("[sbar] btn: btn->id:%d,num:%d\n",btn->id,num); if (btn->id < STATUS_ICON_ID_MAX) { if (const_btn_table[btn->id].func) { const_btn_table[btn->id].func(event);//执行指定cb add_select_statusbar_function_event_point(btn->id, (uint8_t)code); } } } } 如果对于上述代码,点击状态栏开关时,需要区分点击的开关,TP按键类型,keyvalue:4——短按;5长按(底层代码是5,实际上报为6),需要插入一段埋点 来区分开关类型 应该插在哪里?埋点函数应该怎么写
07-09
static void btn_handler(lv_event_t* event) { if(NULL == event){ OPLUS_UI_ERROR_LOG("[sbar] event err\n"); return; } lv_event_code_t code = lv_event_get_code(event); OPLUS_UI_INFO_LOG("[sbar] code:%d\n",code); if (LV_EVENT_LONG_PRESSED == code) { uint32_t school_status; oppo_service_intf_t *school_mode_srv = oppo_get_service(SRV_SCHOOLMODE); if(NULL == school_mode_srv){ return; } school_mode_srv->read(SCHOOL_MODE_GET_STATUS, &school_status, sizeof(school_status)); // oppo_school_mode_get_status(0, &school_status, 4); if (OPPO_SCHOOL_MODE_ON == school_status || OPPO_SCHOOL_MODE_PRE_OFF == school_status) { sbar_flex_motor_run_custom_vibrate(); return; } } if (LV_EVENT_SHORT_CLICKED == code || LV_EVENT_LONG_PRESSED == code) { uint32_t num = (uint32_t)lv_event_get_user_data(event); status_win_btn_t *btn = find_btn_table_member(num); if(NULL == btn){ OPLUS_UI_ERROR_LOG("[sbar] btn err\n"); return; } if (btn->imgbtn && LV_EVENT_LONG_PRESSED == code) { lv_obj_clear_state(btn->imgbtn, LV_STATE_PRESSED_50MS | LV_STATE_PRESSED); } OPLUS_UI_WARN_LOG("[sbar] btn: btn->id:%d,num:%d\n",btn->id,num); if (btn->id < STATUS_ICON_ID_MAX) { if (const_btn_table[btn->id].func) { const_btn_table[btn->id].func(event);//执行指定cb add_select_statusbar_function_event_point(btn->id, (uint8_t)code); } } } } 分析埋点函数add_select_statusbar_function_event_point(btn->id, (uint8_t)code);的实现 其中 void add_select_statusbar_function_event_point(uint8_t function_id, uint8_t tp_type) { OPLUS_UI_INFO_LOG("[sbar]event_point function_id: %d, tp_type:%d\n ", function_id, tp_type); UserEvent_t_ValuesEntry entry[5]; memset(entry, 0, sizeof(entry)); uint8_t strcpy_max_len = sizeof(entry[0].value) - 1; strncpy(entry[0].key, "function_id", sizeof(entry[0].key)-1); snprintf(entry[0].value, strcpy_max_len, "%d", function_id); strncpy(entry[1].key, "keyvalue", sizeof(entry[1].key)-1); snprintf(entry[1].value, strcpy_max_len, "%d", tp_type); service_eventpoint_log("30412009", "rx_click_qs_tile", 2, entry, true, true); }
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值