当前位置: 首页 > wzjs >正文

做网站编辑需要会什么安卓aso

做网站编辑需要会什么,安卓aso,wordpress 饼状图,深企在线文章目录 SystemServer、SystemServiceManger、SystemService、serviceManager的关系SystemServer进程的执行包含的ServiceSystemServer启动服务的流程startService Framework学习系列文章 SystemServer、SystemServiceManger、SystemService、serviceManager的关系 管理机制&a…

文章目录

  • SystemServer、SystemServiceManger、SystemService、serviceManager的关系
  • SystemServer进程的执行
    • 包含的Service
    • SystemServer启动服务的流程
      • startService
  • Framework学习系列文章

SystemServer、SystemServiceManger、SystemService、serviceManager的关系

在这里插入图片描述

  • 管理机制:SystemServer 通过 SystemServiceManager 管理所有实现了 SystemService 的服务。每个服务初始化后会将自身注册到 ServiceManager,以实现跨进程调用 。
  • SystemServer 进程:它是一个包含众多服务的进程,像常见的 AMS(Activity Manager Service,活动管理器服务 )、PKMS(Package Manager Service,包管理器服务 )、WMS(Window Manager Service,窗口管理器服务 )等,大概有 80 多个。
  • SystemServiceManager 作用:专门用于管理 SystemServer 中的服务,这些服务基本都实现了 SystemService 类,使得 SystemServiceManager 能够对其进行管理 。
  • App 调用方式:当 App 需要调用 systemService 时,在 SystemServer 启动 AMS、WMS、PKMS 等服务时,会将它们添加到 ServiceManager 中,供外部 app 进程调用。ServiceManager 是独立进程,负责管理服务列表。
    在这里插入图片描述

SystemServer进程的执行

