Merge "Profile select only shows with multiple profiles present." into qt-r1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c9364bffbc
@@ -96,19 +96,24 @@ public final class EnableContentCaptureWithServiceSettingsPreferenceController
|
|||||||
for (UserInfo info: userInfos) {
|
for (UserInfo info: userInfos) {
|
||||||
userHandles.add(info.getUserHandle());
|
userHandles.add(info.getUserHandle());
|
||||||
}
|
}
|
||||||
|
if (userHandles.size() == 1) {
|
||||||
|
final Intent intent = pref.getIntent().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
context.startActivityAsUser(intent, userHandles.get(0));
|
||||||
|
} else {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
UserAdapter adapter = UserAdapter.createUserAdapter(userManager, context, userHandles);
|
UserAdapter adapter = UserAdapter.createUserAdapter(userManager, context,
|
||||||
|
userHandles);
|
||||||
builder.setTitle(com.android.settingslib.R.string.choose_profile)
|
builder.setTitle(com.android.settingslib.R.string.choose_profile)
|
||||||
.setAdapter(adapter, (DialogInterface dialog, int which) -> {
|
.setAdapter(adapter, (DialogInterface dialog, int which) -> {
|
||||||
final UserHandle user = userHandles.get(which);
|
final UserHandle user = userHandles.get(which);
|
||||||
// Show menu on top level items.
|
// Show menu on top level items.
|
||||||
final Intent intent = pref.getIntent();
|
final Intent intent = pref.getIntent()
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
context.startActivityAsUser(intent, user);
|
context.startActivityAsUser(intent, user);
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user