Merge "Added getProfileIds method returning array of userIds" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ef3164424
@@ -344,13 +344,12 @@ public final class CredentialStorage extends Activity {
|
|||||||
|
|
||||||
// Clear all the users credentials could have been installed in for this user.
|
// Clear all the users credentials could have been installed in for this user.
|
||||||
final UserManager um = (UserManager) getSystemService(USER_SERVICE);
|
final UserManager um = (UserManager) getSystemService(USER_SERVICE);
|
||||||
for (UserInfo pi : um.getProfiles(UserHandle.getUserId(Process.myUid()))) {
|
for (int userId : um.getProfileIdsWithDisabled(UserHandle.myUserId())) {
|
||||||
for (int uid : SYSTEM_CREDENTIAL_UIDS) {
|
for (int uid : SYSTEM_CREDENTIAL_UIDS) {
|
||||||
mKeyStore.clearUid(UserHandle.getUid(pi.id, uid));
|
mKeyStore.clearUid(UserHandle.getUid(userId, uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
KeyChainConnection keyChainConnection = KeyChain.bind(CredentialStorage.this);
|
KeyChainConnection keyChainConnection = KeyChain.bind(CredentialStorage.this);
|
||||||
try {
|
try {
|
||||||
|
@@ -615,12 +615,10 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
* @return the managed profile id or UserHandle.USER_NULL if there is none.
|
* @return the managed profile id or UserHandle.USER_NULL if there is none.
|
||||||
*/
|
*/
|
||||||
public static int getManagedProfileId(UserManager um, int parentUserId) {
|
public static int getManagedProfileId(UserManager um, int parentUserId) {
|
||||||
List<UserInfo> profiles = um.getProfiles(parentUserId);
|
int[] profileIds = um.getProfileIdsWithDisabled(parentUserId);
|
||||||
int numProfiles = profiles.size();
|
for (int profileId : profileIds) {
|
||||||
for (int i = 0; i < numProfiles; ++i) {
|
if (profileId != parentUserId) {
|
||||||
UserInfo profile = profiles.get(i);
|
return profileId;
|
||||||
if (profile.id != parentUserId) {
|
|
||||||
return profile.id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return UserHandle.USER_NULL;
|
return UserHandle.USER_NULL;
|
||||||
|
Reference in New Issue
Block a user