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

临海市建设规划局网站百赞小程序制作平台

临海市建设规划局网站,百赞小程序制作平台,外贸网站建设推广培训,哈尔滨雕塑制作厂家Android SystemServer创建和启动方式(基于Android13) SystemServer 简介 Android System Server是Android框架的核心组件#xff0c;运行在system_server进程中#xff0c;拥有system权限。它在Android系统中扮演重要角色#xff0c;提供服务管理和通信。 system …Android SystemServer创建和启动方式(基于Android13) SystemServer 简介 Android System Server是Android框架的核心组件运行在system_server进程中拥有system权限。它在Android系统中扮演重要角色提供服务管理和通信。 system 548 415 1 06:23:21 ? 00:11:21 system_serverSystemServer在Android系统中的位置如下 SystemServer服务提供者serviceManager SystemServer利用ServiceManager来提供服务类似于keystoreServiceManager是一个native service负责SystemServer中的service管理。SystemServer通过binder和ServiceManager进行通信。 ServiceManager由servicemanager.rc启动并且相关实现在ServiceManager提供的aidl接口中。 //frameworks/native/cmds/servicemanager/ service servicemanager /system/bin/servicemanagerclass core animationuser systemgroup system readproccriticalonrestart restart healthdonrestart restart zygoteonrestart restart audioserveronrestart restart mediaonrestart restart surfaceflingeronrestart restart inputflingeronrestart restart drmonrestart restart cameraserveronrestart restart keystoreonrestart restart gatekeeperdonrestart restart thermalservicewritepid /dev/cpuset/system-background/tasksshutdown critical这些接口位于frameworks/native/libs/binder/aidl/android/os/IServiceManager.aidl主要包括addService、getService、checkService以及一些权限的检查。 //frameworks/native/libs/binder/aidl/android/os/IServiceManager.aidl interface IServiceManager {/** Must update values in IServiceManager.h*//* Allows services to dump sections according to priorities. */const int DUMP_FLAG_PRIORITY_CRITICAL 1 0;const int DUMP_FLAG_PRIORITY_HIGH 1 1;const int DUMP_FLAG_PRIORITY_NORMAL 1 2;/*** Services are by default registered with a DEFAULT dump priority. DEFAULT priority has the* same priority as NORMAL priority but the services are not called with dump priority* arguments.*/const int DUMP_FLAG_PRIORITY_DEFAULT 1 3;const int DUMP_FLAG_PRIORITY_ALL 15;// DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PRIORITY_HIGH// | DUMP_FLAG_PRIORITY_NORMAL | DUMP_FLAG_PRIORITY_DEFAULT;/* Allows services to dump sections in protobuf format. */const int DUMP_FLAG_PROTO 1 4;/*** Retrieve an existing service called a name from the* service manager.** This is the same as checkService (returns immediately) but* exists for legacy purposes.** Returns null if the service does not exist.*/UnsupportedAppUsagenullable IBinder getService(utf8InCpp String name);/*** Retrieve an existing service called a name from the service* manager. Non-blocking. Returns null if the service does not* exist.*/UnsupportedAppUsagenullable IBinder checkService(utf8InCpp String name);/*** Place a new a service called a name into the service* manager.*/void addService(utf8InCpp String name, IBinder service,boolean allowIsolated, int dumpPriority);/*** Return a list of all currently running services.*/utf8InCpp String[] listServices(int dumpPriority);/*** Request a callback when a service is registered.*/void registerForNotifications(utf8InCpp String name, IServiceCallback callback);/*** Unregisters all requests for notifications for a specific callback.*/void unregisterForNotifications(utf8InCpp String name, IServiceCallback callback);/*** Returns whether a given interface is declared on the device, even if it* is not started yet. For instance, this could be a service declared in the VINTF* manifest.*/boolean isDeclared(utf8InCpp String name);/*** Request a callback when the number of clients of the service changes.* Used by LazyServiceRegistrar to dynamically stop services that have no clients.*/void registerClientCallback(utf8InCpp String name, IBinder service, IClientCallback callback);/*** Attempt to unregister and remove a service. Will fail if the service is still in use.*/void tryUnregisterService(utf8InCpp String name, IBinder service); }在servicemanager启动后它会注册一个特殊的service服务名叫做manager可以通过dumpsys -l命令找到名为manager的服务。 //frameworks/native/cmds/servicemanager/main.cppspServiceManager manager new ServiceManager(std::make_uniqueAccess());if (!manager-addService(manager, manager, false /*allowIsolated*/, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk()) {LOG(ERROR) Could not self register servicemanager;} 原生框架创建Service的几种方式 方式1 ServiceManager.addService ServiceManager.addService是最早的一种service创建方式函数原型为 public static void addService(String name, IBinder service) {addService(name, service, false, IServiceManager.DUMP_FLAG_PRIORITY_DEFAULT);}在早期的Android版本中ServiceManager.addService是最早的一种创建service的方式。它的函数原型为ServiceManager.addService由于存在于早期版本因此使用起来没有太多限制甚至在android_app中也可以使用。 方式2 SystemServiceManager.startService SystemServiceManager.startService有多个override方法接口定义如下 public void startService(NonNull final SystemService service) {// Register it.mServices.add(service);// Start it.long time SystemClock.elapsedRealtime();try {service.onStart();} catch (RuntimeException ex) {throw new RuntimeException(Failed to start service service.getClass().getName() : onStart threw an exception, ex);}warnIfTooLong(SystemClock.elapsedRealtime() - time, service, onStart);}SystemService类位于frameworks/base/services/core/java/com/android/server/SystemService.java最后打包到service.jar中。然而由于SystemService添加了注解直接依赖services.jar无法访问该类。 我们可以通过两种方式来使用SystemService 在frameworks/base/services内部源码中可以直接访问SystemService。在Android.bp中将模块声明为sdk_version: system_server_current也可以使用SystemService。 另外还可以通过依赖静态库services.core来访问SystemService例如Apex service就是使用这种方式。
http://www.zqtcl.cn/news/70764/

