码迷,mamicode.com
首页 > 其他好文 > 详细

off charging mode flow

时间:2018-09-14 16:03:38      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:int   mount   tin   recovery   default   cas   prope   top   files   

/system/core/init/init.cpp

.....
.....
.....
int main(int argc, char** argv) {
.....
.....
.....
    // Don‘t mount filesystems or start core system services in charger mode.
    std::string bootmode = GetProperty("ro.bootmode", "");
    if (bootmode == "charger") {
        am.QueueEventTrigger("charger");
    } else {
        am.QueueEventTrigger("late-init");
    }
.....
.....
.....

/system/core/rootdir/init.rc

.....
.....
.....
on charger
    class_start charger
.....
.....
.....

/system/core/healthd/Android.mk

.....
.....
.....
LOCAL_SRC_FILES :=     charger.cpp 
LOCAL_MODULE := charger
.....
.....
.....

/system/core/healthd/charger.cpp

int healthd_charger_main(int argc, char** argv) {
    int ch;

    healthd_mode_ops = &charger_ops;

    while ((ch = getopt(argc, argv, "cr")) != -1) {
        switch (ch) {
            case ‘c‘:
                // -c is now a noop
                break;
            case ‘r‘:
                // force nops for recovery
                healthd_mode_ops = &healthd_nops;
                break;
            case ‘?‘:
            default:
                KLOG_ERROR(LOG_TAG, "Unrecognized charger option: %c\n",
                        optopt);
                exit(1);
        }
    }

    return healthd_main();
}


int main(int argc, char** argv) {
    return healthd_charger_main(argc, argv);
}

[To Be Continued]

off charging mode flow

标签:int   mount   tin   recovery   default   cas   prope   top   files   

原文地址:https://www.cnblogs.com/youchihwang/p/9610876.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!