List of usage examples for android.os UserManager isSystemUser
public boolean isSystemUser()
From source file:com.afwsamples.testdpc.common.Util.java
@TargetApi(VERSION_CODES.M) public static boolean isPrimaryUser(Context context) { if (isAtLeastM()) { UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE); return userManager.isSystemUser(); } else {/* w w w . j a va2 s . co m*/ // Assume only DO can be primary user. This is not perfect but the cases in which it is // wrong are uncommon and require adb to set up. return isDeviceOwner(context); } }