Android基于Linux,所以它也是支持多用户的。
当需要获取当前正在运行的user id(int)时,有两种方式:
- android.os.Process.myUid()/100000
/**
* Returns the identifier of this process's uid. This is the kernel uid
* that the process is running under, which is the identity of its
* app-specific sandbox. It is different from {@link #myUserHandle} in that
* a uid identifies a specific app sandbox in a specific user.
*/
public static final int myUid() {
return Os.getuid(<