相关文章:

  • 国内主流网站开发技术网站开发合作合同范本
  • 服务器访问不了网站建设工程信息服务平台官网
  • 建立网站的连接结构有哪几种形式企业官网网站模板下载不了
  • 泸州公司做网站wordpress图片站教程
  • 免费申请网站空间和域名网页美工设计课程教案
  • 公司网站一般找哪个公司做怎么把网站扒下来
  • 制作网站的公司有哪些北京网络优化
  • 固原市建设局网站织梦手机网站如何调用
  • 怎么改网站标题顺义免费网站建设
  • django可以做多大的网站宁德做网站的公司
  • 福建省住房城乡建设厅网站广东省自然资源厅陈光荣
  • 信仰类型的企业网站网站访问量 显示代码
  • 地方门户网站的特点天元建设集团有限公司第四建筑工程公司
  • 建立个人网站代码dw做网站环境配置
  • 网站开发毕业设计源码美食网页制作代码
  • 雷州网站建设iis7 发布asp网站404
  • 自建免费网站哪个好字体不显示wordpress
  • 百度做网站电话多少钱建设银行网站怎么看交易记录
  • 北京网站开发公司电话亚马逊商标备案是否必须做网站
  • 文档共享网站建设怎么把做的网站优化到百度
  • icp备案网站更名品牌营销咨询公司
  • 如何做一份网站推广方案需要建设一个什么样的网站
  • 做平面哪个网站的素材最好aso关键词排名优化是什么
  • 家居网站应该怎么做企业网页设计方案
  • 网站推广宣传语深圳包装设计公司排名前十强
  • asp.net 网站发布乱码问题全网关键词云在哪里看
  • 怎么查网站是在哪里备案的嘉兴网站免费制作
  • 网站备案需要关闭网站吗张店网站制作设计公司
  • 图片渐隐 网站头部flash跨境电商平台有哪些推广方式
  • 商城网站的建设如何看到网站做哪些关键字