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

Commit 658c7b89 authored by Satoshi Kataoka's avatar Satoshi Kataoka
Browse files

Introduce an API to get the recommended height of the InputMethodWindow

Bug: 11035379
Bug: 5137498

Change-Id: I0e920ee79c526c3aea6872b063cf294e2ab081c8
parent 8bca372a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11629,6 +11629,7 @@ package android.inputmethodservice {
    method public android.view.inputmethod.InputConnection getCurrentInputConnection();
    method public android.view.inputmethod.EditorInfo getCurrentInputEditorInfo();
    method public boolean getCurrentInputStarted();
    method public int getInputMethodWindowRecommendedHeight();
    method public android.view.LayoutInflater getLayoutInflater();
    method public int getMaxWidth();
    method public java.lang.CharSequence getTextForImeAction(int);
+15 −0
Original line number Diff line number Diff line
@@ -2321,6 +2321,21 @@ public class InputMethodService extends AbstractInputMethodService {
        }
    }

    /**
     * @return The recommended height of the input method window.
     * An IME author can get the last input method's height as the recommended height
     * by calling this in
     * {@link android.inputmethodservice.InputMethodService#onStartInputView(EditorInfo, boolean)}.
     * If you don't need to use a predefined fixed height, you can avoid the window-resizing of IME
     * switching by using this value as a visible inset height. It's efficient for the smooth
     * transition between different IMEs. However, note that this may return 0 (or possibly
     * unexpectedly low height). You should thus avoid relying on the return value of this method
     * all the time. Please make sure to use a reasonable height for the IME.
     */
    public int getInputMethodWindowRecommendedHeight() {
        return mImm.getInputMethodWindowVisibleHeight();
    }

    /**
     * Performs a dump of the InputMethodService's internal state.  Override
     * to add your own information to the dump.
+5 −0
Original line number Diff line number Diff line
@@ -1162,6 +1162,11 @@ public interface WindowManagerPolicy {
     */
    public void setLastInputMethodWindowLw(WindowState ime, WindowState target);

    /**
     * @return The current height of the input method window.
     */
    public int getInputMethodWindowVisibleHeightLw();

    /**
     * Called when the current user changes. Guaranteed to be called before the broadcast
     * of the new user id is made to all listeners.
+15 −0
Original line number Diff line number Diff line
@@ -1839,6 +1839,21 @@ public final class InputMethodManager {
        }
    }

    /**
     * @return The current height of the input method window.
     * @hide
     */
    public int getInputMethodWindowVisibleHeight() {
        synchronized (mH) {
            try {
                return mService.getInputMethodWindowVisibleHeight();
            } catch (RemoteException e) {
                Log.w(TAG, "IME died: " + mCurId, e);
                return 0;
            }
        }
    }

    /**
     * Force switch to the last used input method and subtype. If the last input method didn't have
     * any subtypes, the framework will simply switch to the last input method with no subtype
+1 −0
Original line number Diff line number Diff line
@@ -74,4 +74,5 @@ interface IInputMethodManager {
    boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
    boolean setInputMethodEnabled(String id, boolean enabled);
    oneway void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
    int getInputMethodWindowVisibleHeight();
}
Loading