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

Commit 857fd9b8 authored by Joe Onorato's avatar Joe Onorato
Browse files

Plumb whether an input view is actually visible or not through from the IME

to the status bar.

Bug: 3391067
Change-Id: I049531155bf7ee0b29874916c0b5b0a45b73c09e
parent e31ecf61
Loading
Loading
Loading
Loading
+58 −1
Original line number Diff line number Diff line
@@ -94224,6 +94224,17 @@
 visibility="public"
>
</constructor>
<method name="getBackDisposition"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getCandidatesHiddenVisibility"
 return="int"
 abstract="false"
@@ -94949,6 +94960,19 @@
<parameter name="charCode" type="char">
</parameter>
</method>
<method name="setBackDisposition"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="disposition" type="int">
</parameter>
</method>
<method name="setCandidatesView"
 return="void"
 abstract="false"
@@ -95075,6 +95099,39 @@
 visibility="public"
>
</method>
<field name="BACK_DISPOSITION_DEFAULT"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="BACK_DISPOSITION_WILL_DISMISS"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="BACK_DISPOSITION_WILL_NOT_DISMISS"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="InputMethodService.InputMethodImpl"
 extends="android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl"
@@ -260471,7 +260528,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="t" type="T">
<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
+45 −9
Original line number Diff line number Diff line
@@ -220,6 +220,33 @@ public class InputMethodService extends AbstractInputMethodService {
    static final String TAG = "InputMethodService";
    static final boolean DEBUG = false;

    /**
     * The back button will close the input window.
     */
    public static final int BACK_DISPOSITION_DEFAULT = 0;  // based on window

    /**
     * This input method will not consume the back key.
     */
    public static final int BACK_DISPOSITION_WILL_NOT_DISMISS = 1; // back

    /**
     * This input method will consume the back key.
     */
    public static final int BACK_DISPOSITION_WILL_DISMISS = 2; // down

    /**
     * @hide
     * The IME is active.  It may or may not be visible.
     */
    public static final int IME_ACTIVE = 0x1;

    /**
     * @hide
     * The IME is visible.
     */
    public static final int IME_VISIBLE = 0x2;

    InputMethodManager mImm;
    
    int mTheme = 0;
@@ -271,6 +298,7 @@ public class InputMethodService extends AbstractInputMethodService {
    boolean mIsInputViewShown;
    
    int mStatusIcon;
    int mBackDisposition;

    final Insets mTmpInsets = new Insets();
    final int[] mTmpLocation = new int[2];
@@ -394,9 +422,9 @@ public class InputMethodService extends AbstractInputMethodService {
                showWindow(true);
            }
            // If user uses hard keyboard, IME button should always be shown.
            if (!onEvaluateInputViewShown()) {
                mImm.setIMEButtonVisible(mToken, true);
            }
            boolean showing = onEvaluateInputViewShown();
            mImm.setImeWindowStatus(mToken, IME_ACTIVE | (showing ? IME_VISIBLE : 0),
                    mBackDisposition);
            if (resultReceiver != null) {
                resultReceiver.send(wasVis != isInputViewShown()
                        ? InputMethodManager.RESULT_SHOWN
@@ -704,9 +732,9 @@ public class InputMethodService extends AbstractInputMethodService {
                hideWindow();
            }
            // If user uses hard keyboard, IME button should always be shown.
            if (!onEvaluateInputViewShown()) {
                mImm.setIMEButtonVisible(mToken, true);
            }
            boolean showing = onEvaluateInputViewShown();
            mImm.setImeWindowStatus(mToken, IME_ACTIVE | (showing ? IME_VISIBLE : 0),
                    mBackDisposition);
        }
    }

@@ -736,6 +764,14 @@ public class InputMethodService extends AbstractInputMethodService {
        return mWindow;
    }
    
    public void setBackDisposition(int disposition) {
        mBackDisposition = disposition;
    }

    public int getBackDisposition() {
        return mBackDisposition;
    }

    /**
     * Return the maximum width, in pixels, available the input method.
     * Input methods are positioned at the bottom of the screen and, unless
@@ -1378,7 +1414,7 @@ public class InputMethodService extends AbstractInputMethodService {

        if (!wasVisible) {
            if (DEBUG) Log.v(TAG, "showWindow: showing!");
            mImm.setIMEButtonVisible(mToken, true);
            mImm.setImeWindowStatus(mToken, IME_ACTIVE, mBackDisposition);
            onWindowShown();
            mWindow.show();
        }
@@ -1394,7 +1430,7 @@ public class InputMethodService extends AbstractInputMethodService {
        }
        mInputViewStarted = false;
        mCandidatesViewStarted = false;
        mImm.setIMEButtonVisible(mToken, false);
        mImm.setImeWindowStatus(mToken, 0, mBackDisposition);
        if (mWindowVisible) {
            mWindow.hide();
            mWindowVisible = false;
+2 −2
Original line number Diff line number Diff line
@@ -531,9 +531,9 @@ public final class InputMethodManager {
    }

    /** @hide */
    public void setIMEButtonVisible(IBinder imeToken, boolean visible) {
    public void setImeWindowStatus(IBinder imeToken, int vis, int backDisposition) {
        try {
            mService.setIMEButtonVisible(imeToken, visible);
            mService.setImeWindowStatus(imeToken, vis, backDisposition);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
+1 −1
Original line number Diff line number Diff line
@@ -32,6 +32,6 @@ oneway interface IStatusBar
    void animateCollapse();
    void setLightsOn(boolean on);
    void setMenuKeyVisible(boolean visible);
    void setIMEButtonVisible(in IBinder token, boolean visible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
}
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ interface IStatusBarService
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
    void setMenuKeyVisible(boolean visible);
    void setIMEButtonVisible(in IBinder token, boolean visible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition);

    // ---- Methods below are for use by the status bar policy services ----
    // You need the STATUS_BAR_SERVICE permission
Loading