use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class ActivityTestMain method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "Referrer: " + getReferrer());
mAm = getSystemService(ActivityManager.class);
mPower = getSystemService(PowerManager.class);
mAlarm = getSystemService(AlarmManager.class);
if (savedInstanceState != null) {
mOverrideConfig = savedInstanceState.getParcelable(KEY_CONFIGURATION);
if (mOverrideConfig != null) {
applyOverrideConfiguration(mOverrideConfig);
}
}
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
List<UserInfo> users = um.getUsers();
mSecondUser = Integer.MAX_VALUE;
for (UserInfo ui : users) {
if (ui.id != 0 && mSecondUser > ui.id) {
mSecondUser = ui.id;
}
}
/*
AlertDialog ad = new AlertDialog.Builder(this).setTitle("title").setMessage("message").create();
ad.getWindow().getAttributes().type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
ad.show();
*/
}
use of android.content.pm.UserInfo in project XobotOS by xamarin.
the class ApplicationPackageManager method getUsers.
/**
* @hide
*/
@Override
public List<UserInfo> getUsers() {
// TODO:
// Dummy code, always returns just the primary user
ArrayList<UserInfo> users = new ArrayList<UserInfo>();
UserInfo primary = new UserInfo(0, "Root!", UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY);
users.add(primary);
return users;
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class ResolverActivity method setProfileSwitchMessageId.
private void setProfileSwitchMessageId(int contentUserHint) {
if (contentUserHint != UserHandle.USER_CURRENT && contentUserHint != UserHandle.myUserId()) {
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
UserInfo originUserInfo = userManager.getUserInfo(contentUserHint);
boolean originIsManaged = originUserInfo != null ? originUserInfo.isManagedProfile() : false;
boolean targetIsManaged = userManager.isManagedProfile();
if (originIsManaged && !targetIsManaged) {
mProfileSwitchMessageId = com.android.internal.R.string.forward_intent_to_owner;
} else if (!originIsManaged && targetIsManaged) {
mProfileSwitchMessageId = com.android.internal.R.string.forward_intent_to_work;
}
}
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class IntentForwarderActivity method getProfileParent.
/**
* Returns the userId of the profile parent or UserHandle.USER_NULL if there is
* no parent.
*/
private int getProfileParent() {
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
UserInfo parent = userManager.getProfileParent(UserHandle.myUserId());
if (parent == null) {
Slog.wtf(TAG, FORWARD_INTENT_TO_PARENT + " has been called, but there is no parent");
return UserHandle.USER_NULL;
}
return parent.id;
}
use of android.content.pm.UserInfo in project platform_frameworks_base by android.
the class ConfirmUserCreationActivity method onClick.
@Override
public void onClick(DialogInterface dialog, int which) {
setResult(RESULT_CANCELED);
if (which == BUTTON_POSITIVE && mCanProceed) {
Log.i(TAG, "Ok, creating user");
UserInfo user = mUserManager.createUser(mUserName, 0);
if (user == null) {
Log.e(TAG, "Couldn't create user");
finish();
return;
}
mUserManager.setSeedAccountData(user.id, mAccountName, mAccountType, mAccountOptions);
setResult(RESULT_OK);
}
finish();
}
Aggregations