The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
Android 4.2 introduced the concept of having multiple distinct users of a tablet. Each user would get their own portion of internal and external storage, as if they each had their own tablet.
Android 4.3 extends this a bit further, with the notion of setting up restricted profiles. As the name suggests, a restricted profile is restricted, in terms of what it can do on the device. Some restrictions will be device-wide (e.g., can the user install apps?), and some restrictions will be per-app. You can elect to allow your app to be restricted, where you define the possible ways in which your app can be restricted, and the one setting up the restricted profile can then configure the desired options for some specific profile.
This chapter will explain how users set up these restricted profiles, what you can learn about the device-wide restrictions, and how you can offer your own restrictions for your own app.
Understanding this chapter requires that you have read the core chapters of this book, particularly the chapter on files and its section on multiple user accounts.
The theory is that tablets are likely to be shared, whether among family members, among team members in a business, or similar sorts of group settings. There are three levels of “user” in an Android 4.3+ tablet that we will need to consider.
The primary user is whoever first set up the tablet after initial purchase. In a family, this is probably a parent; in a corporate setting, this might be an IT administrator.
Prior to Android 4.2, there was only one user per device, and that user could (generally) do anything. In Android 4.2+, the primary user holds this role.
One thing that the primary user can do is set up other users, via the Users option in the Settings app:
Figure 740: Users Screen in Settings
Tapping the “Add user or profile” entry allows the primary user to set up another user or restricted profile:
Figure 741: Add Dialog in Users Screen in Settings
Choosing “User” from the Add dialog will define a secondary user of the device. This user has much of the same control as the primary user, in terms of being able to install and run whatever apps are desired.
Figure 742: Add New User Warning Dialog in Users Screen in Settings
A restricted profile is akin to a secondary user, in that it gets its own separate portion of internal and external storage. Beyond that, though, the primary user can further configure what the restricted profile can access:
Figure 743: Restricted Profile Configuration Screen in Settings
The bulk of the restricted profile configuration screen is a list of apps,
Switch widgets to allow the primary user to allow or deny access
to each app.
Some apps will have the “settings” icon to the left of the
that will either bring up a dedicated activity for restricting operations
within that app, or it will add new rows to the list with individual
restriction options for that app. For example, tapping the settings icon for
the Settings app adds a row where the primary user can block location
Figure 744: Location Sharing Restrictions
The “settings” icon in the first row, for the profile itself, will allow the primary user to control things for the entire profile, notably its name.
Switching to the restricted profile (e.g., via the lockscreen) will show the constrained set of available apps:
Figure 745: Apps in a Restricted Profile
The preview of this section was the victim of a MITM ('Martian in the middle') attack.
The preview of this section was lost due to a rupture in the space-time continuum.
The preview of this section was whisked away by a shark-infested tornado.
The preview of this section apparently resembled a Pokémon.