Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9364bff authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Profile select only shows with multiple profiles present." into qt-r1-dev

parents d164bf23 83f0d24f
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -96,19 +96,24 @@ public final class EnableContentCaptureWithServiceSettingsPreferenceController
            for (UserInfo info: userInfos) {
                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);
            UserAdapter adapter = UserAdapter.createUserAdapter(userManager, context, userHandles);
                UserAdapter adapter = UserAdapter.createUserAdapter(userManager, context,
                        userHandles);
                builder.setTitle(com.android.settingslib.R.string.choose_profile)
                        .setAdapter(adapter, (DialogInterface dialog, int which) -> {
                            final UserHandle user = userHandles.get(which);
                            // Show menu on top level items.
                        final Intent intent = pref.getIntent();
                        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                            final Intent intent = pref.getIntent()
                                    .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                            context.startActivityAsUser(intent, user);
                        })
                        .show();
            }
        }
    }

}