在这里插入图片描述
frameworks/base/services/java/com/android/server/SystemServer.java

    /*** The main entry point from zygote.*/public static void main(String[] args) {new SystemServer().run();}private void run() {...// Initialize native services.System.loadLibrary("android_servers");...// Initialize the system context.createSystemContext();// Call per-process mainline module initialization.ActivityThread.initializeMainlineModules();// Create the system service manager.mSystemServiceManager = new SystemServiceManager(mSystemContext);...// Start services.try {t.traceBegin("StartServices");startBootstrapServices(t);startCoreServices(t);startOtherServices(t);startApexServices(t);} catch (Throwable ex) {Slog.e("System", "******************************************");Slog.e("System", "************ Failure starting system services", ex);throw ex;} finally {t.traceEnd(); // StartServices}}

包含的Service

在这里插入图片描述
startBootstrapServices

    /*** Starts the small tangle of critical services that are needed to get the system off the* ground.  These services have complex mutual dependencies which is why we initialize them all* in one place here.  Unless your service is also entwined in these dependencies, it should be* initialized in one of the other functions.*/private void startBootstrapServices(@NonNull TimingsTraceAndSlog t) {....// FileIntegrityService responds to requests from apps and the system. It needs to run after// the source (i.e. keystore) is ready, and before the apps (or the first customer in the// system) run.mSystemServiceManager.startService(FileIntegrityService.class);// Wait for installd to finish starting up so that it has a chance to// create critical directories such as /data/user with the appropriate// permissions.  We need this to complete before we initialize other services.Installer installer = mSystemServiceManager.startService(Installer.class);// In some cases after launching an app we need to access device identifiers,// therefore register the device identifier policy before the activity manager.mSystemServiceManager.startService(DeviceIdentifiersPolicyService.class);// Uri Grants Manager.mSystemServiceManager.startService(UriGrantsManagerService.Lifecycle.class);// Tracks rail data to be used for power statistics.mSystemServiceManager.startService(PowerStatsService.class);...}

startCoreServices

    /*** Starts some essential services that are not tangled up in the bootstrap process.*/private void startCoreServices(@NonNull TimingsTraceAndSlog t) {t.traceBegin("startCoreServices");// Service for system configt.traceBegin("StartSystemConfigService");mSystemServiceManager.startService(SystemConfigService.class);t.traceEnd();t.traceBegin("StartBatteryService");// Tracks the battery level.  Requires LightService.mSystemServiceManager.startService(BatteryService.class);t.traceEnd();// Tracks application usage stats.t.traceBegin("StartUsageService");mSystemServiceManager.startService(UsageStatsService.class);mActivityManagerService.setUsageStatsManager(LocalServices.getService(UsageStatsManagerInternal.class));t.traceEnd();// Tracks whether the updatable WebView is in a ready state and watches for update installs.if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_WEBVIEW)) {t.traceBegin("StartWebViewUpdateService");mWebViewUpdateService = mSystemServiceManager.startService(WebViewUpdateService.class);t.traceEnd();}// Tracks and caches the device state.t.traceBegin("StartCachedDeviceStateService");mSystemServiceManager.startService(CachedDeviceStateService.class);t.traceEnd();// Tracks cpu time spent in binder callst.traceBegin("StartBinderCallsStatsService");mSystemServiceManager.startService(BinderCallsStatsService.LifeCycle.class);t.traceEnd();...}

在这里插入图片描述
在这里插入图片描述

    /*** Starts a miscellaneous grab bag of stuff that has yet to be refactored and organized.*/private void startOtherServices(@NonNull TimingsTraceAndSlog t) {...ServiceManager.addService("sec_key_att_app_id_provider",new KeyAttestationApplicationIdProviderService(context));t.traceEnd();t.traceBegin("StartKeyChainSystemService");mSystemServiceManager.startService(KeyChainSystemService.class);t.traceEnd();t.traceBegin("StartBinaryTransparencyService");mSystemServiceManager.startService(BinaryTransparencyService.class);t.traceEnd();t.traceBegin("StartSchedulingPolicyService");ServiceManager.addService("scheduling_policy", new SchedulingPolicyService());t.traceEnd();// TelecomLoader hooks into classes with defined HFP logic,// so check for either telephony or microphone.if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)|| mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELECOM)|| mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {t.traceBegin("StartTelecomLoaderService");mSystemServiceManager.startService(TelecomLoaderService.class);t.traceEnd();}t.traceBegin("StartTelephonyRegistry");telephonyRegistry = new TelephonyRegistry(context, new TelephonyRegistry.ConfigurationProvider());ServiceManager.addService("telephony.registry", telephonyRegistry);t.traceEnd();t.traceBegin("StartEntropyMixer");mEntropyMixer = new EntropyMixer(context);t.traceEnd();mContentResolver = context.getContentResolver();// The AccountManager must come before the ContentServicet.traceBegin("StartAccountManagerService");mSystemServiceManager.startService(ACCOUNT_SERVICE_CLASS);t.traceEnd();...}

安卓13中,手动查询SystemServer中的service数量,如下有183个:

cat frameworks/base/services/java/com/android/server/SystemServer.java | grep startService | wc -l
183

SystemServer启动服务的流程

在这里插入图片描述

startService

所有的服务都是通过这个函数启动的

  1. getConstructor是调的反射进行service构造
    在这里插入图片描述
  2. service创建后,会调用publishBinderService把它注册到serviceManager中
    在这里插入图片描述
  3. 通过addService把service添加到sLocalServiceObjects中
    在这里插入图片描述

startService的流程:
在这里插入图片描述
startServicer用反射:方便扩展及管理,不然90个service就要实现90种创建的接口。
publishBinderService:注册到serviceManager中,由它统一管理。
addService到LocalServices: 方便Framework层平级的调用。

上层调用service,是通过binder来访问其中功能的,如下图,具体可以参照另外一篇binder的文章
在这里插入图片描述

Framework学习系列文章

Android Framework学习一:系统框架、启动过程
Android Framework学习二:Activity创建及View绘制流程
Android Framework学习三:zygote
Android Framework学习四:APP速度优化
Android Framework学习五:APP启动过程原理及速度优化
Android Framework学习六:Binder原理
Android Framework学习七:Handler、Looper、Message
Android Framework学习八:SystemServer及startService原理
作者:帅得不敢出门

http://www.dtcms.com/wzjs/785418.html

相关文章:

  • 呼和浩特商城网站建设广告公司企业简介
  • python做调查问卷网站单机怎么做网站
  • 优质专业建设申报网站wordpress 上传excel
  • 兰州seo网站建设校园网站的建设作用
  • 重庆网站制作公司电话soho个人可以建网站吗
  • 学做网站论坛vip学员码开网店哪些平台不收费
  • 做网站带微好吗wordpress实现mp4播放器
  • 西宁哪家网络公司做网站好优秀网站建设报价
  • 网站备案与域名备案宝塔面板 wordpress
  • 网站怎么做微信支付宝支付网站开发有哪些常用工具
  • 大同网站建设银川网站建设
  • 网站如何进行网络推广行业网站需要如何做
  • 广东建设工程信息网站wordpress加黑字体
  • 做网站不备案江苏专业网站建设公司电话
  • 小学生信息科学做网站青岛网站建设莫道网络
  • dw做的网站怎么发布山西seo推广系统
  • 手机网站设计立找亿企邦discuz 做论坛与网站
  • 门户网站建设开发制作网站的花多少钱
  • 国外免费网站服务器开发网站现实网络传输失败
  • 外贸网络营销如何做南宁网站排名优化电话
  • 来年做啥网站能致富wordpress取分类名称
  • 淄博网站定制万网域名查询ip
  • 买机票便宜网站建设线上宣传有哪些好的方式方法
  • 网站建设及优化的策划书深圳市凡客创品科技有限公司
  • 南山区公司网站制作网站建设方案风险分析
  • 学用mvc做网站建设手机网站多少钱
  • 手机端网站尺寸规范网站开发需要什么软件
  • 下列关于网站制作的邢台交友
  • 各种网站程序的优势容桂网站建设原创
  • 魔客吧是什麼程序做的网站品牌网站建设方