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

Commit 1cb8aafb authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Launch language settings activity for user

This ensures the intent for launching the language settings activity
takes into account the given userId.

Test: create work profile locally, show IME switcher menu, tap on
  Language settings button
Bug: 311791923
Flag: android.view.inputmethod.ime_switcher_revamp
Change-Id: I26f281f019dd8f116f08c596d8b5d67d80f800cf
parent 9be10314
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -17,17 +17,22 @@
package com.android.server.inputmethod;


import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS;

import static com.android.server.inputmethod.InputMethodManagerService.DEBUG;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;

import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.UserIdInt;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Printer;
import android.util.Slog;
@@ -80,6 +85,7 @@ final class InputMethodMenuControllerNew {
     * @param displayId     the ID of the display where the menu was requested.
     * @param userId        the ID of the user that requested the menu.
     */
    @RequiresPermission(allOf = {INTERACT_ACROSS_USERS, HIDE_OVERLAY_WINDOWS})
    void show(@NonNull List<MenuItem> items, int selectedIndex, int displayId,
            @UserIdInt int userId) {
        // Hide the menu in case it was already showing.
@@ -120,7 +126,7 @@ final class InputMethodMenuControllerNew {
                    .requireViewById(com.android.internal.R.id.button1);
            languageSettingsButton.setVisibility(View.VISIBLE);
            languageSettingsButton.setOnClickListener(v -> {
                v.getContext().startActivity(languageSettingsIntent);
                v.getContext().startActivityAsUser(languageSettingsIntent, UserHandle.of(userId));
                hide(displayId, userId);
            });
        }