判斷系統(tǒng)的主從用戶
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// true 主用戶 false 從用戶
UserManager userManager = (UserManager)context.getSystemService(Context.USER_SERVICE);
boolean isPrimary = !userManager.isManagedProfile();
}