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

做电商网站前端用什么框架自助建站网站哪个好

做电商网站前端用什么框架,自助建站网站哪个好,用ps做网站广告图,微信网站需要一个域名要怎么做Android SystemServer创建和启动方式(基于Android13) SystemServer 简介 Android System Server是Android框架的核心组件,运行在system_server进程中,拥有system权限。它在Android系统中扮演重要角色,提供服务管理和通信。 system …

Android SystemServer创建和启动方式(基于Android13)

SystemServer 简介

Android System Server是Android框架的核心组件,运行在system_server进程中,拥有system权限。它在Android系统中扮演重要角色,提供服务管理和通信。

system          548    415 1 06:23:21 ?     00:11:21 system_server

SystemServer在Android系统中的位置如下

SystemServer服务提供者serviceManager

SystemServer利用ServiceManager来提供服务,类似于keystore,ServiceManager是一个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.*/@UnsupportedAppUsage@nullable 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.*/@UnsupportedAppUsage@nullable 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.cppsp<ServiceManager> manager = new ServiceManager(std::make_unique<Access>());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.wooajung.com/news/23058.html

相关文章:

  • 能够做代理的网站有哪些网络销售是干嘛的
  • 铜陵做网站的google seo是什么啊
  • 新上线网站如何做搜索引擎百度店铺注册
  • 上海公司企业网站怎么做长沙网站优化培训
  • 佛山新网站建设服务百度关键词数据
  • 有没有专做烘焙的网站网站流量查询工具
  • 农村电商网站有哪些网络营销模式有哪些类型
  • 网站开发公司tahmwlkj网络平台的推广方法
  • 网上兼职做论坛版主 网站编辑全网营销推广系统
  • 做一个网站的预算查权重工具
  • 如何管理手机网站首页一呼百应推广平台
  • 蓝色企业网站手机版织梦模板东莞海外网络推广
  • 广告设计教程黄山网站seo
  • 郑州网站优化软件哪里有软件培训班
  • 建网站建设的基本流程百度一下京东
  • 网站添加文章之后更新缓存访问网站就需要输入账号密码疫情最新情况 最新消息 全国
  • 微信问卷调查小程序怎么做windows优化大师收费吗
  • 网络营销课程设计总结小红书怎么做关键词排名优化
  • 网站建设 设计 优化 维护官方百度平台
  • 怎么用vs2008做网站站长之家素材
  • b2c中日外贸有哪些网站做的好公众号引流推广平台
  • 无烟锅网站规划与建设淘宝指数查询
  • 网站后台公告id修改免费发布信息不收费的网站
  • 互动营销型网站建设百姓网
  • 国外网站做问卷怎样推广自己的广告
  • 做微商自己建网站合适吗seo外包公司优化
  • 做网站拍幕布照是什么意思网络运营推广是做什么的
  • 哈尔滨建站公司模板网址申请注册
  • 建立网站的基本流程短视频推广app
  • 贵州桥梁集团建设有限公司网站安卓优化大师下载安装