diff options
Diffstat (limited to 'en/devices/tech/admin')
-rw-r--r-- | en/devices/tech/admin/implement.html | 29 | ||||
-rw-r--r-- | en/devices/tech/admin/managed-profiles.html | 8 | ||||
-rw-r--r-- | en/devices/tech/admin/multi-user.html | 3 | ||||
-rw-r--r-- | en/devices/tech/admin/multiuser-apps.html | 29 | ||||
-rw-r--r-- | en/devices/tech/admin/provision.html | 13 | ||||
-rw-r--r-- | en/devices/tech/admin/testing-provision.html | 68 | ||||
-rw-r--r-- | en/devices/tech/admin/testing-setup.html | 4 |
7 files changed, 107 insertions, 47 deletions
diff --git a/en/devices/tech/admin/implement.html b/en/devices/tech/admin/implement.html index ada8d284..f930e906 100644 --- a/en/devices/tech/admin/implement.html +++ b/en/devices/tech/admin/implement.html @@ -87,7 +87,7 @@ to 1 when the <code>low_ram</code> flag is defined.</p> <h3 id=uses-feature>Uses-feature</h3> <p>Devices must define the following <code>uses-feature</code>:</p> -<pre> +<pre class="devsite-click-to-copy"> android.software.managed_users android.software.device_admin </pre> @@ -100,15 +100,19 @@ device, run: <code>adb shell pm list features</code>.</p> should be enabled as part of provisioning a managed device. OEMs must ensure the managed profile or device has all required applications by modifying:</p> -<pre>vendor_required_apps_managed_profile.xml +<pre class="devsite-click-to-copy"> +vendor_required_apps_managed_profile.xml vendor_required_apps_managed_device.xml </pre> <p>Examples from a Nexus device:</p> -<p><code>packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml</code></p> +<pre class="devsite-click-to-copy"> +packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml +</pre> -<pre><resources> +<pre class="devsite-click-to-copy"> +<resources> <!-- A list of apps to be retained on the managed device --> <string-array name="vendor_required_apps_managed_device"> <item>com.android.vending</item> <!--Google Play --> @@ -121,11 +125,11 @@ vendor_required_apps_managed_device.xml </resources> </pre> -<p><code> +<pre class="devsite-click-to-copy"> packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml -</code></p> +</pre> -<pre> +<pre class="devsite-click-to-copy"> <resources> <!-- A list of apps to be retained in the managed profile. This includes any Google experience apps required. --> <string-array name="vendor_required_apps_managed_profile"> @@ -150,8 +154,12 @@ feature.</p> <p>Devices with NFC must enable NFC during the out-of-the-box experience (i.e., setup wizard) and be configured to accept managed provisioning intents:</p> -<p><code>packages/apps/Nfc/res/values/provisioning.xml</code></p> -<pre><bool name="enable_nfc_provisioning">true</bool> +<pre class="devsite-click-to-copy"> +packages/apps/Nfc/res/values/provisioning.xml +</pre> + +<pre class="devsite-click-to-copy"> +<bool name="enable_nfc_provisioning">true</bool> <item>application/com.android.managedprovisioning</item> </pre> @@ -167,7 +175,8 @@ which then hands control to the newly-set device owner.</p> <p>To meet setup requirements, add the following code to the device setup's main activity:</p> -<pre>@Override +<pre class="devsite-click-to-copy"> +@Override protected void onStart() { super.onStart(); diff --git a/en/devices/tech/admin/managed-profiles.html b/en/devices/tech/admin/managed-profiles.html index 95c7771f..eb042052 100644 --- a/en/devices/tech/admin/managed-profiles.html +++ b/en/devices/tech/admin/managed-profiles.html @@ -81,11 +81,15 @@ outside the managed profile.</p> <p>Managed profiles are implemented as a new kind of secondary user, such that:</p> -<pre>uid = 100000 * userid + appid</pre> +<pre class="devsite-click-to-copy"> +uid = 100000 * userid + appid +</pre> <p>They have separate app data like regular users:</p> -<pre>/data/user/<userid></pre> +<pre class="devsite-click-to-copy"> +/data/user/<userid> +</pre> <p>The UserId is calculated for all system requests using <code>Binder.getCallingUid()</code>, and all system state and responses are diff --git a/en/devices/tech/admin/multi-user.html b/en/devices/tech/admin/multi-user.html index cc187660..e19eaea4 100644 --- a/en/devices/tech/admin/multi-user.html +++ b/en/devices/tech/admin/multi-user.html @@ -101,7 +101,8 @@ enable it, device manufacturers must define a resource overlay that replaces the following values in <code>frameworks/base/core/res/res/values/config.xml</code>: </p> -<pre><!-- Maximum number of supported users --> +<pre class="devsite-click-to-copy"> +<!-- Maximum number of supported users --> <integer name="config_multiuserMaximumUsers">1</integer> <!-- Whether Multiuser UI should be shown --> <bool name="config_enableMultiUserUI">false</bool> diff --git a/en/devices/tech/admin/multiuser-apps.html b/en/devices/tech/admin/multiuser-apps.html index 546659d7..c3efcd64 100644 --- a/en/devices/tech/admin/multiuser-apps.html +++ b/en/devices/tech/admin/multiuser-apps.html @@ -38,7 +38,7 @@ requests from any user. Only system apps can currently use this feature.</p> <p>See the diagram below for a depiction of permissions flow with multiple users.</p> -<p><img src="images/multi-user-perms.png" alt="Multiple users permissions flow" /> +<p><img src="/devices/tech/admin/images/multi-user-perms.png" alt="Multiple users permissions flow" /> <p class="img-caption"><strong>Figure 1.</strong> Multiple users permissions</p> <h2 id=enabling_a_singleton_component>Enabling a singleton component</h2> @@ -59,7 +59,7 @@ each user, with the UID being in the UID range for that user (such as 1010034).< <p>These permissions are required</p> -<pre> +<pre class="devsite-click-to-copy"> INTERACT_ACROSS_USERS (signature|system) INTERACT_ACROSS_USERS_FULL (signature) </pre> @@ -74,7 +74,7 @@ INTERACT_ACROSS_USERS_FULL (signature) <li> <code>int userHandle = UserHandle.getCallingUserId()</code> </ul> <li> Use new, protected APIs to start services, activities, broadcasts on a specific -user: +user: <ul> <li><code>Context.startActivityAsUser(Intent, UserHandle)</code> <li><code>Context.bindServiceAsUser(Intent, …, UserHandle)</code> @@ -102,5 +102,28 @@ ContentObserver, PackageMonitor, BroadcastReceiver that provide additional information about which user has caused the callback. </ol> +<h3 id="work-profiles">Services in multiple users or profiles</h3> + +<p>Not all services need to run an instance in another user or work profile. If your system service +only needs to run as user 0, disable the service's components when running under other users to +help preserve resources. The following example shows how you might do this at your service's entry +points:</p> + +<pre class="devsite-click-to-copy"> +// Add on all entry points such as boot_completed or other manifest-listed receivers and providers +if (!UserManager.isSystemUser()) { + // Disable the service + ComponentName targetServiceName = new ComponentName(this, TargetService.class); + context.getPackageManager().setComponentEnabledSetting( + targetServiceName, COMPONENT_ENABLED_STATE_DISABLED, 0); +} +</pre> + +<p>The example could also use <code>PackageManager.setApplicationEnabledSetting()</code> to disable +the entire app.</p> + + + + </body> </html> diff --git a/en/devices/tech/admin/provision.html b/en/devices/tech/admin/provision.html index 9ab1937d..e1acd3e7 100644 --- a/en/devices/tech/admin/provision.html +++ b/en/devices/tech/admin/provision.html @@ -94,13 +94,14 @@ managed profile by sending an intent with action: . Below is a sample intent that triggers the creation of the managed profile and sets the DeviceAdminSample as the profile owner:</p> -<pre>adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \ +<pre class="devsite-click-to-copy"> +<code class="devsite-terminal">adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \ -c android.intent.category.DEFAULT \ -e wifiSsid $(printf '%q' \"WifiSSID\") \ -e deviceAdminPackage "com.google.android.deviceadminsample" \ -e android.app.extra.deviceAdminPackageName $(printf '%q' .DeviceAdminSample\$DeviceAdminSampleReceiver) \ - -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation" + -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation"</code> </pre> <h2 id=device_owner_provisioning_via_nfc>Device owner provisioning</h2> @@ -117,7 +118,7 @@ DPC as device owner.</p> <p>A typical NFC bundle includes the following:</p> -<pre> +<pre class="devsite-click-to-copy"> EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LOCATION EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM @@ -128,8 +129,10 @@ DPC as device owner.</p> <p>Devices must have NFC configured to accept the managed provisioning mimetype from the setup experience:</p> -<pre>/packages/apps/Nfc/res/values/provisioning.xml - +<pre class="devsite-click-to-copy"> +/packages/apps/Nfc/res/values/provisioning.xml +</pre> +<pre class="devsite-click-to-copy"> <bool name="enable_nfc_provisioning">true</bool> <item>application/com.android.managedprovisioning</item> </pre> diff --git a/en/devices/tech/admin/testing-provision.html b/en/devices/tech/admin/testing-provision.html index d080bad7..a8a219d2 100644 --- a/en/devices/tech/admin/testing-provision.html +++ b/en/devices/tech/admin/testing-provision.html @@ -50,13 +50,13 @@ Android platform has a separate version of AfW Test Harness). For Android 7.0, the branch name is <code>afw-test-harness-nougat-dev</code>. To initialize the repo and download source code for this branch, use:</p> -<pre> -$ mkdir WORKING_DIRECTORY -$ cd WORKING_DIRECTORY -$ git config --global user.name "Your Name" -$ git config --global user.email "you@example.com" -$ repo init -u https://android.googlesource.com/platform/manifest -b afw-test-harness-nougat-dev -$ repo sync -j24 +<pre class="devsite-click-to-copy"> +<code class="devsite-terminal">mkdir WORKING_DIRECTORY</code> +<code class="devsite-terminal">cd WORKING_DIRECTORY</code> +<code class="devsite-terminal">git config --global user.name "Your Name"</code> +<code class="devsite-terminal">git config --global user.email "you@example.com"</code> +<code class="devsite-terminal">repo init -u https://android.googlesource.com/platform/manifest -b afw-test-harness-nougat-dev</code> +<code class="devsite-terminal">repo sync -j24</code> </pre> <p>To check out the source code for a different version, specify the branch with @@ -92,9 +92,9 @@ with the source code.</p> <p>To view and edit AfW source code in Android Studio:</p> <ol> <li>Run the following commands -<pre> -$ make idegen -$ development/tools/idegen/idegen.sh +<pre class="devsite-click-to-copy"> +<code class="devsite-terminal">make idegen</code> +<code class="devsite-terminal">development/tools/idegen/idegen.sh</code> </pre> </li> <li>In Android Studio, open <code>android.ipr</code>.</li> @@ -109,7 +109,8 @@ successfully, complete the following steps:</p> <ol> <li>Configure the Wi-Fi network in <code>afw-test.props</code> with the following properties: -<pre>wifi_ssid +<pre class="devsite-click-to-copy"> +wifi_ssid wifi_password (optional) wifi_security_type (optional, available options are: NONE, WEP or WPA) </pre> @@ -117,7 +118,7 @@ wifi_security_type (optional, available options are: NONE, WEP or WPA) <li>Obtain at least one account from a domain that is bound to Test DPC as its device policy controller. Specify the details in <code>afw-test.props</code> with the following properties: -<pre> +<pre class="devsite-click-to-copy"> work_account_username work_account_password </pre> @@ -128,15 +129,17 @@ work_account_password <h2 id=build_harness>Building the AfW Test Harness</h2> <p>Initialize the build configuration using:</p> -<pre> -$ source build/envsetup.sh -$ lunch +<pre class="devsite-click-to-copy"> +<code class="devsite-terminal">source build/envsetup.sh</code> +<code class="devsite-terminal">lunch</code> </pre> <p>Select a device type and press <strong>Enter</strong>.</p> <p>Build the harness using:</p> -<pre>$ make afw-test-harness -j32</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +make afw-test-harness -j32 +</pre> <p>This creates a directory (<code>out/host/linux-x86/afw-th/android-cts</code>) with all necessary binaries, configuration files, and tools to run the test harness. This directory is also zipped into a file @@ -147,13 +150,17 @@ for distribution.</p> <p>Use the following steps to run the AfW Test Harness:</p> <ol> <li>In your build environment, launch the test runner using: -<pre>$ afw-test-tradefed</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +afw-test-tradefed +</pre> This starts the <code>cts-tf</code> console, loads test plans, test cases, and <code>afw-test.props</code> from <code>out/host/linux-x86/afw-th/android-cts</code>.</li> <li>From the unzipped folder of <code>android-afw-test-harness.zip</code>, launch the test runner using: -<pre>$ cts-tf > ./android‐cts/tools/afw-test‐tradefed</pre> +<pre class="devsite-click-to-copy"> +cts-tf> ./android‐cts/tools/afw-test‐tradefed +</pre> This loads test plans, test cases, and <code>afw-test.props</code> from <code>android-cts</code> directory. Ensure <code>./android‐cts/repository/testcases/afw-test.props</code> has the work @@ -172,14 +179,17 @@ setup and enabling USB debugging.</li> </ul> <br>To run the test plan <code>afw-userdebug-build</code>, use: -<pre>$ cts-tf > run cts --plan afw-userdebug-build</pre> +<pre class="devsite-click-to-copy"> +cts-tf> run cts --plan afw-userdebug-build +</pre> To see all test plans, use the command <code>list plans</code>. To view plan definitions, refer to <code>out/host/linux-x86/afw-th/android-cts/repository/plans</code>. <br> </li> <li>Run a test package. To run a single test package, use -<pre>$ cts-tf > run cts --package com.android.afwtest.NfcProvisioning +<pre class="devsite-click-to-copy"> +cts-tf> run cts --package com.android.afwtest.NfcProvisioning </pre> To view all packages, use the command <code>list packages</code>. For more options, use the command <code>run cts --help</code>.</li> @@ -192,16 +202,23 @@ which you can launch by running <code>afw-test-tradefed</code>.</p> <li>Display more information with the <code>-l INFO</code> or <code>-l DEBUG</code> flags. Example: -<pre>$ cts-tf > run cts ‐‐plan afw-userdebug-build -l DEBUG</pre></li> +<pre class="devsite-click-to-copy"> +cts-tf> run cts ‐‐plan afw-userdebug-build -l DEBUG +</pre> +</li> <li>Run the test harness on a specific device with the <code>-s</code> flag. Example: -<pre>$ cts-tf > run cts ‐‐plan afw-userdebug-build -l DEBUG -s device_sn</pre> +<pre class="devsite-click-to-copy"> +cts-tf> run cts ‐‐plan afw-userdebug-build -l DEBUG -s device_sn +</pre> </li> <li>Run test harness on all connected devices with the <code>--all-devices</code> flag. Example: -<pre>$ cts-tf > run cts ‐‐plan afw-userdebug-build -l DEBUG --all-devices</pre> +<pre class="devsite-click-to-copy"> +cts-tf> run cts ‐‐plan afw-userdebug-build -l DEBUG --all-devices +</pre> </li> <li>View current running executions using <code>list invocations</code> or @@ -246,7 +263,8 @@ Navigating:com.android.afwtest.uiautomator.pages.gms.AddAccountPage</code> </li> <li>If a test failed during the provisioning process, logcat contains an error similar to: -<pre>TestRunner: java.lang.RuntimeException: Failed to load page: com.android.afwtest.uiautomator.pages.packageinstaller.DeviceAccessPage +<pre class="devsite-click-to-copy"> +TestRunner: java.lang.RuntimeException: Failed to load page: com.android.afwtest.uiautomator.pages.packageinstaller.DeviceAccessPage </pre> This is typically caused by errors in a previous UI page or the page that failed to load, so try to find other error messages in logcat before this error, @@ -306,7 +324,7 @@ meaningful text or content description that contains any of the following words: Skip, Finish, Done, Accept, Agree, Next, Continue, or Proceed. Alternatively, you can define a button in <code>afw-test.props</code> to configure the test harness to skip your UI. Example:</em></p> -<pre> +<pre class="devsite-click-to-copy"> oem_widgets=your_btn your_btn.text=your_customized_text your_btn.package=your_package diff --git a/en/devices/tech/admin/testing-setup.html b/en/devices/tech/admin/testing-setup.html index 8a47fcfe..dc89c1a4 100644 --- a/en/devices/tech/admin/testing-setup.html +++ b/en/devices/tech/admin/testing-setup.html @@ -61,7 +61,9 @@ enterprise mobility management (EMM) providers.</p> </ul> </li> <li>Set the TestDPC app as the device owner using the following command:<br> - <pre>$ adb shell dpm set-device-owner "com.afwsamples.testdpc/.DeviceAdminReceiver"</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +adb shell dpm set-device-owner "com.afwsamples.testdpc/.DeviceAdminReceiver" +</pre> </li> <li>Go through device owner setup on the device (encrypt, select Wi-Fi, etc.)</li> </ol> |