Remove InputMethodInfoCompatWrapper
Bug: 6129704 Change-Id: I0eca1ee7d1769ddc44f93c50f0723196299bc6d6
This commit is contained in:
parent
01127fad51
commit
0dbf6ab53d
4 changed files with 26 additions and 116 deletions
|
@ -1,77 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.inputmethod.compat;
|
|
||||||
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ServiceInfo;
|
|
||||||
import android.view.inputmethod.InputMethodInfo;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
public class InputMethodInfoCompatWrapper {
|
|
||||||
private final InputMethodInfo mImi;
|
|
||||||
private static final Method METHOD_getSubtypeAt = CompatUtils.getMethod(
|
|
||||||
InputMethodInfo.class, "getSubtypeAt", int.class);
|
|
||||||
private static final Method METHOD_getSubtypeCount = CompatUtils.getMethod(
|
|
||||||
InputMethodInfo.class, "getSubtypeCount");
|
|
||||||
|
|
||||||
public InputMethodInfoCompatWrapper(InputMethodInfo imi) {
|
|
||||||
mImi = imi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputMethodInfo getInputMethodInfo() {
|
|
||||||
return mImi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return mImi.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackageName() {
|
|
||||||
return mImi.getPackageName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServiceInfo getServiceInfo() {
|
|
||||||
return mImi.getServiceInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubtypeCount() {
|
|
||||||
return (Integer) CompatUtils.invoke(mImi, 0, METHOD_getSubtypeCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputMethodSubtypeCompatWrapper getSubtypeAt(int index) {
|
|
||||||
return new InputMethodSubtypeCompatWrapper(CompatUtils.invoke(mImi, null,
|
|
||||||
METHOD_getSubtypeAt, index));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CharSequence loadLabel(PackageManager pm) {
|
|
||||||
return mImi.loadLabel(pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (o instanceof InputMethodInfoCompatWrapper) {
|
|
||||||
return mImi.equals(((InputMethodInfoCompatWrapper)o).mImi);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return mImi.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,11 +16,7 @@
|
||||||
|
|
||||||
package com.android.inputmethod.compat;
|
package com.android.inputmethod.compat;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.DialogInterface.OnClickListener;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
@ -29,14 +25,12 @@ import android.util.Log;
|
||||||
import android.view.inputmethod.InputMethodInfo;
|
import android.view.inputmethod.InputMethodInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.R;
|
|
||||||
import com.android.inputmethod.latin.SubtypeSwitcher;
|
import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||||
import com.android.inputmethod.latin.SubtypeUtils;
|
import com.android.inputmethod.latin.SubtypeUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -106,9 +100,9 @@ public class InputMethodManagerCompatWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InputMethodSubtypeCompatWrapper> getEnabledInputMethodSubtypeList(
|
public List<InputMethodSubtypeCompatWrapper> getEnabledInputMethodSubtypeList(
|
||||||
InputMethodInfoCompatWrapper imi, boolean allowsImplicitlySelectedSubtypes) {
|
InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) {
|
||||||
Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
|
Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
|
||||||
(imi != null ? imi.getInputMethodInfo() : null), allowsImplicitlySelectedSubtypes);
|
imi, allowsImplicitlySelectedSubtypes);
|
||||||
if (retval == null || !(retval instanceof List<?>) || ((List<?>)retval).isEmpty()) {
|
if (retval == null || !(retval instanceof List<?>) || ((List<?>)retval).isEmpty()) {
|
||||||
if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
|
if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
|
||||||
// Returns an empty list
|
// Returns an empty list
|
||||||
|
@ -131,7 +125,7 @@ public class InputMethodManagerCompatWrapper {
|
||||||
return CompatUtils.copyInputMethodSubtypeListToWrapper(retval);
|
return CompatUtils.copyInputMethodSubtypeListToWrapper(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputMethodInfoCompatWrapper getLatinImeInputMethodInfo() {
|
private InputMethodInfo getLatinImeInputMethodInfo() {
|
||||||
if (TextUtils.isEmpty(mLatinImePackageName))
|
if (TextUtils.isEmpty(mLatinImePackageName))
|
||||||
return null;
|
return null;
|
||||||
return SubtypeUtils.getInputMethodInfo(mLatinImePackageName);
|
return SubtypeUtils.getInputMethodInfo(mLatinImePackageName);
|
||||||
|
@ -146,7 +140,7 @@ public class InputMethodManagerCompatWrapper {
|
||||||
return new InputMethodSubtypeCompatWrapper(0, 0, inputLocale.toString(), mode, "");
|
return new InputMethodSubtypeCompatWrapper(0, 0, inputLocale.toString(), mode, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>
|
public Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
|
||||||
getShortcutInputMethodsAndSubtypes() {
|
getShortcutInputMethodsAndSubtypes() {
|
||||||
Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
|
Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
|
||||||
if (retval == null || !(retval instanceof Map<?, ?>) || ((Map<?, ?>)retval).isEmpty()) {
|
if (retval == null || !(retval instanceof Map<?, ?>) || ((Map<?, ?>)retval).isEmpty()) {
|
||||||
|
@ -156,12 +150,12 @@ public class InputMethodManagerCompatWrapper {
|
||||||
}
|
}
|
||||||
// Creates dummy subtypes
|
// Creates dummy subtypes
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
InputMethodInfoCompatWrapper imi = getLatinImeInputMethodInfo();
|
InputMethodInfo imi = getLatinImeInputMethodInfo();
|
||||||
InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE);
|
InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE);
|
||||||
if (imi != null && voiceSubtype != null) {
|
if (imi != null && voiceSubtype != null) {
|
||||||
Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>
|
Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>
|
||||||
shortcutMap =
|
shortcutMap =
|
||||||
new HashMap<InputMethodInfoCompatWrapper,
|
new HashMap<InputMethodInfo,
|
||||||
List<InputMethodSubtypeCompatWrapper>>();
|
List<InputMethodSubtypeCompatWrapper>>();
|
||||||
List<InputMethodSubtypeCompatWrapper> subtypeList =
|
List<InputMethodSubtypeCompatWrapper> subtypeList =
|
||||||
new ArrayList<InputMethodSubtypeCompatWrapper>();
|
new ArrayList<InputMethodSubtypeCompatWrapper>();
|
||||||
|
@ -172,15 +166,15 @@ public class InputMethodManagerCompatWrapper {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
|
Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
|
||||||
new HashMap<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>();
|
new HashMap<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>>();
|
||||||
final Map<?, ?> retvalMap = (Map<?, ?>)retval;
|
final Map<?, ?> retvalMap = (Map<?, ?>)retval;
|
||||||
for (Object key : retvalMap.keySet()) {
|
for (Object key : retvalMap.keySet()) {
|
||||||
if (!(key instanceof InputMethodInfo)) {
|
if (!(key instanceof InputMethodInfo)) {
|
||||||
Log.e(TAG, "Class type error.");
|
Log.e(TAG, "Class type error.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
shortcutMap.put(new InputMethodInfoCompatWrapper((InputMethodInfo)key),
|
shortcutMap.put((InputMethodInfo)key,
|
||||||
CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key)));
|
CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key)));
|
||||||
}
|
}
|
||||||
return shortcutMap;
|
return shortcutMap;
|
||||||
|
@ -207,13 +201,9 @@ public class InputMethodManagerCompatWrapper {
|
||||||
onlyCurrentIme);
|
onlyCurrentIme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InputMethodInfoCompatWrapper> getEnabledInputMethodList() {
|
public List<InputMethodInfo> getEnabledInputMethodList() {
|
||||||
if (mImm == null) return null;
|
if (mImm == null) return null;
|
||||||
List<InputMethodInfoCompatWrapper> imis = new ArrayList<InputMethodInfoCompatWrapper>();
|
return mImm.getEnabledInputMethodList();
|
||||||
for (InputMethodInfo imi : mImm.getEnabledInputMethodList()) {
|
|
||||||
imis.add(new InputMethodInfoCompatWrapper(imi));
|
|
||||||
}
|
|
||||||
return imis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInputMethodPicker() {
|
public void showInputMethodPicker() {
|
||||||
|
|
|
@ -29,14 +29,13 @@ import android.os.AsyncTask;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.inputmethod.InputMethodInfo;
|
||||||
|
|
||||||
import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
|
|
||||||
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
|
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
|
||||||
import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
|
import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
|
||||||
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -47,7 +46,6 @@ public class SubtypeSwitcher {
|
||||||
|
|
||||||
public static final String KEYBOARD_MODE = "keyboard";
|
public static final String KEYBOARD_MODE = "keyboard";
|
||||||
private static final char LOCALE_SEPARATOR = '_';
|
private static final char LOCALE_SEPARATOR = '_';
|
||||||
private static final String VOICE_MODE = "voice";
|
|
||||||
private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
|
private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
|
||||||
"requireNetworkConnectivity";
|
"requireNetworkConnectivity";
|
||||||
|
|
||||||
|
@ -68,7 +66,7 @@ public class SubtypeSwitcher {
|
||||||
// Variants which should be changed only by reload functions.
|
// Variants which should be changed only by reload functions.
|
||||||
private boolean mNeedsToDisplayLanguage;
|
private boolean mNeedsToDisplayLanguage;
|
||||||
private boolean mIsSystemLanguageSameAsInputLanguage;
|
private boolean mIsSystemLanguageSameAsInputLanguage;
|
||||||
private InputMethodInfoCompatWrapper mShortcutInputMethodInfo;
|
private InputMethodInfo mShortcutInputMethodInfo;
|
||||||
private InputMethodSubtypeCompatWrapper mShortcutSubtype;
|
private InputMethodSubtypeCompatWrapper mShortcutSubtype;
|
||||||
private List<InputMethodSubtypeCompatWrapper> mAllEnabledSubtypesOfCurrentInputMethod;
|
private List<InputMethodSubtypeCompatWrapper> mAllEnabledSubtypesOfCurrentInputMethod;
|
||||||
private InputMethodSubtypeCompatWrapper mCurrentSubtype;
|
private InputMethodSubtypeCompatWrapper mCurrentSubtype;
|
||||||
|
@ -168,11 +166,11 @@ public class SubtypeSwitcher {
|
||||||
+ ", " + mShortcutSubtype.getMode())));
|
+ ", " + mShortcutSubtype.getMode())));
|
||||||
}
|
}
|
||||||
// TODO: Update an icon for shortcut IME
|
// TODO: Update an icon for shortcut IME
|
||||||
final Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>> shortcuts =
|
final Map<InputMethodInfo, List<InputMethodSubtypeCompatWrapper>> shortcuts =
|
||||||
mImm.getShortcutInputMethodsAndSubtypes();
|
mImm.getShortcutInputMethodsAndSubtypes();
|
||||||
mShortcutInputMethodInfo = null;
|
mShortcutInputMethodInfo = null;
|
||||||
mShortcutSubtype = null;
|
mShortcutSubtype = null;
|
||||||
for (InputMethodInfoCompatWrapper imi : shortcuts.keySet()) {
|
for (InputMethodInfo imi : shortcuts.keySet()) {
|
||||||
List<InputMethodSubtypeCompatWrapper> subtypes = shortcuts.get(imi);
|
List<InputMethodSubtypeCompatWrapper> subtypes = shortcuts.get(imi);
|
||||||
// TODO: Returns the first found IMI for now. Should handle all shortcuts as
|
// TODO: Returns the first found IMI for now. Should handle all shortcuts as
|
||||||
// appropriate.
|
// appropriate.
|
||||||
|
@ -320,8 +318,7 @@ public class SubtypeSwitcher {
|
||||||
return getSubtypeIcon(mShortcutInputMethodInfo, mShortcutSubtype);
|
return getSubtypeIcon(mShortcutInputMethodInfo, mShortcutSubtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getSubtypeIcon(
|
private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtypeCompatWrapper subtype) {
|
||||||
InputMethodInfoCompatWrapper imi, InputMethodSubtypeCompatWrapper subtype) {
|
|
||||||
final PackageManager pm = mService.getPackageManager();
|
final PackageManager pm = mService.getPackageManager();
|
||||||
if (imi != null) {
|
if (imi != null) {
|
||||||
final String imiPackageName = imi.getPackageName();
|
final String imiPackageName = imi.getPackageName();
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
package com.android.inputmethod.latin;
|
package com.android.inputmethod.latin;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.view.inputmethod.InputMethodInfo;
|
||||||
|
|
||||||
import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
|
|
||||||
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
|
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
|
||||||
import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
|
import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class SubtypeUtils {
|
||||||
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
||||||
if (imm == null) return false;
|
if (imm == null) return false;
|
||||||
|
|
||||||
final InputMethodInfoCompatWrapper myImi = getInputMethodInfo(context.getPackageName());
|
final InputMethodInfo myImi = getInputMethodInfo(context.getPackageName());
|
||||||
final List<InputMethodSubtypeCompatWrapper> subtypes =
|
final List<InputMethodSubtypeCompatWrapper> subtypes =
|
||||||
imm.getEnabledInputMethodSubtypeList(myImi, true);
|
imm.getEnabledInputMethodSubtypeList(myImi, true);
|
||||||
for (final InputMethodSubtypeCompatWrapper subtype : subtypes) {
|
for (final InputMethodSubtypeCompatWrapper subtype : subtypes) {
|
||||||
|
@ -52,26 +52,26 @@ public class SubtypeUtils {
|
||||||
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
||||||
if (imm == null) return false;
|
if (imm == null) return false;
|
||||||
|
|
||||||
final List<InputMethodInfoCompatWrapper> enabledImis = imm.getEnabledInputMethodList();
|
final List<InputMethodInfo> enabledImis = imm.getEnabledInputMethodList();
|
||||||
return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, enabledImis);
|
return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, enabledImis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasMultipleEnabledSubtypesInThisIme(Context context,
|
public static boolean hasMultipleEnabledSubtypesInThisIme(Context context,
|
||||||
final boolean shouldIncludeAuxiliarySubtypes) {
|
final boolean shouldIncludeAuxiliarySubtypes) {
|
||||||
final InputMethodInfoCompatWrapper myImi = getInputMethodInfo(context.getPackageName());
|
final InputMethodInfo myImi = getInputMethodInfo(context.getPackageName());
|
||||||
final List<InputMethodInfoCompatWrapper> imiList = Collections.singletonList(myImi);
|
final List<InputMethodInfo> imiList = Collections.singletonList(myImi);
|
||||||
return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, imiList);
|
return hasMultipleEnabledSubtypes(shouldIncludeAuxiliarySubtypes, imiList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasMultipleEnabledSubtypes(final boolean shouldIncludeAuxiliarySubtypes,
|
private static boolean hasMultipleEnabledSubtypes(final boolean shouldIncludeAuxiliarySubtypes,
|
||||||
List<InputMethodInfoCompatWrapper> imiList) {
|
List<InputMethodInfo> imiList) {
|
||||||
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
||||||
if (imm == null) return false;
|
if (imm == null) return false;
|
||||||
|
|
||||||
// Number of the filtered IMEs
|
// Number of the filtered IMEs
|
||||||
int filteredImisCount = 0;
|
int filteredImisCount = 0;
|
||||||
|
|
||||||
for (InputMethodInfoCompatWrapper imi : imiList) {
|
for (InputMethodInfo imi : imiList) {
|
||||||
// We can return true immediately after we find two or more filtered IMEs.
|
// We can return true immediately after we find two or more filtered IMEs.
|
||||||
if (filteredImisCount > 1) return true;
|
if (filteredImisCount > 1) return true;
|
||||||
final List<InputMethodSubtypeCompatWrapper> subtypes =
|
final List<InputMethodSubtypeCompatWrapper> subtypes =
|
||||||
|
@ -120,13 +120,13 @@ public class SubtypeUtils {
|
||||||
return getInputMethodInfo(packageName).getId();
|
return getInputMethodInfo(packageName).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputMethodInfoCompatWrapper getInputMethodInfo(String packageName) {
|
public static InputMethodInfo getInputMethodInfo(String packageName) {
|
||||||
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance();
|
||||||
if (imm == null) {
|
if (imm == null) {
|
||||||
throw new RuntimeException("Input method manager not found");
|
throw new RuntimeException("Input method manager not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final InputMethodInfoCompatWrapper imi : imm.getEnabledInputMethodList()) {
|
for (final InputMethodInfo imi : imm.getEnabledInputMethodList()) {
|
||||||
if (imi.getPackageName().equals(packageName))
|
if (imi.getPackageName().equals(packageName))
|
||||||
return imi;
|
return imi;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue