Android Init Language 安卓Init语言
--------------------- ---------------------
The Android Init Language consists of four broad classes of statements, 安卓Init语言包括4大类的声明,
which are Actions, Commands, Services, and Options. 它们是 Actions(动作),Commands(命令),Services(服务)和Options(选项)。
All of these are line-oriented, consisting of tokens separated by 所有这些都是面向行的,由空格分隔的标记
whitespace. The c-style backslash escapes may be used to insert 组成。C语言风格的反斜杠转义字符可以用来
whitespace into a token. Double quotes may also be used to prevent 为标记添加空格。双引号也可以被用来防止
whitespace from breaking text into multiple tokens. The backslash, 字符文本中的空格将其分隔成多个标记。反斜杠,
when it is the last character on a line, may be used for line-folding. 当它处于一行中的最后时,表示下面一行与本行处于同一行。
Lines which start with a # (leading whitespace allowed) are comments. 以‘#’开始(前边允许有空格)的行是注释行。
Actions and Services implicitly declare a new section. All commands Actions(动作)和Services(服务)隐式声明了一个新的段。所有commands(命令)
or options belong to the section most recently declared. Commands 或options(选项)属于最新声明的段。第一个段之前的Commands(命令)
or options before the first section are ignored. 或options(选项)被忽略。
Actions and Services have unique names. If a second Action or Service Actions(动作)和Services(服务)有唯一的名字。如果其后出现了相同的Actions(动作)
is declared with the same name as an existing one, it is ignored as 或 Services(服务)名,则被当成错误忽略掉。(??? 我们是否应该以覆盖机制来代替目
an error. (??? should we override instead) 前将其当作错误的处理)
Actions Actions(动作)
------- -------
Actions are named sequences of commands. Actions have a trigger which Actions(动作)是命令序列。Actions(动作)带有一个触发器,此触发器用来决定何时
is used to determine when the action should occur. When an event 动作应该发生。当一个匹配触发动作条件的事件
occurs which matches an action's trigger, that action is added to 发生时,此动作被添加到
the tail of a to-be-executed queue (unless it is already on the 一个待执行队列中(除非它已经在此队列中了)。
queue).
Each action in the queue is dequeued in sequence and each command in 待执行队列中的每个动作按序列出列并且该动作中的每个命令
that action is executed in sequence. Init handles other activities 顺次执行。Init处理其他活动
(device creation/destruction, property setting, process restarting) (设备创建/销毁,属性设置,进程重启)
"between" the execution of the commands in activities. 在处于活动的命令的执行之间。
Actions take the form of: Actions(动作)的格式如下:
on <trigger> on <trigger>
<command> <command>
<command> <command>
<command> <command>
-------- --------
Services are programs which init launches and (optionally) restarts Services(服务)是程序,供init登录以及当Services(服务)退出时(可选择地)重启。
when they exit. Services take the form of: Services(服务)的格式如下:
<option> <option>
<option> <option>
... ...
Options Options(选项)
------- -------
Options are modifiers to services. They affect how and when init Options(选项)是服务的调节器。他们影响如何以及何时
runs the service. 运行服务。