Android Service startService原理
2017-12-14 16:05:37 0 举报
Android startService 流程
作者其他创作
大纲/内容
ContextWrapper
H
sendServiceArgsLocked()
cl(classLoader)
ApplicationThread(inner)
application
startServiceCommon()
ContextImpl
scheduleCreateService()
onStartCommand()
startService()
sendMessage()
createAppContext()
handleMessage()
ActivityThread(AT)
LoadedApk
发送Message给Handler
AMN.getDefault()远程调用
newApplication()
AT # getPackageInfoNoCheck()
startServiceInnerLocked()
ApplicationThread extends ApplicationThreadNative(ATN) ;ATN extends Binder impls IApplicationThread
getClassLoader()
ActiveServices
AT # handleCreateService()
bringUpServiceLocked()
Service
ApplicationThread(inner) # scheduleServiceArgs()
loadedApk
AMS
反射得到service
realStartServiceLocked()
service # attach()需要的context
attach()
startServiceLocked()
onCreate()
handleServiceArgs()
0 条评论
下一页