Search in sources :

Example 36 with InputMethodInfo

use of android.view.inputmethod.InputMethodInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodSettingValuesWrapper method refreshAllInputMethodAndSubtypes.

void refreshAllInputMethodAndSubtypes() {
    synchronized (mMethodMap) {
        mMethodList.clear();
        mMethodMap.clear();
        final List<InputMethodInfo> imms = mImm.getInputMethodList();
        mMethodList.addAll(imms);
        for (InputMethodInfo imi : imms) {
            mMethodMap.put(imi.getId(), imi);
        }
        updateAsciiCapableEnabledImis();
    }
}
Also used : InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 37 with InputMethodInfo

use of android.view.inputmethod.InputMethodInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodSettingValuesWrapper method updateAsciiCapableEnabledImis.

// TODO: Add a cts to ensure at least one AsciiCapableSubtypeEnabledImis exist
private void updateAsciiCapableEnabledImis() {
    synchronized (mMethodMap) {
        mAsciiCapableEnabledImis.clear();
        final List<InputMethodInfo> enabledImis = mSettings.getEnabledInputMethodListLocked();
        for (final InputMethodInfo imi : enabledImis) {
            final int subtypeCount = imi.getSubtypeCount();
            for (int i = 0; i < subtypeCount; ++i) {
                final InputMethodSubtype subtype = imi.getSubtypeAt(i);
                if (InputMethodUtils.SUBTYPE_MODE_KEYBOARD.equalsIgnoreCase(subtype.getMode()) && subtype.isAsciiCapable()) {
                    mAsciiCapableEnabledImis.add(imi);
                    break;
                }
            }
        }
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 38 with InputMethodInfo

use of android.view.inputmethod.InputMethodInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodSettingValuesWrapper method getCurrentInputMethodName.

CharSequence getCurrentInputMethodName(Context context) {
    synchronized (mMethodMap) {
        final InputMethodInfo imi = mMethodMap.get(mSettings.getSelectedInputMethod());
        if (imi == null) {
            Log.w(TAG, "Invalid selected imi: " + mSettings.getSelectedInputMethod());
            return "";
        }
        final InputMethodSubtype subtype = mImm.getCurrentInputMethodSubtype();
        return InputMethodUtils.getImeAndSubtypeDisplayName(context, imi, subtype);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 39 with InputMethodInfo

use of android.view.inputmethod.InputMethodInfo in project android_frameworks_base by ResurrectionRemix.

the class DevicePolicyManagerService method getPermittedInputMethodsForCurrentUser.

@Override
public List getPermittedInputMethodsForCurrentUser() {
    UserInfo currentUser;
    try {
        currentUser = mInjector.getIActivityManager().getCurrentUser();
    } catch (RemoteException e) {
        Slog.e(LOG_TAG, "Failed to make remote calls to get current user", e);
        // Activity managed is dead, just allow all IMEs
        return null;
    }
    int userId = currentUser.id;
    synchronized (this) {
        List<String> result = null;
        // If we have multiple profiles we return the intersection of the
        // permitted lists. This can happen in cases where we have a device
        // and profile owner.
        int[] profileIds = mUserManager.getProfileIdsWithDisabled(userId);
        for (int profileId : profileIds) {
            // Just loop though all admins, only device or profiles
            // owners can have permitted lists set.
            DevicePolicyData policy = getUserDataUnchecked(profileId);
            final int N = policy.mAdminList.size();
            for (int j = 0; j < N; j++) {
                ActiveAdmin admin = policy.mAdminList.get(j);
                List<String> fromAdmin = admin.permittedInputMethods;
                if (fromAdmin != null) {
                    if (result == null) {
                        result = new ArrayList<String>(fromAdmin);
                    } else {
                        result.retainAll(fromAdmin);
                    }
                }
            }
        }
        // If we have a permitted list add all system input methods.
        if (result != null) {
            InputMethodManager inputMethodManager = mContext.getSystemService(InputMethodManager.class);
            List<InputMethodInfo> imes = inputMethodManager.getInputMethodList();
            long id = mInjector.binderClearCallingIdentity();
            try {
                if (imes != null) {
                    for (InputMethodInfo ime : imes) {
                        ServiceInfo serviceInfo = ime.getServiceInfo();
                        ApplicationInfo applicationInfo = serviceInfo.applicationInfo;
                        if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                            result.add(serviceInfo.packageName);
                        }
                    }
                }
            } finally {
                mInjector.binderRestoreCallingIdentity(id);
            }
        }
        return result;
    }
}
Also used : ApplicationInfo(android.content.pm.ApplicationInfo) UserInfo(android.content.pm.UserInfo) InputMethodManager(android.view.inputmethod.InputMethodManager) ParcelableString(com.android.internal.util.ParcelableString) InputMethodInfo(android.view.inputmethod.InputMethodInfo) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) ServiceInfo(android.content.pm.ServiceInfo) RemoteException(android.os.RemoteException)

Example 40 with InputMethodInfo

use of android.view.inputmethod.InputMethodInfo in project android_frameworks_base by ResurrectionRemix.

the class InputMethodManagerService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    IInputMethod method;
    ClientState client;
    ClientState focusedWindowClient;
    final Printer p = new PrintWriterPrinter(pw);
    synchronized (mMethodMap) {
        p.println("Current Input Method Manager state:");
        int N = mMethodList.size();
        p.println("  Input Methods:");
        for (int i = 0; i < N; i++) {
            InputMethodInfo info = mMethodList.get(i);
            p.println("  InputMethod #" + i + ":");
            info.dump(p, "    ");
        }
        p.println("  Clients:");
        for (ClientState ci : mClients.values()) {
            p.println("  Client " + ci + ":");
            p.println("    client=" + ci.client);
            p.println("    inputContext=" + ci.inputContext);
            p.println("    sessionRequested=" + ci.sessionRequested);
            p.println("    curSession=" + ci.curSession);
        }
        p.println("  mCurMethodId=" + mCurMethodId);
        client = mCurClient;
        p.println("  mCurClient=" + client + " mCurSeq=" + mCurSeq);
        p.println("  mCurFocusedWindow=" + mCurFocusedWindow);
        focusedWindowClient = mCurFocusedWindowClient;
        p.println("  mCurFocusedWindowClient=" + focusedWindowClient);
        p.println("  mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
        p.println("  mCurToken=" + mCurToken);
        p.println("  mCurIntent=" + mCurIntent);
        method = mCurMethod;
        p.println("  mCurMethod=" + mCurMethod);
        p.println("  mEnabledSession=" + mEnabledSession);
        p.println("  mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
        p.println("  mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
        p.println("  mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
        p.println("  mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
        p.println("  mSettingsObserver=" + mSettingsObserver);
        p.println("  mSwitchingController:");
        mSwitchingController.dump(p);
        p.println("  mSettings:");
        mSettings.dumpLocked(p, "    ");
    }
    p.println(" ");
    if (client != null) {
        pw.flush();
        try {
            client.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client dead: " + e);
        }
    } else {
        p.println("No input method client.");
    }
    if (focusedWindowClient != null && client != focusedWindowClient) {
        p.println(" ");
        p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
        p.println("Dumping input method client in the last focused window just in case.");
        p.println(" ");
        pw.flush();
        try {
            focusedWindowClient.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client in focused window dead: " + e);
        }
    }
    p.println(" ");
    if (method != null) {
        pw.flush();
        try {
            method.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method service dead: " + e);
        }
    } else {
        p.println("No input method service.");
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) IInputMethod(com.android.internal.view.IInputMethod) Printer(android.util.Printer) PrintWriterPrinter(android.util.PrintWriterPrinter) RemoteException(android.os.RemoteException) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Aggregations

InputMethodInfo (android.view.inputmethod.InputMethodInfo)309 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)113 ArrayList (java.util.ArrayList)80 RemoteException (android.os.RemoteException)53 ServiceInfo (android.content.pm.ServiceInfo)34 ComponentName (android.content.ComponentName)33 Intent (android.content.Intent)33 Context (android.content.Context)32 InputMethodManager (android.view.inputmethod.InputMethodManager)29 ApplicationInfo (android.content.pm.ApplicationInfo)27 PendingIntent (android.app.PendingIntent)24 Test (org.junit.Test)24 ResolveInfo (android.content.pm.ResolveInfo)19 ImeSubtypeListItem (com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem)15 InputMethodPreference (com.android.settingslib.inputmethod.InputMethodPreference)14 List (java.util.List)14 PackageManager (android.content.pm.PackageManager)13 Drawable (android.graphics.drawable.Drawable)13 SmallTest (android.test.suitebuilder.annotation.SmallTest)12 Printer (android.util.Printer)12