struct early_suspend { #ifdef CONFIG_HAS_EARLYSUSPEND struct list_head link; int level; void (*suspend)(struct early_suspend *h); void (*resume)(struct early_suspend *h); #endif };
其中suspend和resume是需要用户自己定义的睡眠、唤醒接口函数。而level则是定义执行suspend、resume过程时的优先级,level值越小,suspend时则优先被调用,而resume则反过来,level值越大,则优先被调用。对于level值android默认定义了三个值:
enum { EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50, EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100, EARLY_SUSPEND_LEVEL_DISABLE_FB = 150, };
void register_early_suspend(struct early_suspend *handler); void unregister_early_suspend(struct early_suspend *handler);