android四种启动模式_android:windowSoftInputMode

android四种启动模式_android:windowSoftInputMode(1)添加头文件:#include(2)在特定驱动结构体中添加early_suspend结构:#ifdefCONFIG_HAS_EARLYSUSPENDstructearly_suspendearly_suspend;#endif(3)在驱动probe函数中注册相关early_suspend结构体:#ifdefCONFIG_HAS_EARLYSUSPEND

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺


(1)添加头文件:

#include <linux/earlysuspend.h>

(2)在特定驱动结构体中添加early_suspend结构:

#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend early_suspend;
#endif

(3)在驱动probe函数中注册相关early_suspend结构体:

#ifdef CONFIG_HAS_EARLYSUSPEND
ftk_ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
ftk_ts->early_suspend.suspend = stm_ts_early_suspend;
ftk_ts->early_suspend.resume =stm_ts_late_resume;
register_early_suspend(&ftk_ts->early_suspend);
#endif

     所有注册到系统中的early_suspend结构都会按level值按顺序加入到全局链表early_suspend_handlers中。 

     希望执行early suspend的设备,他的设备驱动程序需要向电源管理系统注册,该结构体用于向电源管理系统注册earlysuspend/lateresume,当电源管理系统启动suspend流程时,回调函数suspend会被调用,相反,resume的最后阶段,回调函数resume会被调用,level字段用于调整该结构体在注册链表中的位置,suspend时,level的数值越小,回调函数的被调用的时间越早,resume时则反过来。Android预先定义了3个level等级:

 

[cpp] 
view plain
copy

  1. enum {  
  2.     EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,  
  3.     EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,  
  4.     EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,  
  5. };  
  6. struct early_suspend {  
  7. #ifdef CONFIG_HAS_EARLYSUSPEND  
  8.     struct list_head link;  
  9.     int level;  
  10.     void (*suspend)(struct early_suspend *h);  
  11.     void (*resume)(struct early_suspend *h);  
  12. #endif  
  13. };  

 

(4)在驱动remove函数取消early_suspend结构体的注册:

#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&ts->early_suspend);
#endif

(5)定义相关suspend和resume函数:

#ifdef CONFIG_HAS_EARLYSUSPEND
static void stm_ts_early_suspend(struct early_suspend *h)
{

struct ftk_ts *ts;
ts = container_of(h, struct ftk_ts, early_suspend);
stm_ts_suspend(ts->client, PMSG_SUSPEND);
}

static void stm_ts_late_resume(struct early_suspend *h)
{

struct ftk_ts *ts;
ts = container_of(h, struct ftk_ts, early_suspend);
stm_ts_resume(ts->client);
}
#endif

(6)在系统驱动结构体中设置未使用earlysuspend的函数接口:

#ifndef CONFIG_HAS_EARLYSUSPEND
.suspend = stm_ts_suspend,
.resume = stm_ts_resume,
#endif

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/192134.html原文链接:https://javaforall.net

(0)
上一篇 2026年1月18日 下午4:22
下一篇 2026年1月18日 下午5:01


相关推荐

  • 数据库与数据仓库区别

    数据库与数据仓库区别在具体学习数据仓库之前先看一下数据中心的整体构架以及数据流向 DB 是现有的数据来源 可以为 mysql SQLserver 文件日志等 为数据仓库提供数据来源的一般存在于现有的业务系统之中 ETL 是 Extract Transform Load 的缩写 用来描述将数据从来源迁移到目标的几个过程 Extract 数据抽取 也就是把数据从数据源读出来 Transform 数据转换 把原始数据转换成期望的格式和维度 如果用在数据仓库的场景下 Transform 也包含数据清洗 清

    2025年12月13日
    5
  • MSDN Windows 7 旗舰版 序列号

    MSDN Windows 7 旗舰版 序列号 GTWV3-KH84H-M94BG-PVT2W-JFPRW89Q2G-GBRGH-KFWRJ-Q72FD-GHYB7J3X6R-HPF6X-FQRDR-WTPM7-J92GK7KG4K-T2PTK-8YGQT-QX68X-RGRQ3TQMMV-43FFG-RGXMY-KMVFY-MB8JW8483D-TTKCX-CTDR6-XQXTH-X9JG4BVFKK-9X3FC-XPF4D-W8GTF

    2022年7月20日
    21
  • nginx–正向代理、反向代理及负载均衡(图解+配置)

    nginx–正向代理、反向代理及负载均衡(图解+配置)学习背景什么是 nginx 百度百科 Nginx enginex 是一个高性能的 HTTP 和反向代理 web 服务器 那么除了反向代理 nginx 支持正向代理 负载均衡以及基于 SSL 安全证书的 HTTPS 访问等功能特性 本文主要是介绍是 nginx 如何配置正向代理 反向代理及负载均衡 如果你自己从来没有安装过 nginx 想要先初步了解下 nginx 的基本安装及最简单的访问 可以看下我的这篇博文 nginx 如何基于 rpm 包进行离线安装及配置 Linux 进入正文 一 正向代理 1 1 什么是正向

    2026年3月26日
    3
  • undefined pthread_create_android studio has stopped

    undefined pthread_create_android studio has stopped最近在DebugAndroid工程时,发现真机直接崩溃闪退,但直接run则没问题,debug闪退日志报错:Dumpingallthreadswithoutappropriatelocksheld:threadlistlockmutatorlock,之前调试还是好好的,为什么突然就不行了呢?具体日志如下:12-0710:37:05.736:I/System

    2025年11月3日
    5
  • 运行 OpenClaw 的最佳模型

    运行 OpenClaw 的最佳模型

    2026年3月13日
    3
  • 豆包能生成多大的图

    豆包能生成多大的图

    2026年3月12日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号