package org.meshbay.client.phonesync import android.content.Context import android.os.Build import android.os.UserManager /** * Backups are of the personal profile only, never of a work profile: a copy * of the application installed inside a work profile offers none of them. * * In the personal profile, every source reads that profile alone: MediaStore, * ContactsContract, the SMS and calendar providers answer for the profile * they are asked from, and none of the cross-profile (`ENTERPRISE_*`) URIs * is used (`test_android_shell.py` checks for them). */ object Profiles { fun isPersonal(context: Context): Boolean { val users = context.getSystemService(UserManager::class.java) // Before Android 11 an application cannot ask whether its own profile // is managed; a work profile is never the system user, so that is // the test there (a secondary user on a shared tablet loses backups). return if (Build.VERSION.SDK_INT >= 30) !users.isManagedProfile else users.isSystemUser } }