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

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

Merge "Use @EnforcePermission for IIMM#isInputMethodPickerShownForTest()"

parents 40525799 aa29be8d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ interface IInputMethodManager {
    void showInputMethodPickerFromSystem(in IInputMethodClient client,
            int auxiliarySubtypeMode, int displayId);

    @EnforcePermission("TEST_INPUT_METHOD")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.TEST_INPUT_METHOD)")
    boolean isInputMethodPickerShownForTest();
+1 −15
Original line number Diff line number Diff line
@@ -298,8 +298,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
    final IWindowManager mIWindowManager;
    private final SparseBooleanArray mLoggedDeniedGetInputMethodWindowVisibleHeightForUid =
            new SparseBooleanArray(0);
    private final SparseBooleanArray mLoggedDeniedIsInputMethodPickerShownForTestForUid =
            new SparseBooleanArray(0);
    final WindowManagerInternal mWindowManagerInternal;
    final PackageManagerInternal mPackageManagerInternal;
    final InputManagerInternal mInputManagerInternal;
@@ -1479,7 +1477,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        public void onUidRemoved(int uid) {
            synchronized (ImfLock.class) {
                mLoggedDeniedGetInputMethodWindowVisibleHeightForUid.delete(uid);
                mLoggedDeniedIsInputMethodPickerShownForTestForUid.delete(uid);
            }
        }

@@ -4002,19 +3999,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
    /**
     * A test API for CTS to make sure that the input method menu is showing.
     */
    @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
    public boolean isInputMethodPickerShownForTest() {
        if (mContext.checkCallingPermission(android.Manifest.permission.TEST_INPUT_METHOD)
                != PackageManager.PERMISSION_GRANTED) {
            final int callingUid = Binder.getCallingUid();
            synchronized (ImfLock.class) {
                if (!mLoggedDeniedIsInputMethodPickerShownForTestForUid.get(callingUid)) {
                    EventLog.writeEvent(0x534e4554, "237317525", callingUid, "");
                    mLoggedDeniedIsInputMethodPickerShownForTestForUid.put(callingUid, true);
                }
            }
            throw new SecurityException(
                    "isInputMethodPickerShownForTest requires TEST_INPUT_METHOD permission");
        }
        synchronized (ImfLock.class) {
            return mMenuController.isisInputMethodPickerShownForTestLocked();
        }