Merge "Clarify required permission in IMM#getInputMethodListAsUser()"

This commit is contained in:
Yohei Yukawa
2022-11-02 00:05:48 +00:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 2 deletions

View File

@@ -3159,7 +3159,7 @@ package android.view.inputmethod {
public final class InputMethodManager {
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void addVirtualStylusIdForTestSession();
method public int getDisplayId();
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodListAsUser(int);
method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodListAsUser(int);
method public boolean hasActiveInputConnection(@Nullable android.view.View);
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isInputMethodPickerShown();
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void setStylusWindowIdleTimeoutForTest(long);

View File

@@ -212,6 +212,7 @@ final class IInputMethodManagerGlobalInvoker {
@AnyThread
@NonNull
@RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
static List<InputMethodInfo> getInputMethodList(@UserIdInt int userId,
@DirectBootAwareness int directBootAwareness) {
final IInputMethodManager service = getService();

View File

@@ -1549,13 +1549,16 @@ public final class InputMethodManager {
/**
* Returns the list of installed input methods for the specified user.
*
* <p>{@link Manifest.permission#INTERACT_ACROSS_USERS_FULL} is required when and only when
* {@code userId} is different from the user id of the current process.</p>
*
* @param userId user ID to query
* @return {@link List} of {@link InputMethodInfo}.
* @hide
*/
@TestApi
@RequiresPermission(INTERACT_ACROSS_USERS_FULL)
@NonNull
@RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) {
return IInputMethodManagerGlobalInvoker.getInputMethodList(userId,
DirectBootAwareness.AUTO);