Android开机自启动Launcher定制

本文介绍了如何修改Android系统框架,让自定义的Launcher成为开机唯一启动应用,并防止用户安装其他Launcher。通过添加私有过滤选项,修改系统相关代码,编写自定义Launcher,并删除原生Launcher,最终实现开机自动启动且无法被替换的目标。
摘要由CSDN通过智能技术生成

让你自己编写的Android的Launcher成为系统中第一个启动应用程序,也是唯一的Launcher

如果你要定制一个Android系统,你想用你自己的Launcher(Home)作主界面来替换Android自带的Home,而且不希望用户安装的Launcher来替换掉你的Launcher,应该如何来实现呢?

我们可以通过修改Framework层来实现这样的功能。

1) 首先了解一下Android的启动过程。

Android系统的启动先从Zygote开始启动,然后......(中间的过程就不说了).....一直到了SystemServer(framework)这个地方,看到这段代码:

/**
        * This method is called from Zygote to initialize the system. This will cause the native
        * services (SurfaceFlinger, AudioFlinger, etc..) to be started. After that it will call back
        * up into init2() to start the Android services.
        */

native public static void init1(String[] args);

        public static void main(String[] args) {
                if (SamplingProfilerIntegration.isEnabled()) {
                        SamplingProfilerIntegration.start();
                        timer = new Timer();
                        timer.schedule(new TimerTask() {
                                @Override
                                public void run() {
                                        SamplingProfilerIntegration.writeSnapshot("system_server");
                                }
                        }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL);
                }

                // The system server has to run all of the time, so it needs t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值