zoukankan      html  css  js  c++  java
  • android 关机充电流程

    点击打开链接

    0.主要流程

    usb插入通过传递cmdline给init解析从而启动充电进程


    1. LK


    lkappabootaboot.c

    update_cmdline
    
    
    ----------
    
           if (boot_into_ffbm)  // 工厂测试模式
            {
                    cmdline_len += strlen(androidboot_mode);
                    cmdline_len += strlen(ffbm_mode_string);
                    /* reduce kernel console messages to speed-up boot */
                    cmdline_len += strlen(loglevel);
            }
            else if (target_pause_for_battery_charge())   // 判断是否关机充电
            {
                    pause_at_bootup = 1;                    // charger flag
                    cmdline_len += strlen(battchg_pause);   //更新 cmd line 长度
            }
    ----------
    
            else if (pause_at_bootup)                    // charger flag
                    {
                            src = battchg_pause;         // static const char *battchg_pause = " androidboot.mode=charger";
                            if (have_cmdline) --dst;
                            while ((*dst++ = *src++));
                    }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25


    2.init


    #init.c
    if (!is_ffbm)
        is_charger = !strcmp(bootmode, "charger");
    
    
    
    ----------
    if (is_charger)
       action_for_each_trigger("charger", action_add_queue_tail);
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    # init.rc
    on charger
        class_start charger
    
    
    ----------
    
    
    # init.qcom.rc
    service charger /charger
        class charger
    
    
    ----------
    
    
    #system/core/healthd/Android.mk 
    
    LOCAL_MODULE := healthd
    ...
    # Symlink /charger to /sbin/healthd
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

  • 相关阅读:
    建立适当的索引
    Windows 10Bash命令
    代码生成工具介绍和使用
    分布式的任务调度框架
    Net分布式系统
    Keepalived+LVS+Nginx负载均衡之高可用
    call,apply,bind
    2015搜狐在线笔试题(内存泄露问题)(转)
    十步完全理解SQL(转)
    Linux shell用法和技巧(转)
  • 原文地址:https://www.cnblogs.com/liang123/p/6325180.html
Copyright © 2011-2022 走看看