让你自己编写的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