On a device running Android 13 (LineageOS 20), I created a managed user profile to separate work apps from the primary user's personal apps:
pm create-user --profileOf 0 --managed Work
Also applied a few restrictions to limit privileges in the work profile:
pm set-user-restriction --user 10 no_sms 1
pm set-user-restriction --user 10 no_outgoing_calls 1
pm set-user-restriction --user 10 no_config_location 1
pm set-user-restriction --user 10 no_config_wifi 1
pm set-user-restriction --user 10 no_config_bluetooth 1
pm set-user-restriction --user 10 no_config_mobile_networks 1
(Reference: android.os.UserManager)
The work profile got successfully created and appeared in settings, and its apps as a second tab in the launcher. I kept the bare minimum set of system apps (pm uninstall --user 10
) and moved work-related apps to the work profile (pm install-existing --user 10
) and everything seems to work fine.
But there is a problem - If I minimise any app from the work profile and go to recent apps, I only see apps from my main profile (user ID 0) but the apps from my managed profile (with the 💼 icon) do not appear at all. But if I tap on the app in the launcher, it does resume exactly where I minimised it, which indicates that the app is running.
I am able to see entries appearing in /data/system_ce/10/recent_tasks
for minimised apps however the snapshots
folder stays empty for some reason.
Another observation is that when I create a managed profile using an app like Island, all its apps do appear in the recents. I am unable to figure out what to do to make it work with the manually created managed profile. I have already tried setting allow_parent_profile_app_linking
to true but it didn't fix it.