Andrid FrameWork(五)

2023-04-15  本文已影响0人  Mr_不靠谱_先森

Android FrameWork (五)

Launcher


知识回顾:

ZygoteInit
Systemserver
binder


定义:

Android系统启动后,最后一个启动的桌面应用,一些地图、短信、电话等应用,launcher启动时由systemserver进行启动。

源码分析:

SystemServer.java
AMS: 开启launcher
ActivityTaskManagerService.java
RootActivityContainer.java:创建一个意图,拿到launcher这个activity
PMS:resolve

总结:

1,在system_service startOtherServices中调用AMS的systemRedy startHomeOnAllDisplays来根据intent(action:action_main,category:intent.categray_home )查找launcher

源码分析:

Launcher.java:

总结:

1,Launcher是由system_server启动的,在startOtherService 中调用了AMS的systenReady ActivityTaskManagerIntent.startHomeOnAllDisplays方法查找我们的launcher
2,Launcher中的onCreate函数来创建LauncherModel , 调用startLoader函数,创建LoadTask 去通过Binder访问到LauncherAppsService的qureyIntentActivitys函数查询
3,LoadTask 回调 onUpdateListener 调用到rebindAdapter对数据进行填充和绑定
4,viewHolder中创建设置点击事件 ItemClickHandler设置tag 为 AppInfo,点击事件中调用startAppShortCutInfoActivity

拓展知识:

1,开机动画是怎么进行加载和播放的?动画怎么退出?
bootanim.rc:
bootanimation_main.cpp:
总结:1,bootanimation_main.cpp:中创建BootAnimation并设置了回调AudioAnimationCallbacks,BootAnimation继承Thread,所以会先执行readyToRun,threadLoop。在readyToRun中创建serface设置纹理,在thread Loop函数中进行资源loadAnimation play Animation在播放的过程中不停的调用checkExit 进行检测,检测属性是 service.bootanim.exit 如果退出就会推出BootAnimation线程
2,在launcher创建完成后执行activityThread的handleResumeActivity会给MessageQueue中插一个idel,会调用都AcitivityTaskManager的activityIdel,执行postFinishBooting函数,调用WMS一个函数SystemProperties.set("service.bootanim.exit","1");将service.bootanim.exit 设置成1就退出了动画播放。

上一篇 下一篇

猜你喜欢

热点阅读