Service流程
来源:互联网 发布:诺基亚5310xm软件 编辑:程序博客网 时间:2024/05/17 21:48
Android 7.0版本
Service生命周期
标记service状态
bumpServiceExecutingLocked(ServiceRecord r, boolean fg, String why)\---bumpServiceExecutingLocked(r, execInFg, "create")@realStartServiceLocked\---bumpServiceExecutingLocked(r, execInFg, "start")@sendServiceArgsLocked(ServiceRecord r, boolean execInFg, boolean oomAdjusted)\---bumpServiceExecutingLocked(r, execInFg, "bind");@requestServiceBindingLocked(ServiceRecord r, IntentBindRecord i, boolean execInFg, boolean rebind)\---bumpServiceExecutingLocked(r, false, "bring down unbind")@bringDownServiceLocked(ServiceRecord r)\---bumpServiceExecutingLocked(s, false, "unbind")@removeConnectionLocked(ConnectionRecord c, ProcessRecord skipApp, ActivityRecord skipAct)\---bumpServiceExecutingLocked(r, false, "destroy")@bringDownServiceLocked(ServiceRecord r)
startService流程
startService(Intent service)@ContextImpl.java\---startServiceCommon(Intent service, UserHandle user)@ContextImpl.java \---startService(IApplicationThread caller, Intent service, String resolvedType, String callingPackage, int userId)@ActivityManagerProxy@ActivityManagerNative.java \---START_SERVICE_TRANSACTION@OnTransact@ActivityManagerNative \---startService(IApplicationThread caller, Intent service, String resolvedType, String callingPackage, int userId)@ActivityManagerService.java \---startServiceLocked(IApplicationThread caller, Intent service, String resolvedType, int callingPid, int callingUid, String callingPackage, final int userId)@ActiveServices.java \---startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r, boolean callerFg, boolean addToStarting)@ActiveServices.java \---bringUpServiceLocked(ServiceRecord r, int intentFlags, boolean execInFg, boolean whileRestarting, boolean permissionsReviewRequired)@ActiveServices.java \---realStartServiceLocked(ServiceRecord r, ProcessRecord app, boolean execInFg))@ActiveServices.java \---scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState)@ApplicationThreadProxy@ActivityManagerNative.java \---SCHEDULE_CREATE_SERVICE_TRANSACTION@OnTransact@ActivityManagerNative.java \---scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState)@ActivityThread.java \---CREATE_SERVICE@handleMessage@H@ActivityThread.java \---handleCreateService(CreateServiceData data)@ActivityThread.java \---service.onCreate() \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerProxy@ActivityManagerNative.java \---SERVICE_DONE_EXECUTING_TRANSACTION@OnTransact@ActivityManagerNative.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerService.java \---serviceDoneExecutingLocked(ServiceRecord r, int type, int startId, int res)@ActiveServices.java \---serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing)@ActiveServices.java
启动onStartCommand流程
onStartCommand
sendServiceArgsLocked(ServiceRecord r, boolean execInFg, boolean oomAdjusted)@ActiveServices.java\---scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, int flags, Intent args)@ApplicationThreadProxy@ApplicationThreadNative.java \---SCHEDULE_SERVICE_ARGS_TRANSACTION@OnTransact@ApplicationThreadNative.java \---scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, int flags ,Intent args)@ApplicationThread@ActivityThread.java \---SERVICE_ARGS@handleMessage@H@ActivityThread.java \---handleServiceArgs(ServiceArgsData data)@ActivityThread.java \---service.onStartCommand \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerProxy@ActivityManagerNative.java \---SERVICE_DONE_EXECUTING_TRANSACTION@OnTransact@ActivityManagerNative.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerService.java \---serviceDoneExecutingLocked(ServiceRecord r, int type, int startId, int res)@ActiveServices.java \---serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing)@ActiveServices.java
stopService流程
stopService(Intent service)@ContextImpl.java\---stopServiceCommon(Intent service, UserHandle user)@ContextImpl.java \---stopService(IApplicationThread caller, Intent service, String resolvedType, int userId)@ActivityManagerProxy@ActivityManagerNative.java \---STOP_SERVICE_TRANSACTION@onTransact@ActivityManagerNative.java \---stopService(IApplicationThread caller, Intent service, String resolvedType, int userId)@ActivityManagerService.java \---stopServiceLocked(IApplicationThread caller, Intent service, String resolvedType, int userId)@ActiveServices.java \---stopServiceLocked(ServiceRecord service)@ActiveServices.java \---bringDownServiceIfNeededLocked(ServiceRecord r, boolean knowConn, boolean hasConn)@ActiveServices.java \---bringDownServiceLocked(ServiceRecord r)@ActiveServices.java \---scheduleStopService(IBinder token)@ApplicationThreadProxy@ApplicationThreadNative.java \---SCHEDULE_STOP_SERVICE_TRANSACTION@onTransact@ApplicationThreadNative.java \---scheduleStopService(IBinder token)@ApplicationThread@ActivityThread.java \---STOP_SERVICE@handleMessage@H@ActivityThread.java \---handleStopService(IBinder token)@ActivityThread.java \---service.onDestroy() \---scheduleFinalCleanup(String who, String what)@ContextImpl.java \---scheduleContextCleanup(ContextImpl context, String who, String what)@ActivityThread.java \---CLEAN_UP_CONTEXT@handleMessage@H@ActivityThread.java \---performFinalCleanup(String who, String what)@ComtextImpl.java \---unregisterReceiver(IIntentReceiver receiver)---后面分析 \---unbindService(IServiceConnection connection)@ActivityManagerProxy@ActivityManagerNative.java \---UNBIND_SERVICE_TRANSACTION@onTransact@ActivityManagerNative.java \---unbindService(IServiceConnection connection)@ActivityManagerService.java \---unbindServiceLocked(IServiceConnection connection)@ActiveServices.java \---removeConnectionLocked( ConnectionRecord c, ProcessRecord skipApp, ActivityRecord skipAct)@ActiveServices.java \---scheduleUnbindService(IBinder token, Intent intent)ApplicationThreadProxy@ApplicationThreadNative.java \---SCHEDULE_UNBIND_SERVICE_TRANSACTION@onTransact@ApplicationThreadNative.java \---scheduleUnbindService(IBinder token, Intent intent)@ApplicationThread@ActivityThread.java \---UNBIND_SERVICE@handleMessage@H@ActivityThread.java \---handleUnbindService(BindServiceData data)@ActivityThread.java \---service.onUnbind() \---unbindFinished(IBinder token, Intent intent, boolean doRebind)@ActivityManagerProxy@ActivityManagerNative.java==doRebind==true \---UNBIND_FINISHED_TRANSACTION@onTransact@ActivityManagerNative.java \---unbindFinished(IBinder token, Intent intent, boolean doRebind)@ActivityManagerService.java \---unbindFinishedLocked(ServiceRecord r, Intent intent, boolean doRebind)@ActiveServices.java \---requestServiceBindingLocked(ServiceRecord r, IntentBindRecord i, boolean execInFg, boolean rebind)@ActiveServices.java \---重绑定服务,分析停止 \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerProxy@ActivityManagerNative.java==doRebind==false \---SERVICE_DONE_EXECUTING_TRANSACTION@OnTransact@ActivityManagerNative.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerService.java \---serviceDoneExecutingLocked(ServiceRecord r, int type, int startId, int res)@ActiveServices.java \---serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing)@ActiveServices.java
bindService流程
bindService(Intent service, ServiceConnection conn, int flags)@ContextImp.java\---bindServiceCommon(Intent service, ServiceConnection conn, int flags, Handler handler, UserHandle user)@ContextImp.java \---bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, String callingPackage, int userId)@ActivityManagerProxy@ActivityManagerNative.java \---BIND_SERVICE_TRANSACTION@onTransact@ActivityManagerNative.java \---bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, String callingPackage, int userId)@ActivityManagerService.java \---bindServiceLocked(IApplicationThread caller, IBinder token, Intent service, String resolvedType, final IServiceConnection connection, int flags, String callingPackage, final int userId)@ActiveServices.java 创建ConnectionRecord,准备建立连接 \---requestServiceBindingLocked(ServiceRecord r, IntentBindRecord i, boolean execInFg, boolean rebind)@ActiveServices.java \---scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState)@ApplicationThreadProxy@ApplicationThreadNative.java \---SCHEDULE_BIND_SERVICE_TRANSACTION@onTransact@ApplicationThreadNative.java \---scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState)@ApplicationThread@ActivityThread.java \---BIND_SERVICE@handleMessage@H@ActivityThread.java \---handleBindService(BindServiceData data)@ActivityThread.java \---service.onBind()----非rebind \---publishService(IBinder token, Intent intent, IBinder service)@ActivityManagerProxy@ActivityManagerNative.java \---PUBLISH_SERVICE_TRANSACTION@onTransact@ActivityManagerNative.java \---publishService(IBinder token, Intent intent, IBinder service)@ActivityManagerService.java \---publishServiceLocked(ServiceRecord r, Intent intent, IBinder service)@ActivieServices.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerProxy@ActivityManagerNative.java \---SERVICE_DONE_EXECUTING_TRANSACTION@OnTransact@ActivityManagerNative.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerService.java \---serviceDoneExecutingLocked(ServiceRecord r, int type, int startId, int res)@ActiveServices.java \---serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing)@ActiveServices.java
unbindService流程
unbindService(ServiceConnection conn)@ContextImpl.java\---unbindService(IServiceConnection connection)@ActivityManagerProxy@ActivityManagerNative.java ---UNBIND_SERVICE_TRANSACTION@onTransact@ActivityManagerNative.java \---unbindService(IServiceConnection connection)@ActivityManagerService.java \---unbindServiceLocked(IServiceConnection connection)@ActiveServices.java \---removeConnectionLocked(ConnectionRecord c, ProcessRecord skipApp, ActivityRecord skipAct)@ActiveServices.java \---scheduleUnbindService(IBinder token, Intent intent)ApplicationThreadProxy@ApplicationThreadNative.java \---SCHEDULE_UNBIND_SERVICE_TRANSACTION@onTransact@ApplicationThreadNative.java \---scheduleUnbindService(IBinder token, Intent intent)@ApplicationThread@ActivityThread.java \---UNBIND_SERVICE@handleMessage@H@ActivityThread.java \---handleUnbindService(BindServiceData data)@ActivityThread.java \---service.onUnbind() \---unbindFinished(IBinder token, Intent intent, boolean doRebind)@ActivityManagerProxy@ActivityManagerNative.java==doRebind==true \---UNBIND_FINISHED_TRANSACTION@onTransact@ActivityManagerNative.java \---unbindFinished(IBinder token, Intent intent, boolean doRebind)@ActivityManagerService.java \---unbindFinishedLocked(ServiceRecord r, Intent intent, boolean doRebind)@ActiveServices.java \---requestServiceBindingLocked(ServiceRecord r, IntentBindRecord i, boolean execInFg, boolean rebind)@ActiveServices.java \---重绑定服务,分析结束 \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerProxy@ActivityManagerNative.java==doRebind==false \---SERVICE_DONE_EXECUTING_TRANSACTION@OnTransact@ActivityManagerNative.java \---serviceDoneExecuting(IBinder token, int type, int startId, int res)@ActivityManagerService.java \---serviceDoneExecutingLocked(ServiceRecord r, int type, int startId, int res)@ActiveServices.java \---serviceDoneExecutingLocked(ServiceRecord r, boolean inDestroying, boolean finishing)@ActiveServices.java
阅读全文
0 0
- Service流程
- nova service执行流程
- Service 工作流程
- Service启动流程
- Service启动流程-startService
- Android启动Service流程
- Android Service 的添加流程
- 3.service的使用流程
- Service 启动和绑定流程
- 系统Service的启动流程
- Service 启动流程源码解析
- Android service启动流程分析.
- Service的启动流程分析
- service XXX restart的执行流程
- Web Service学习笔记(基本流程)
- Android之Service响应函数调用流程
- Android中Service的启动流程
- Android N中Service相关流程概述
- 判断101-200之间有多少个素数,并输出所有素数。
- hololens开发手记——Unity之语音输入
- JAVA中的static关键字
- 线程池
- JQuery 元素位置
- Service流程
- 在Node.js中实现文件复制的方法和实例
- contenteditable="true"的div事件处理
- 经典Prim算法题目及代码
- 机器学习深度学习基础笔记(4)——Backpropagation算法实现
- 安卓中MVC模式的深度思索和实践(三)
- linux环境高级编程之fork、getpid、getppid函数
- 关于jquery中toggle()方法的替换
- 六大数据采集工具