aboutsummaryrefslogtreecommitdiff
path: root/en/devices/tech/admin/multiuser-apps.html
diff options
context:
space:
mode:
authorAndroid Partner Docs <noreply@android.com>2017-06-19 21:12:35 -0700
committerClay Murphy <claym@google.com>2017-06-20 13:09:22 -0700
commitd72514453123a8634ae55406807d77f03362a2bd (patch)
treeb528f70cbfa22decfea5899870efc1a42e7b7778 /en/devices/tech/admin/multiuser-apps.html
parent8560a623b8040782583740e9dd1cbc4be310a568 (diff)
downloadsource.android.com-d72514453123a8634ae55406807d77f03362a2bd.tar.gz
Docs: Changes to source.android.com
- 159519221 Add CTS Media 1.3 file link by claym <claym@google.com> - 159296442 Changed devsite tag classes on a couple pages. by cqn <cqn@google.com> - 159296357 Add devsite class to tags in devices/tech/power by cqn <cqn@google.com> - 159296314 Added devsite class to tags in compatibility/cts. by cqn <cqn@google.com> - 159296265 Added devsite class to tags in devices/tech/ota. by cqn <cqn@google.com> - 159273197 Added devsite class to tags for devices/tech/test_infra/t... by cqn <cqn@google.com> - 159269559 Add speed-profile and verify-profile to the list of options by claym <claym@google.com> - 159268556 Add devsite class to tags in devices/tech/display by cqn <cqn@google.com> - 159247742 Add devsite class to tags in devices/tech/admin by cqn <cqn@google.com> - 159246177 Finished adding devsite class to tags on devices/tech/debug by cqn <cqn@google.com> - 159245597 Add devsite tag to classes in devices/tech/debug by cqn <cqn@google.com> - 159128910 Changed breaks to paragraph tags for formatting, and adde... by cqn <cqn@google.com> - 159115811 Add devsite class to tags for devices/tech/config by cqn <cqn@google.com> - 159115392 Added devsite class to tags on devices/tech/connect and d... by cqn <cqn@google.com> - 159114997 Add devsite class to tags in devices/storage and devices/tv by cqn <cqn@google.com> - 158948331 Provide advice to OEM and carrier app developers to reduc... by Android Partner Docs <noreply@android.com> - 158920824 Add devsite class to tags in devices/tech/dalvik by cqn <cqn@google.com> - 158917965 Fix links to sensors.h reference file by claym <claym@google.com> - 158916603 Docs: moving gdb to own page, updating index by hvm <hvm@google.com> - 158915436 Update Security acknowledgement with new researcher info by daroberts <daroberts@google.com> - 158883841 Finish adding devsite class to tags in devices/audio by cqn <cqn@google.com> - 158883680 Add devsite class to tags in devices/sensors and devices/... by cqn <cqn@google.com> - 158871012 Improve Jack deprecation warning message. by gdimino <gdimino@google.com> - 158867373 Add devsite classes to tags for devices/graphics by cqn <cqn@google.com> - 158867298 Added devsite classes to tags in devices/input by cqn <cqn@google.com> - 158867192 Add devsite classes to tags in devices/camera and devices... by cqn <cqn@google.com> PiperOrigin-RevId: 159519221 Change-Id: I924de0c1668bcbcc94ee97e60c144aac4c81708d
Diffstat (limited to 'en/devices/tech/admin/multiuser-apps.html')
-rw-r--r--en/devices/tech/admin/multiuser-apps.html29
1 files changed, 26 insertions, 3 deletions
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>