Android学习——SystenUIService启动

本文详细介绍了Android系统的启动过程,从设备上电到进入用户态程序init,再到加载zygote及systemService。重点分析了systemService如何通过startSystemUi启动SystemUIService。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考 http://www.jianshu.com/p/0ab1279465fa


首先简单描述一下启动过程:

设备上电 ——>引导程序引导计入boot——>加载inittramfs、kernel镜像——>进入用户态程序init

init 的基本功能

管理设备,解析并管理Android启动脚本,实时维护init.rc 的服务,加载zygote


而zygote 将启动systemService. 在systemService 的main 函数中执行run 函数将启动一系列Service ,如

            startBootstrapServices();
            startCoreServices();
            startOtherServices();
在startOtherServices()中将
                    startSystemUi(context);
static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
进而进入SystemUIService。


static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
static final void startSystemUi(Context context) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService")); //Slog.d(TAG, "Starting service: " + intent); context.startServiceAsUser(intent, UserHandle.OWNER); }
作者:音苍 链接:http://www.jianshu.com/p/0ab1279465fa 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值