use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class PackageManagerService method prepareAppDataAfterInstallLIF.
/**
* Prepare app data for the given app just after it was installed or
* upgraded. This method carefully only touches users that it's installed
* for, and it forces a restorecon to handle any seinfo changes.
* <p>
* Verifies that directories exist and that ownership and labeling is
* correct for all installed apps. If there is an ownership mismatch, it
* will try recovering system apps by wiping data; third-party app data is
* left intact.
* <p>
* <em>Note: To avoid a deadlock, do not call this method with {@code mPackages} lock held</em>
*/
private void prepareAppDataAfterInstallLIF(PackageParser.Package pkg) {
final PackageSetting ps;
synchronized (mPackages) {
ps = mSettings.mPackages.get(pkg.packageName);
mSettings.writeKernelMappingLPr(ps);
}
final UserManager um = mContext.getSystemService(UserManager.class);
UserManagerInternal umInternal = getUserManagerInternal();
for (UserInfo user : um.getUsers()) {
final int flags;
if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
flags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
} else if (umInternal.isUserRunning(user.id)) {
flags = StorageManager.FLAG_STORAGE_DE;
} else {
continue;
}
if (ps.getInstalled(user.id)) {
// TODO: when user data is locked, mark that we're still dirty
prepareAppDataLIF(pkg, user.id, flags);
}
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class PackageManagerService method userNeedsBadging.
private boolean userNeedsBadging(int userId) {
int index = mUserNeedsBadging.indexOfKey(userId);
if (index < 0) {
final UserInfo userInfo;
final long token = Binder.clearCallingIdentity();
try {
userInfo = sUserManager.getUserInfo(userId);
} finally {
Binder.restoreCallingIdentity(token);
}
final boolean b;
if (userInfo != null && userInfo.isManagedProfile()) {
b = true;
} else {
b = false;
}
mUserNeedsBadging.put(userId, b);
return b;
}
return mUserNeedsBadging.valueAt(index);
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class BaseSettingsProviderTest method setContext.
@Override
public void setContext(Context context) {
super.setContext(context);
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
List<UserInfo> users = userManager.getUsers();
final int userCount = users.size();
for (int i = 0; i < userCount; i++) {
UserInfo user = users.get(i);
if (!user.isPrimary() && !user.isManagedProfile()) {
mSecondaryUserId = user.id;
break;
}
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class SettingsProvider method dump.
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
synchronized (mLock) {
final long identity = Binder.clearCallingIdentity();
try {
List<UserInfo> users = mUserManager.getUsers(true);
final int userCount = users.size();
for (int i = 0; i < userCount; i++) {
UserInfo user = users.get(i);
dumpForUserLocked(user.id, pw);
}
} finally {
Binder.restoreCallingIdentity(identity);
}
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class PhoneStatusBarPolicy method updateQuietState.
private void updateQuietState() {
mManagedProfileInQuietMode = false;
int currentUserId = ActivityManager.getCurrentUser();
for (UserInfo ui : mUserManager.getEnabledProfiles(currentUserId)) {
if (ui.isManagedProfile() && ui.isQuietModeEnabled()) {
mManagedProfileInQuietMode = true;
return;
}
}
}
Aggregations