LauncherApplication app = ((LauncherApplication)getApplication()); mSharedPrefs = getSharedPreferences(LauncherApplication.getSharedPreferencesKey(), Context.MODE_PRIVATE); //获取launchermodel对象,封装了数据库操作等 mModel = app.setLauncher(this); //获取应用图标的缓存集合 mIconCache = app.getIconCache(...
在分析中,我们可以看到真正对应应用进程的不是Application而是ActivityThread。我们从实际的应用堆栈可以看到: NaiveStart.main() ZygoteInit.main ZygoteInit$MethodAndArgsCall.run Method.Invoke method.invokeNative ActivityThread.main() Looper.loop() ... 1. 2. 3. 4. 5. 6. 7. 每个应用程序都以ActivityThre...
查看Launcher的AndroidManifest.xml可以发现有一个Activity—com.android.launcher3.Launcher,action为"android.intent.action.MAIN",category为"android.intent.category.HOME",到这里Launcher就完成了启动。 源码路径:packages/apps/Launcher3/AndroidManifest.xml 代码语言:javascript 代码运行次数:0 复制Cloud Studio 代码...
getApplicationContext()); } else { try { return new MainThreadExecutor().submit(new Callable<LauncherAppState>() { @Override public LauncherAppState call() throws Exception { return LauncherAppState.getInstance(context); } }).get(); } catch (InterruptedException|ExecutionException e) { throw new...
调用方法传参时定义了 "com.android.server.SystemServer",由此后续在调用ZygoteInit.zygoteInit、RuntimeInit.applicationInit、findStaticMain等方法后,最终会调用com.android.server.SystemServer main()方法,省略以上过程我们直接进入主入口源码 //源码路径:frameworks/base/services/java/com/android/server/SystemServer...
<application><activityandroid:name=".ui.MainActivity"android:exported="true"android:launchMode="singleTask"><intent-filter><!-- 隐藏图标 --><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER"/><!-- 设置为 launcher --><categoryandroid:name=...
publicstaticfinalRunnablezygoteInit(inttargetSdkVersion,long[]disabledCompatChanges,String[]argv,ClassLoaderclassLoader){...RuntimeInit.commonInit();// 创建 Binder 线程池ZygoteInit.nativeZygoteInit();// 调用应用程序的 ActivityThread 的 main 函数returnRuntimeInit.applicationInit(targetSdkVersion,disabled...
<activityandroid:name="com.android.launcher3.Launcher"android:launchMode="singleTask"...<intent-filter>// 主函数<actionandroid:name="android.intent.action.MAIN"/>// 代表是home桌面应用<categoryandroid:name="android.intent.category.HOME"/></intent-filter>...</activity> ...
*@mTopAction: 则描述第一个被启动 Activity 组件的 Action,默认是 Intent.ACTION_MAIN. */if(mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction ==null) {returnfalse; }/** * 2. 创建 Launcher 所需要的 Intent */Intentintent=getHomeIntent();ActivityInfoaInfo=resolveActivityInfo(in...
从上代码静态分析图来看最开始是在System.main方法开始的,正好这个方法就是启动系统的一个入口,也就是在这个过程中启动了Launcher,找到调用的地方后,我们来看一下startHomeActivityLocked是怎么启动Launcher的,首先看一下源码: launcher07.png 我们看上面的3473行,获取Intent,再看3451行,如果不为空,则启动HomeActivity...