Android之export,process

在清单文件中经常遇到export,process等关键字但是一直不知道他们是什么,有什么意义,经过查询资料才算搞懂。

export

Flag indicating whether the given application component is available to other applications. If false, it can only be accessed by applications with its same user id (which usually means only by code in its own package). If true, it can be invoked by external entities, though which ones can do so may be controlled through permissions. 

export是用来标记组件是否可以被其他应用程序访问,如果设为false,则表示只能被包内的代码,如果设为true,则可以被外部的实体调用。

The default value is false for activity, receiver, and service components that do not specify any intent filters; it is true for activity, receiver, and service components that do have intent filters (implying they expect to be invoked by others who do not know their particular component name) and for all content providers.

没有指定intent-filter的组件export默认值是false,指定了intent-filter,表明可以被其他程序调用,export默认为true。

process

Specify a specific process that the associated code is to run in. Use with the application tag (to supply a default process for all application components), or with the activity, receiver, service, or provider tag (to supply a specific icon for that component).

process属性指定了相关代码运行在那个进程。在application 标签指明这个属性表示所有组件运行在这个process里面,在相应组件加上process表示该组件运行在该process。

Application components are normally run in a single process that is created for the entire application. You can use this tag to modify where they run. If the process name begins with a ':' character, a new process private to that application will be created when needed to run that component (allowing you to spread your application across multiple processes). If the process name begins with a lower-case character, the component will be run in a global process of that name, provided that you have permission to do so, allowing multiple applications to share one process to reduce resource usage. 

应用程序组件在应用被创建时一般来说是运行在一个进程里面,我们可以指定这个属性去指定他们在哪里运行。如果指定process以“:”表示,说明应用程序会创建一个私有的进程运行在该组件上,如果以小写字母表示说明该组件会运行在相应process的全局的进程里,如果有权限允许,多个应用程序可以去共享使用一个进程,以节约资源。

上面的是官方的解释,我们在梳理一下:
默认情况下,Android应用程序时运行在一个进程下面的,它与应用程序包相同,我们可以通过指定process属性来指定某个组件运行在相应名字的进程中,其他应用程序的组件也可以运行在这个进程,他们共享linux的用户ID,拥有相同的证书,共享这个进程,访问彼此的数据。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值