From 7a78127a56bc427fbc690cb0561c415a81064e64 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 25 Apr 2014 14:56:30 -0700 Subject: [PATCH] Remove unnecessary reference to LatinIME Change-Id: Idbb45c504499d39bbf272fae84ea71a83bf4dd69 --- .../accessibility/AccessibilityEntityProvider.java | 8 ++------ .../accessibility/AccessibilityUtils.java | 7 +++---- .../accessibility/AccessibleKeyboardViewProxy.java | 13 +++++-------- .../android/inputmethod/keyboard/KeyboardId.java | 2 +- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java index 720cf6b2a..ec1ab3565 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.graphics.Rect; -import android.inputmethodservice.InputMethodService; import android.os.Bundle; import android.support.v4.view.ViewCompat; import android.support.v4.view.accessibility.AccessibilityEventCompat; @@ -52,7 +51,6 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider private static final String TAG = AccessibilityEntityProvider.class.getSimpleName(); private static final int UNDEFINED = Integer.MIN_VALUE; - private final InputMethodService mInputMethodService; private final KeyCodeDescriptionMapper mKeyCodeDescriptionMapper; private final AccessibilityUtils mAccessibilityUtils; @@ -71,9 +69,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider /** The current keyboard. */ private Keyboard mKeyboard; - public AccessibilityEntityProvider(final KeyboardView keyboardView, - final InputMethodService inputMethod) { - mInputMethodService = inputMethod; + public AccessibilityEntityProvider(final KeyboardView keyboardView) { mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance(); mAccessibilityUtils = AccessibilityUtils.getInstance(); setView(keyboardView); @@ -295,7 +291,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider * @return The context-specific description of the key. */ private String getKeyDescription(final Key key) { - final EditorInfo editorInfo = mInputMethodService.getCurrentInputEditorInfo(); + final EditorInfo editorInfo = mKeyboard.mId.mEditorInfo; final boolean shouldObscure = mAccessibilityUtils.shouldObscureInput(editorInfo); final SettingsValues currentSettings = Settings.getInstance().getCurrent(); final String keyCodeDescription = mKeyCodeDescriptionMapper.getDescriptionForKey( diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java index 216a825e0..bc094b117 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.inputmethodservice.InputMethodService; import android.media.AudioManager; import android.os.Build; import android.os.SystemClock; @@ -63,13 +62,13 @@ public final class AccessibilityUtils { */ private static final boolean ENABLE_ACCESSIBILITY = true; - public static void init(final InputMethodService inputMethod) { + public static void init(final Context context) { if (!ENABLE_ACCESSIBILITY) return; // These only need to be initialized if the kill switch is off. - sInstance.initInternal(inputMethod); + sInstance.initInternal(context); KeyCodeDescriptionMapper.init(); - AccessibleKeyboardViewProxy.init(inputMethod); + AccessibleKeyboardViewProxy.init(context); } public static AccessibilityUtils getInstance() { diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index d2031d155..322127a12 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.inputmethodservice.InputMethodService; import android.os.SystemClock; import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.ViewCompat; @@ -55,7 +54,6 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp KEYBOARD_MODE_RES_IDS.put(KeyboardId.MODE_URL, R.string.keyboard_mode_url); } - private InputMethodService mInputMethod; private MainKeyboardView mView; private Keyboard mKeyboard; private AccessibilityEntityProvider mAccessibilityNodeProvider; @@ -71,8 +69,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp private int mLastKeyboardMode = KEYBOARD_IS_HIDDEN; private static final int KEYBOARD_IS_HIDDEN = -1; - public static void init(final InputMethodService inputMethod) { - sInstance.initInternal(inputMethod); + public static void init(final Context context) { + sInstance.initInternal(context); } public static AccessibleKeyboardViewProxy getInstance() { @@ -83,9 +81,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp // Not publicly instantiable. } - private void initInternal(final InputMethodService inputMethod) { - mInputMethod = inputMethod; - mEdgeSlop = inputMethod.getResources().getDimensionPixelSize( + private void initInternal(final Context context) { + mEdgeSlop = context.getResources().getDimensionPixelSize( R.dimen.config_accessibility_edge_slop); } @@ -285,7 +282,7 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp // will call this method multiple times it is a good practice to // cache the provider instance. if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView, mInputMethod); + mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView); } return mAccessibilityNodeProvider; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index 02beb3f11..93a55fe6a 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -68,7 +68,7 @@ public final class KeyboardId { public final int mHeight; public final int mMode; public final int mElementId; - private final EditorInfo mEditorInfo; + public final EditorInfo mEditorInfo; public final boolean mClobberSettingsKey; public final boolean mSupportsSwitchingToShortcutIme; public final boolean mLanguageSwitchKeyEnabled;