Discuz! Board

标题: android关于电池部分程序 [打印本页]

作者: zangcf    时间: 2016-6-8 20:20
标题: android关于电池部分程序
1,Android电池电量更新 - BatteryService(转)http://www.cnblogs.com/flyme/archive/2011/07/27/2118541.html
2,android 4.4 batteryservice 电池电量显示分析
http://blog.csdn.net/kc58236582/article/details/45564501
3,Android4.0 battery架构和管理
http://blog.csdn.net/bi511304183/article/details/9303073


作者: zangcf    时间: 2016-6-9 01:42
检测是否关机充电的时候,带入如下参数:

#ifdef MTK_KERNEL_POWER_OFF_CHARGING
        if(kernel_power_off_charging_detection(g_battery_cust))
        {
                printf(" < Kernel Power Off Charging Detection Ok> \n");
                return;
        }
        else
        {
                printf("< Kernel Enter Normal Boot > \n");
        }
#endif
作者: zangcf    时间: 2016-6-9 01:42
检测中做如下动作:
BOOL kernel_power_off_charging_detection(int g_battery_cust)
{
#if 0
        if((upmu_is_chr_det() == KAL_TRUE))
        {
                if(bypass_kernel_power_off_charging()){
                        return FALSE;
                }
                else
                {
            
                        g_boot_mode = KERNEL_POWER_OFF_CHARGING_BOOT;
                        return TRUE;
                }               
        }
        else
        {       
                upmu_set_rg_chrind_on(0);
                printf("[%s] Turn off HW Led\n", __func__);
                return FALSE;
        }
#else
    /* */
    if(is_force_boot()) {
        upmu_set_rg_chrind_on(0);
                printf("[%s] Turn off HW Led\n", __func__);
        return FALSE;
    }

    if((upmu_is_chr_det() == KAL_TRUE)) {
        g_boot_mode = KERNEL_POWER_OFF_CHARGING_BOOT;
//zcfdebug++<<
        if(g_battery_cust == 0){
//这里会导致无限重启        printf("[kernel_power_off_charging_detection] no battery and then power off\n");
//        mt6575_power_off();   
                return FALSE;     
        }
//zcfdebug>>++
                return TRUE;
    }
    else {
        /* power off */
        #ifndef NO_POWER_OFF
        printf("[kernel_power_off_charging_detection] power off\n");
        mt6575_power_off();        
        #endif
                return FALSE;       
    }
    /* */
#endif
}




欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2