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

Commit e9a6f971 authored by Satoshi Kataoka's avatar Satoshi Kataoka
Browse files

Reduce the transaction fee of getEnabledInputMethodSubtypeList

Bug: 8467480
Change-Id: Ic1fddfe433e097041fcb09d1fd341d77d7d8b13b
parent 32c5eb3b
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -613,7 +613,8 @@ public final class InputMethodManager {
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
            boolean allowsImplicitlySelectedSubtypes) {
            boolean allowsImplicitlySelectedSubtypes) {
        try {
        try {
            return mService.getEnabledInputMethodSubtypeList(imi, allowsImplicitlySelectedSubtypes);
            return mService.getEnabledInputMethodSubtypeList(
                    imi == null ? null : imi.getId(), allowsImplicitlySelectedSubtypes);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw new RuntimeException(e);
            throw new RuntimeException(e);
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ import com.android.internal.view.IInputMethodClient;
interface IInputMethodManager {
interface IInputMethodManager {
    List<InputMethodInfo> getInputMethodList();
    List<InputMethodInfo> getInputMethodList();
    List<InputMethodInfo> getEnabledInputMethodList();
    List<InputMethodInfo> getEnabledInputMethodList();
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in InputMethodInfo imi,
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId,
            boolean allowsImplicitlySelectedSubtypes);
            boolean allowsImplicitlySelectedSubtypes);
    InputMethodSubtype getLastInputMethodSubtype();
    InputMethodSubtype getLastInputMethodSubtype();
    // TODO: We should change the return type from List to List<Parcelable>
    // TODO: We should change the return type from List to List<Parcelable>
+10 −4
Original line number Original line Diff line number Diff line
@@ -969,19 +969,25 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    }
    }


    /**
    /**
     * @param imi if null, returns enabled subtypes for the current imi
     * @param imiId if null, returns enabled subtypes for the current imi
     * @return enabled subtypes of the specified imi
     * @return enabled subtypes of the specified imi
     */
     */
    @Override
    @Override
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi,
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
            boolean allowsImplicitlySelectedSubtypes) {
            boolean allowsImplicitlySelectedSubtypes) {
        // TODO: Make this work even for non-current users?
        // TODO: Make this work even for non-current users?
        if (!calledFromValidUser()) {
        if (!calledFromValidUser()) {
            return Collections.emptyList();
            return Collections.<InputMethodSubtype>emptyList();
        }
        }
        synchronized (mMethodMap) {
        synchronized (mMethodMap) {
            if (imi == null && mCurMethodId != null) {
            final InputMethodInfo imi;
            if (imiId == null && mCurMethodId != null) {
                imi = mMethodMap.get(mCurMethodId);
                imi = mMethodMap.get(mCurMethodId);
            } else {
                imi = mMethodMap.get(imiId);
            }
            if (imi == null) {
                return Collections.<InputMethodSubtype>emptyList();
            }
            }
            return mSettings.getEnabledInputMethodSubtypeListLocked(
            return mSettings.getEnabledInputMethodSubtypeListLocked(
                    mContext, imi, allowsImplicitlySelectedSubtypes);
                    mContext, imi, allowsImplicitlySelectedSubtypes);