Docs: Changes to source.android.com
- 181204744 Devsite localized content from translation request b4bd44... by Android Partner Docs <[email protected]>
- 181204738 Devsite localized content from translation request 6e2e74... by Android Partner Docs <[email protected]>
- 181204731 Devsite localized content from translation request c6da36... by Android Partner Docs <[email protected]>
- 181184337 Adding nav for vndk build system support file (includes v... by Heidi von Markham <[email protected]>
- 181184012 Add details on enabling vndk for a partner codebase. by Heidi von Markham <[email protected]>
- 181181304 Drop path prefix "platform/" in human readable reference ... by Android Partner Docs <[email protected]>
- 180959465 Update public documentation around versions of OpenJDK bu... by Android Partner Docs <[email protected]>
- 180959038 Update home page with Jan 2018 bulletins by Danielle Roberts <[email protected]>
- 180944987 Update january 2018 bulletin with AOSP links by Danielle Roberts <[email protected]>
- 180939327 Devsite localized content from translation request 9d7ae6... by Android Partner Docs <[email protected]>
- 180939213 Devsite localized content from translation request 761984... by Android Partner Docs <[email protected]>
- 180939203 Devsite localized content from translation request 37ad64... by Android Partner Docs <[email protected]>
- 180813220 Devsite localized content from translation request 45f650... by Android Partner Docs <[email protected]>
- 180813011 Devsite localized content from translation request 7a3ee2... by Android Partner Docs <[email protected]>
- 180813003 Devsite localized content from translation request 52d1dd... by Android Partner Docs <[email protected]>
- 180721815 Update Jan 2018 bulletin with announcement about CVE-2017... by Danielle Roberts <[email protected]>
- 180718550 Update to January 2018 bulletin for coordinated disclosure by Danielle Roberts <[email protected]>
- 180689483 Devsite localized content from translation request 015eda... by Android Partner Docs <[email protected]>
- 180689471 Devsite localized content from translation request 86e026... by Android Partner Docs <[email protected]>
- 180688614 Added note about requirement to restart the audioserver by Android Partner Docs <[email protected]>
- 180681938 Add tags for January Security Release. by Android Partner Docs <[email protected]>
- 180580440 Publish Dec 2017 Pixel bulletins by Danielle Roberts <[email protected]>
- 180574446 Clarify OTA updates instructions in FBE docs by Danielle Roberts <[email protected]>
- 180566242 Update researcher acknowledgement for CVE-2017-13221 by Danielle Roberts <[email protected]>
- 180562297 January 2018 Pixel and Android Security bulletins by Danielle Roberts <[email protected]>
- 180562227 Devsite localized content from translation request a4ca37... by Android Partner Docs <[email protected]>
- 180562222 Devsite localized content from translation request f65459... by Android Partner Docs <[email protected]>
- 180561535 Devsite localized content from translation request 881cd3... by Android Partner Docs <[email protected]>
- 180561527 Devsite localized content from translation request 51b684... by Android Partner Docs <[email protected]>
- 180561524 Devsite localized content from translation request 226f2c... by Android Partner Docs <[email protected]>
- 180560907 Devsite localized content from translation request 9b462a... by Android Partner Docs <[email protected]>
- 180560904 Devsite localized content from translation request 1e3945... by Android Partner Docs <[email protected]>
- 180560895 Devsite localized content from translation request 60fa89... by Android Partner Docs <[email protected]>
- 180560177 Devsite localized content from translation request 9f6556... by Android Partner Docs <[email protected]>
- 180560173 Devsite localized content from translation request 37eb85... by Android Partner Docs <[email protected]>
- 180560169 Devsite localized content from translation request abf551... by Android Partner Docs <[email protected]>
- 180214623 Devsite localized content from translation request 69a1b1... by Android Partner Docs <[email protected]>
- 180214622 Devsite localized content from translation request abe464... by Android Partner Docs <[email protected]>
- 180214009 Devsite localized content from translation request 1c13f2... by Android Partner Docs <[email protected]>
- 180214006 Devsite localized content from translation request 9237e3... by Android Partner Docs <[email protected]>
- 180214003 Devsite localized content from translation request 1116f7... by Android Partner Docs <[email protected]>
- 179974666 Devsite localized content from translation request afb4de... by Android Partner Docs <[email protected]>
- 179932481 Devsite localized content from translation request 499773... by Android Partner Docs <[email protected]>
- 179932464 Devsite localized content from translation request 6bcb66... by Android Partner Docs <[email protected]>
- 179932462 Devsite localized content from translation request 6c13a3... by Android Partner Docs <[email protected]>
- 179931339 Correct out of place punctuation by Danielle Roberts <[email protected]>
- 179874281 Add libFuzzer docs to SAC. by Danielle Roberts <[email protected]>
- 179859323 Exclude compatibility/source from localization by Danielle Roberts <[email protected]>
- 179836094 Devsite localized content from translation request 3dae55... by Android Partner Docs <[email protected]>
- 179835757 Devsite localized content from translation request 76210b... by Android Partner Docs <[email protected]>
- 179835692 Devsite localized content from translation request eab645... by Android Partner Docs <[email protected]>
- 179835686 Devsite localized content from translation request 23e94d... by Android Partner Docs <[email protected]>
- 179778362 Devsite localized content from translation request 6406f2... by Android Partner Docs <[email protected]>
- 179688064 Devsite localized content from translation request 713535... by Android Partner Docs <[email protected]>
- 179622714 Add information about where to find OTA logs for both A/B... by Christina Nguyen <[email protected]>
- 179617573 Incorporate CDD source assets in google3 to allow buildin... by Clay Murphy <[email protected]>
PiperOrigin-RevId: 181204744
Change-Id: If0130be7bf5d5544f5b0ddda0977243b884b9943
diff --git a/zh-cn/devices/tech/settings/info-architecture.html b/zh-cn/devices/tech/settings/info-architecture.html
new file mode 100644
index 0000000..6deb57e
--- /dev/null
+++ b/zh-cn/devices/tech/settings/info-architecture.html
@@ -0,0 +1,224 @@
+<html devsite><head>
+ <title>已更新的信息架构</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>
+Android 8.0 为“设置”应用引入了全新的信息架构。新信息架构的目标是简化设置的整理方式,便于用户快速查找自定义 Android 设备所需的设置。
+</p>
+
+<h2 id="examples-and-source">示例和源代码</h2>
+
+<p>
+“设置”中的大多数页面目前都是使用新框架实现的。一个很好的例子是 DisplaySettings:<code>packages/apps/Settings/src/com/android/settings/DisplaySettings.java</code>
+</p>
+
+<p>
+重要组件的文件路径如下所示:
+</p>
+
+<h3 id="categorykey">CategoryKey</h3>
+
+<code>packages/SettingsLib/src/com/android/settingslib/drawer/CategoryKey.java</code>
+
+<h3 id="dashboardfragmentregistry">DashboardFragmentRegistry</h3>
+
+<code>packages/apps/Settings/src/com/android/settings/dashboard/DashboardFragmentRegistry.java</code>
+
+<h3 id="dashboardfragment">DashboardFragment</h3>
+
+<code>packages/apps/Settings/src/com/android/settings/dashboard/DashboardFragment.java</code>
+
+<h3 id="preferencecontrollers">AbstractPreferenceController 和 PreferenceController</h3>
+
+<code>frameworks/base/packages/SettingsLib/src/com/android/settingslib/core/AbstractPreferenceController.java</code>
+
+<code>packages/apps/Settings/src/com/android/settings/core/PreferenceController.java</code>
+
+<h2 id="implementation">实现</h2>
+
+<p>
+建议设备制造商调整现有的“设置”信息架构,并根据需要插入其他设置页面以适应合作伙伴的特定功能。将偏好设置从旧页面(实现为 SettingsPreferencePage)移到新页面(使用 DashboardFragment 实现)可能很复杂。旧页面的偏好设置在实现时可能没有创建 PreferenceController。
+</p>
+
+<p>
+因此将偏好设置移到 DashboardFragment 中时,合作伙伴需要创建一个 PreferenceController,并且先将代码移到控制器中,然后在新的 DashboardFragment 中对偏好设置实例化。重构过程相当简单,因为大部分操作只是移动现有代码。
+</p>
+
+<p>
+完成重构后,原始设备制造商 (OEM) 应提交带有测试的补丁程序 CL 以将其更改合并到上游。
+</p>
+
+<h3 id="plugin">插件样式信息架构</h3>
+
+<p>
+每个设置项都作为偏好设置进行实现。可以轻松地将偏好设置从一个页面移到另一个页面。
+</p>
+
+<p>
+为了方便移动多个设置,Android O 引入了包含设置项的插件样式托管方片段。设置项被建模为插件样式控制器。因此,设置页面由单个托管方片段和多个设置控制器构成。
+</p>
+
+<h3 id="dashboard-fragment">DashboardFragment</h3>
+
+<p>
+这是插件样式偏好设置控制器的托管方。该片段继承自 PreferenceFragment,并具有用于放大和更新静态偏好设置列表与动态偏好设置列表的钩子。
+</p>
+
+<h3 id="static-preferences">静态偏好设置</h3>
+
+<p>
+静态偏好设置列表在 XML 中使用<preference>
+标记定义。DashboardFragment 实现使用 getPreferenceScreenResId() 方法来定义哪个 XML 文件包含要显示的偏好设置静态列表。
+</preference></p>
+
+<h3 id="dynamic-preferences">动态偏好设置</h3>
+
+<p>
+动态项表示具有 intent 的图块,会引向外部或内部 Activity。通常,intent 会引向不同的设置页面。例如,“设置”首页中的“Google”设置项就是一个动态项。动态项在 AndroidManifest 中定义(参见下文),并通过 FeatureProvider(定义为 DashboardFeatureProvider)加载。
+</p>
+
+<p>
+请注意,动态设置的负载高于静态配置的设置,因此通常开发者应将设置实现为静态设置。但是,在以下任一情况下,动态设置非常有用:
+</p>
+
+<ul>
+<li>设置未在“设置”应用中直接实现(例如,注入由 OEM/运营商应用实现的设置)。</li>
+<li>设置应显示在“设置”首页上。</li>
+<li>您已具有设置的 Activity,不想要实现额外的静态配置。</li>
+</ul>
+
+<p>
+要将 Activity 配置为动态设置,您需要执行以下操作:
+</p>
+
+<ul>
+<li>将该 Activity 标记为动态设置。为此,只需将 intent 过滤器添加到该 Activity 即可。</li>
+<li>告诉“设置”应用其所属的类别。该类别是在 <strong>CategoryKey</strong> 中定义的常量。</li>
+<li>可选:显示设置时,添加总结文本。</li>
+</ul>
+
+<p>
+以下是从“设置”应用的 DisplaySettings 中摘取的示例。
+</p>
+
+<pre class="prettyprint">
+<activity android:name="Settings$DisplaySettingsActivity"
+ android:label="@string/display_settings"
+ android:icon="@drawable/ic_settings_display">
+ <!-- Mark the activity as a dynamic setting -->
+ <intent-filter>
+ <action android:name="com.android.settings.action.IA_SETTINGS" />
+ </intent-filter>
+ <!-- Tell Settings app which category it belongs to -->
+ <meta-data android:name="com.android.settings.category"
+ android:value="com.android.settings.category.ia.homepage" />
+ <!-- Add a summary text when the setting is displayed -->
+ <meta-data android:name="com.android.settings.summary"
+ android:resource="@string/display_dashboard_summary"/>
+ </activity>
+</pre>
+
+<p>
+在呈现时,片段将请求在 AndroidManifest 中定义的静态 XML 和动态设置偏好设置列表。无论在哪个来源中加载设置,DashboardFragment 都通过 PreferenceController 管理每个设置的处理逻辑(参见下文)。<strong></strong>然后,它们将以混合列表的形式显示在界面上。
+</p>
+
+<h3 id="preference-controller">PreferenceController</h3>
+
+<p>
+PreferenceController 包含与偏好设置互动的所有逻辑,包括显示/更新/编入搜索索引等。
+</p>
+
+<p>
+相应地,PreferenceController 的接口具有 isAvailable()、displayPreference()、handlePreferenceTreeClicked() 等的 API。有关每个 API 的详细文档可以在相应接口类中找到。
+</p>
+
+<p>
+在为片段安装偏好设置时,信息中心会提供一种在显示之前附加 PreferenceController 的方法。在安装时,控制器将连接到片段,以便将来的所有相关事件均发送到控制器。
+</p>
+
+<p>
+DashboardFragment 将在屏幕中保留 PreferenceController 的列表。在片段的 onCreate() 中,将为 isAvailable() 方法调用所有控制器,如果其返回 true,将调用 displayPreference() 来处理显示逻辑。
+</p>
+
+<h2 id="using-dashboardfragment">使用 DashboardFragment</h2>
+
+<h3 id="moving-preference">将偏好设置从页面 A 移到页面 B</h3>
+
+<p>
+如果偏好设置静态地列在原始页面的偏好设置 XML 文件中,请遵循下面的<strong>静态</strong>路径。否则,请遵循<strong>动态</strong>路径。
+</p>
+
+<h4 id="static-move">静态</h4>
+
+<ol>
+<li>查找原始页面和目标页面的偏好设置 XML 文件。</li>您可以从页面的 getPreferenceScreenResId() 方法中找到此信息。
+<li>移除原始页面的 XML 中的偏好设置。</li>
+<li>将偏好设置添加到目标页面的 XML 中。</li>
+<li>在原始页面的 Java 实现中移除此偏好设置的 PreferenceController。通常它在 getPreferenceController() 中。</li>
+<strong>注意</strong>:偏好设置可能没有 PreferenceController。
+<li>在目标页面的 getPreferenceController() 中实例化 PreferenceController。</li>
+</ol>
+
+<h4 id="dynamic-move">动态</h4>
+
+<ol>
+<li>查找原始页面和目标页面托管的类别。您可以在 <code>DashboardFragmentRegistry</code> 中找到此信息。</li>
+<li>打开包含您需要移动的设置的 <code>AndroidManifest.xml</code> 文件,并找到表示此设置的 Activity 条目。</li>
+<li>更改该 Activity 的“com.android.settings.category”元数据值,将值设置为新页面的类别键。</li>
+</ol>
+
+<h3 id="creating-a-new-preference">在页面中创建新的偏好设置</h3>
+
+<p>
+如果偏好设置静态地列在原始页面的偏好设置 XML 文件中,请遵循下面的<strong>静态</strong>路径。否则,请遵循<strong>动态</strong>路径。
+</p>
+
+<h4 id="static-create">静态</h4>
+
+<ol>
+<li>找到页面的偏好设置 XML 文件。您可以从页面的 getPreferenceScreenResId() 方法中找到此信息。</li>
+<li>在 XML 中添加一个新的偏好设置项。确保其具有独特的 android:key。</li>
+<li>在页面的 getPreferenceControllers() 方法中为此偏好设置实例化一个 PreferenceController。</li>如果该偏好设置已存在于其他地方,则表示其可能已具有 PreferenceController。您可以重新使用该 PreferenceController,无需构建新的 PreferenceController。
+</ol>
+
+<h4 id="dynamic-create">动态</h4>
+
+<ol>
+<li>查找原始页面和目标页面托管的类别。您可以在 <code>DashboardFragmentRegistry</code> 中找到此信息。</li>
+<li>在 AndroidManifest 中创建一个新的 Activity,并添加必要的元数据来定义设置。将“com.android.settings.category”的元数据值设置为与第 1 步中定义的值相同。</li>
+</ol>
+
+<h3 id="create-new-page">新建页面</h3>
+<ol>
+<li>创建一个继承自 DashboardFragment 的新片段。</li>
+<li>在 <code>DashboardFragmentRegistry</code> 中定义其类别。
+<p class="note"><strong>注意</strong>:此步骤是可选的。如果您在此页面中不需要任何动态偏好设置,则不需要提供类别键。</p></li>
+<li>遵循添加此页面所需设置的步骤进行操作。</li>
+</ol>
+
+<h2 id="validation">验证</h2>
+
+<ul>
+<li>在“设置”中运行 robolectric 测试,所有现有测试和新测试都应通过。
+</li><li>编译并安装“设置”,手动打开正在被修改的页面;该页面应立即更新。</li>
+</ul>
+
+</body></html>
\ No newline at end of file
diff --git a/zh-cn/devices/tech/settings/patterns-components.html b/zh-cn/devices/tech/settings/patterns-components.html
new file mode 100644
index 0000000..c57937a
--- /dev/null
+++ b/zh-cn/devices/tech/settings/patterns-components.html
@@ -0,0 +1,131 @@
+<html devsite><head>
+ <title>格式和组件</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>
+在 Android 8.0 中,“设置”菜单中增加了一些能够涵盖常见使用情况的组件和微件。我们鼓励设备制造商和开发者在扩展“设置”应用时使用常用组件,以便新界面与现有的“设置”界面保持一致。
+</p>
+
+<p>
+以下是改进摘要:
+</p>
+
+<ul>
+<li>支持库偏好设置框架中的分隔线行为变化。现在,分隔线绘制在类别之间。</li>
+<li>ActionBar 主题背景变化。现在,ActionBar 使用浅色主题背景,且带有强调色文本。</li>
+<li>新的偏好设置布局。图标空间仍然存在,即使偏好设置没有图标时也是如此。</li>
+</ul>
+
+<p>
+新的微件:
+</p>
+
+<ul>
+<li>应用详细信息的标头微件。显示应用图标、应用标签等信息。</li>
+<li>某些页面上具有展开按钮。页面在打开时可以是收起形式,隐藏不太重要的项目,直到用户点击展开按钮。</li>
+<li>默认应用选择器界面:
+ <ul>
+ <li>该界面用于选择默认浏览器、默认手机应用等。</li>
+ <li>以前是一个对话框,现在是一个基于单选按钮的全屏界面。</li>
+ </ul>
+</li><li>“MasterSwitch”样式偏好设置。这是具有两个点击目标的偏好设置。左侧目标会导致子集化的片段或 intent。右侧目标是一个切换开关,针对整个页面控制开启/关闭。</li>
+</ul>
+
+<h2 id="examples-and-source">示例和源代码</h2>
+<ul>
+<li>分隔线行为
+ <ul>
+ <li>“设置”中的所有页面均经过修改以使用新的分隔线行为。</li>
+ <li>分隔线行为在以下文件中定义为一个 ThemeOverlay:<br />
+<code>packages/apps/Settings/res/values/styles_preference.xml</code></li>
+ </ul>
+</li>
+<li>ActionBar 主题背景变化
+ <ul>
+ <li>“设置”中的所有页面均经过修改以使用新的 ActionBar 主题背景。</li>
+ <li>主题背景在 Theme.DeviceDefault.Settings 中进行定义</li>
+ </ul>
+</li>
+<li>新的偏好设置布局
+ <ul>
+ <li>现在,“设置”中的许多页面都使用新的偏好设置布局。</li>
+ <li>您可以在以下位置找到代码:<br />
+<code>packages/apps/Settings/res/values/styles_preference.xml</code></li>
+ </ul>
+</li>
+<li>应用标头微件
+ <ul>
+ <li>“设置”中的大多数应用信息页面都已实现新的应用标头。</li>
+ <li>相关示例和代码可以在以下位置找到:<br />
+<code>packages/apps/Settings/src/com/android/settings/applications/AppHeaderController.java</code></li>
+ </ul>
+</li>
+<li>展开按钮
+ <ul>
+ <li>相关示例和代码可以在以下位置找到:<br />
+<code>packages/apps/Settings/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java</code>
+<p class="note"><strong>注意</strong>:此组件必须与 DashboardFragment 一起使用。(请在<a href="information-architecture.html">已更新的信息架构</a>中查看有关 DashboardFragment 的更多详情。)</p>
+ </li>
+ </ul>
+</li><li>默认应用选择器
+ <ul>
+ <li>您可以在以下位置找到基类的代码:<br />
+<code>packages/apps/Settings/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java</code> </li>
+ <li>DefaultAppPickerFragment 有多个子类,每个子类均实现一个选择器用于不同的 intent。</li>
+ </ul>
+</li>
+<li>MasterSwitch 样式偏好设置<em></em>
+ <ul>
+ <li>代码位于以下位置:<code>packages/apps/Settings/src/com/android/settings/widget/MasterSwitchPreference.java</code></li>
+ <li>WLAN 主开关就是一个示例用例。您可以在以下位置找到示例:<code>packages/apps/Settings/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java</code></li>
+ </ul>
+</li>
+</ul>
+
+<h2 id="implementation">实现</h2>
+
+<p>
+设备制造商可以开始使用所有新的组件,无需额外设置。如果原始设备制造商 (OEM) 决定实现新的“MasterSwitch”样式偏好设置或默认应用选择器,则应查看本文档中的示例以及为每个组件编写的参考文件 (Javadoc),以获取更多详细信息。
+</p>
+
+<h2 id="customizing">自定义</h2>
+
+<ul>
+<li>分隔线行为。要更改分隔线的绘制方式,请更新“设置”分隔线的样式并更改以下各项的值:
+ <ul>
+ <li>allowDividerAbove</li>
+ <li>allowDividerBelow</li>
+ <li>allowDividerAfterLastItem</li>
+ </ul>
+</li>
+<li>ActionBar 主题背景颜色。Activity 应使用 <code>Theme.DeviceDefault.Settings</code> 作为其主题背景,或使用 <code>Theme.DeviceDefault.Settings</code> 作为父级来创建自定义主题背景。
+</li>
+<li>应用标头微件。在 AppHeaderController 中使用设置器来自定义每个字段,并在设置所有字段后调用 build()。
+</li>
+<li>展开按钮:
+ <ul>
+ <li>要完全停用该功能,请替换 ProgressiveDisclosureMixin 的构造函数,并将 keepExpanded 设为 true。</li>
+ <li>要自定义最初显示的项目数量,请在片段的 <code>onAttach(Context)</code> 方法中调用 <code>ProgressiveDisclosureMixin.setTileLimit()</code> 方法。</li>
+ </ul>
+</li>
+</ul>
+
+</body></html>
\ No newline at end of file
diff --git a/zh-cn/devices/tech/settings/personalized.html b/zh-cn/devices/tech/settings/personalized.html
new file mode 100644
index 0000000..5bf32e4
--- /dev/null
+++ b/zh-cn/devices/tech/settings/personalized.html
@@ -0,0 +1,54 @@
+<html devsite><head>
+ <title>个性化设置</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>
+Android 的“设置”应用为 Android 8.0 用户提供了一系列建议。
+这些建议通常有助于改进手机功能,而且可以自定义(例如“设置‘勿扰’时间安排”或“开启 WLAN 通话功能”)。该功能会对建议进行排名(基于任何上下文信号或用户以往的建议采用情况)。
+</p>
+
+<p>
+当前的默认 Android 开放源代码项目 (AOSP) 排名模型基于用户以往的建议采用情况;这是一个简单的线性模型,它通过逻辑回归进行训练,从而正确地对互动信号进行加权。默认实现会使用显示、点击或拒绝的建议作为指标,同时根据这些事件的新近度对建议进行排名,并提高正确预测用户对这些建议的采用情况的概率。该模型是利用有限的已记录用户数据构建而成的。设备制造商 (OEM) 可以根据收集的任何数据开发自己的排名模型,并可能会在后期根据上下文信号校准排名。
+</p>
+
+<h2 id="implementation">实现</h2>
+
+<p>
+在 AOSP 中查找默认 <code>packages/apps/Settings/src/com/android/settings/dashboard/suggestions/SuggestionRanker.java</code> 实现。
+</p>
+
+<p>
+此功能由标记 <code>isSmartSuggestionEnabled</code> 进行保护,该标记默认情况下设置为 false。如果启用该功能(设置为 true),则该功能可使用默认 AOSP 实现运行,无需进行其他修改。原始设备制造商 (OEM) 可以使用默认实现或引入自己的实现来启用此功能。
+</p>
+
+<p>
+原始设备制造商 (OEM) 可以通过实现 <code>platform/packages/apps/Settings/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProvider.java
+</code> 功能并替换文件的 <code>rankSuggestions</code> 方法来自定义该功能。
+该方法会获得两个列表,其中包含建议图块及相应的 suggestionId。该方法应仅根据所需排名得分重新排列相应列表中图块的顺序。suggestionId 可以用于唯一标识建议,并根据排名实现(例如,与此特定建议的互动新近度)提取关于该建议的所需过往信息。
+</p>
+
+<h2 id="validation">验证</h2>
+
+<p>
+实现人员可以自行编写类似于 <code>packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java</code> 的单元测试以验证排名,从而确保其功能版本能够按预期运行。
+</p>
+
+</body></html>
\ No newline at end of file
diff --git a/zh-cn/devices/tech/settings/universal-search.html b/zh-cn/devices/tech/settings/universal-search.html
new file mode 100644
index 0000000..da7c78b
--- /dev/null
+++ b/zh-cn/devices/tech/settings/universal-search.html
@@ -0,0 +1,175 @@
+<html devsite><head>
+ <title>通用搜索</title>
+ <meta name="project_path" value="/_project.yaml"/>
+ <meta name="book_path" value="/_book.yaml"/>
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<p>
+Android 8.0 为“设置”菜单添加了经过扩展的搜索功能。<em></em>本文档介绍了如何添加设置,以及如何确保正确地将其加入“设置”搜索的索引中。
+</p>
+
+<h2 id="indexable-settings">创建可编入索引的设置</h2>
+
+<p>
+需要编入索引的每个“设置”片段都会实现 <code>Indexable</code> 接口,并且需要静态字段:
+
+</p><pre class="prettyprint">public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER
+</pre>
+
+<p>
+为您的片段进行设置以编入索引后,将其添加到以下位置中的 <code>SearchIndexableResources</code>:<br />
+<code>packages/apps/Settings/src/com/android/settings/search/SearchIndexableResources.java
+</code>
+</p>
+
+<h2 id="optional-methods">可选方法</h2>
+
+<p>该 <code>SearchIndexProvider</code> 接口有四种可选方法。</p>
+
+<h3 id="getXmlResourcesToIndex">getXmlResourcesToIndex</h3>
+ <ul>
+ <li>如果您的片段内容来自 <code>preference xml</code>,则替换此方法</li>
+ <li>以要编入索引的列表形式返回 XML 偏好设置。</li>
+ </ul>
+
+ <p>XML 资源示例:</p>
+
+<pre class="prettyprint">public List<SearchIndexableResource> getXmlResourcesToIndex(Context context, boolean enabled) {
+ ArrayList<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>();
+SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.display_settings;
+ result.add(sir);
+
+ return result;
+}</pre>
+
+<h3 id="getRawDataToIndex">getRawDataToIndex</h3>
+ <ul>
+ <li>如果您的片段内容并非来自 <code>preference
+xml</code>,则替换此方法</li>
+ <li>返回要编入索引的原始数据 (<code>SearchIndexableRaw</code>) 的列表。</li>
+ </ul>
+
+<p>原始数据示例:</p>
+
+<pre class="prettyprint">
+public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
+ final List<SearchIndexableRaw> result = new ArrayList<>();
+ final Resources res = context.getResources();
+
+ // Add fragment title
+ SearchIndexableRaw data = new SearchIndexableRaw(context);
+ data.title = res.getString(R.string.wifi_settings);
+ data.screenTitle = res.getString(R.string.wifi_settings);
+ data.keywords = res.getString(R.string.keywords_wifi);
+ data.key = DATA_KEY_REFERENCE;
+ result.add(data);
+
+ return result;
+}
+</pre>
+
+<h3 id="getRawDataToIndex">getNonIndexableKeys</h3>
+ <ul>
+ <li>如果您的片段为 <code>DashboardFragment</code>,则很少需要替换该方法。</li>
+ <li>返回不应针对给定用户、设备、配置等显示的结果相对应的键列表。此处提供的键应与 <code>SearchIndexableResource</code> 和 <code>SearchIndexableRaw</code> 中的 KEY 字段匹配。<em></em></li>
+ <li>例如:不应向从未在其设备中使用 SIM 卡的用户显示“流量消耗”。</li>
+ </ul>
+
+<p>不可编入索引的键示例:</p>
+
+<pre class="prettyprint">
+public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = super.getNonIndexableKeys(context);
+ if (!checkIntentAction(context, "android.settings.TERMS")) {
+ keys.add(KEY_TERMS);
+ }
+ if (!checkIntentAction(context, "android.settings.LICENSE")) {
+ keys.add(KEY_LICENSE);
+ }
+ if (!checkIntentAction(context, "android.settings.COPYRIGHT")) {
+ keys.add(KEY_COPYRIGHT);
+ }
+ if (!checkIntentAction(context, "android.settings.WEBVIEW_LICENSE")) {
+ keys.add(KEY_WEBVIEW_LICENSE);
+ }
+ return keys;
+}</pre>
+
+<h3 id="getPreferenceControllers">getPreferenceControllers</h3>
+
+<p>
+返回与此片段相关联的偏好设置控制器列表。此列表用于形成内嵌结果、更新不可编入索引的内容等。
+</p>
+
+<p>
+因此,您希望在搜索中显示的所有内容都必须包含在 <code>getXmlResourcesToIndex</code> 或 <code>getRawDataToIndex</code> 中。
+</p>
+
+<h2 id="keywords">为您的设置添加关键字</h2>
+
+<p>
+为确保设置易于搜索,请添加与设置相关、用户可能用来搜索该设置的关键字。
+</p>
+
+<p>
+添加关键字时请注意以下事项:
+</p>
+ <ul>
+ <li>关键字是具有以下特征的词语的列表:用户不一定会看到,但可能属于在脑中构想相应设置的工作原理时会用到的字词。</li>
+ <li>关键字是用户可能会输入以访问您的设置的字词。</li>
+ <li>关键字可以是同义词,或者与设置相关联的任何字词。</li>
+ <li>例如,可以使用“静音”来查找“音量”设置。</li>
+ </ul>
+
+<h2 id="duplication">避免重复内容</h2>
+
+<p>
+如果您要无条件地排除某个设置页面,请移除原始页面的索引,以避免出现重复的结果。
+</p>
+
+ <ol>
+ <li>找到您要排除的页面的 <code>PreferenceFragment</code>。</li>
+ <li>移除 <code>SearchIndexProvider</code>。</li>
+ </ol>
+
+<h2 id="validation">验证</h2>
+
+<p>
+要测试新设置的可搜索性,请执行以下操作:
+</p>
+
+ <ol>
+ <li>在设备上安装最新版本的 Android O。</li>
+ <li>通过依次选择以下各项让数据库重新编制索引:</li>
+<em>设置 > 应用和通知 > 应用信息 > 设置 > 存储 > <strong>清除数据</strong></em>
+ <li>验证目标设置是否显示在搜索结果中。<br />
+ 搜索设置的标题前缀将与该设置匹配。</li>
+ </ol>
+
+<p>
+可以运行以下 robolectric 测试来验证此功能的实现:<br />
+<code>packages/apps/Settings/tests/robotests/src/com/android/settings/search</code>
+</p>
+
+<p>
+编译目标为:<code>RunSettingsRoboTests</code>
+</p>
+
+</body></html>
\ No newline at end of file