use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class UserManagerService method dump.
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump UserManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " without permission " + android.Manifest.permission.DUMP);
return;
}
long now = System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
synchronized (mPackagesLock) {
synchronized (mUsersLock) {
pw.println("Users:");
for (int i = 0; i < mUsers.size(); i++) {
UserData userData = mUsers.valueAt(i);
if (userData == null) {
continue;
}
UserInfo userInfo = userData.info;
final int userId = userInfo.id;
pw.print(" ");
pw.print(userInfo);
pw.print(" serialNo=");
pw.print(userInfo.serialNumber);
if (mRemovingUserIds.get(userId)) {
pw.print(" <removing> ");
}
if (userInfo.partial) {
pw.print(" <partial>");
}
pw.println();
pw.print(" Created: ");
if (userInfo.creationTime == 0) {
pw.println("<unknown>");
} else {
sb.setLength(0);
TimeUtils.formatDuration(now - userInfo.creationTime, sb);
sb.append(" ago");
pw.println(sb);
}
pw.print(" Last logged in: ");
if (userInfo.lastLoggedInTime == 0) {
pw.println("<unknown>");
} else {
sb.setLength(0);
TimeUtils.formatDuration(now - userInfo.lastLoggedInTime, sb);
sb.append(" ago");
pw.println(sb);
}
pw.print(" Last logged in fingerprint: ");
pw.println(userInfo.lastLoggedInFingerprint);
pw.print(" Has profile owner: ");
pw.println(mIsUserManaged.get(userId));
pw.println(" Restrictions:");
synchronized (mRestrictionsLock) {
UserRestrictionsUtils.dumpRestrictions(pw, " ", mBaseUserRestrictions.get(userInfo.id));
pw.println(" Device policy local restrictions:");
UserRestrictionsUtils.dumpRestrictions(pw, " ", mDevicePolicyLocalUserRestrictions.get(userInfo.id));
pw.println(" Effective restrictions:");
UserRestrictionsUtils.dumpRestrictions(pw, " ", mCachedEffectiveUserRestrictions.get(userInfo.id));
}
if (userData.account != null) {
pw.print(" Account name: " + userData.account);
pw.println();
}
if (userData.seedAccountName != null) {
pw.print(" Seed account name: " + userData.seedAccountName);
pw.println();
if (userData.seedAccountType != null) {
pw.print(" account type: " + userData.seedAccountType);
pw.println();
}
if (userData.seedAccountOptions != null) {
pw.print(" account options exist");
pw.println();
}
}
}
}
pw.println();
pw.println(" Device policy global restrictions:");
synchronized (mRestrictionsLock) {
UserRestrictionsUtils.dumpRestrictions(pw, " ", mDevicePolicyGlobalUserRestrictions);
}
pw.println();
pw.println(" Global restrictions owner id:" + mGlobalRestrictionOwnerUserId);
pw.println();
pw.println(" Guest restrictions:");
synchronized (mGuestRestrictions) {
UserRestrictionsUtils.dumpRestrictions(pw, " ", mGuestRestrictions);
}
synchronized (mUsersLock) {
pw.println();
pw.println(" Device managed: " + mIsDeviceManaged);
}
synchronized (mUserStates) {
pw.println(" Started users state: " + mUserStates);
}
// Dump some capabilities
pw.println();
pw.println(" Max users: " + UserManager.getMaxSupportedUsers());
pw.println(" Supports switchable users: " + UserManager.supportsMultipleUsers());
pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean(com.android.internal.R.bool.config_guestUserEphemeral));
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class UserManagerService method getProfileParentLU.
private UserInfo getProfileParentLU(int userHandle) {
UserInfo profile = getUserInfoLU(userHandle);
if (profile == null) {
return null;
}
int parentUserId = profile.profileGroupId;
if (parentUserId == UserInfo.NO_PROFILE_GROUP_ID) {
return null;
} else {
return getUserInfoLU(parentUserId);
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class UserManagerService method createRestrictedProfile.
/**
* @hide
*/
@Override
public UserInfo createRestrictedProfile(String name, int parentUserId) {
checkManageOrCreateUsersPermission("setupRestrictedProfile");
final UserInfo user = createProfileForUser(name, UserInfo.FLAG_RESTRICTED, parentUserId);
if (user == null) {
return null;
}
long identity = Binder.clearCallingIdentity();
try {
setUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS, true, user.id);
// Change the setting before applying the DISALLOW_SHARE_LOCATION restriction, otherwise
// the putIntForUser() will fail.
android.provider.Settings.Secure.putIntForUser(mContext.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE, android.provider.Settings.Secure.LOCATION_MODE_OFF, user.id);
setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, true, user.id);
} finally {
Binder.restoreCallingIdentity(identity);
}
return user;
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class UserManagerService method isSameProfileGroupLP.
private boolean isSameProfileGroupLP(int userId, int otherUserId) {
synchronized (mUsersLock) {
UserInfo userInfo = getUserInfoLU(userId);
if (userInfo == null || userInfo.profileGroupId == UserInfo.NO_PROFILE_GROUP_ID) {
return false;
}
UserInfo otherUserInfo = getUserInfoLU(otherUserId);
if (otherUserInfo == null || otherUserInfo.profileGroupId == UserInfo.NO_PROFILE_GROUP_ID) {
return false;
}
return userInfo.profileGroupId == otherUserInfo.profileGroupId;
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class UserManagerService method getAliveUsersExcludingGuestsCountLU.
private int getAliveUsersExcludingGuestsCountLU() {
int aliveUserCount = 0;
final int totalUserCount = mUsers.size();
// Skip over users being removed
for (int i = 0; i < totalUserCount; i++) {
UserInfo user = mUsers.valueAt(i).info;
if (!mRemovingUserIds.get(user.id) && !user.isGuest() && !user.partial) {
aliveUserCount++;
}
}
return aliveUserCount;
}
Aggregations