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

Commit e0f6c226 authored by Antonio Kantek's avatar Antonio Kantek
Browse files

Clean up InputMethodService

List of clean ups:
* Remove `mIsAutomotive` unused private field;
* Remove `isAutomotive` unused private method;
* Add javadoc to #onAppPrivateCommand empty public method
* Simplify unnecessary fully qualified names
  - 'ViewGroup.LayoutParams.MATCH_PARENT' due to existing static import 'android.view.ViewGroup.LayoutParams.MATCH_PARENT'
  - 'ViewGroup.LayoutParams.WRAP_CONTENT' due to existing static import 'android.view.ViewGroup.LayoutParams.WRAP_CONTENT'
* Replaced 'mHideNavBarForKeyboard' by a local variable.

Bug: 287045146
Test: m

Change-Id: Ie619defc632f2a4b76823a79e7f83471bdfb160e
parent 17e7b884
Loading
Loading
Loading
Loading
+12 −22
Original line number Diff line number Diff line
@@ -644,8 +644,6 @@ public class InputMethodService extends AbstractInputMethodService {

    private InlineSuggestionSessionController mInlineSuggestionSessionController;

    private boolean mHideNavBarForKeyboard;
    private boolean mIsAutomotive;
    private @NonNull OptionalInt mHandwritingRequestId = OptionalInt.empty();
    private InputEventReceiver mHandwritingEventReceiver;
    private Handler mHandler;
@@ -1616,7 +1614,7 @@ public class InputMethodService extends AbstractInputMethodService {
        // shown the first time (cold start).
        mSettingsObserver.shouldShowImeWithHardKeyboard();

        mHideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
        final boolean hideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
                com.android.internal.R.bool.config_hideNavBarForKeyboard);

        initConfigurationTracker();
@@ -1662,7 +1660,7 @@ public class InputMethodService extends AbstractInputMethodService {
            // screen real estate. When this happens, the IME window should animate from the
            // bottom of the screen to reduce the jank that happens from the lack of synchronization
            // between the bottom system window and the IME window.
            if (mHideNavBarForKeyboard) {
            if (hideNavBarForKeyboard) {
                window.setDecorFitsSystemWindows(false);
            }
        }
@@ -2360,9 +2358,7 @@ public class InputMethodService extends AbstractInputMethodService {

    public void setExtractView(View view) {
        mExtractFrame.removeAllViews();
        mExtractFrame.addView(view, new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mExtractFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
        mExtractView = view;
        if (view != null) {
            mExtractEditText = view.findViewById(
@@ -2390,9 +2386,7 @@ public class InputMethodService extends AbstractInputMethodService {
     */
    public void setCandidatesView(View view) {
        mCandidatesFrame.removeAllViews();
        mCandidatesFrame.addView(view, new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        mCandidatesFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
    }

    /**
@@ -2403,9 +2397,7 @@ public class InputMethodService extends AbstractInputMethodService {
     */
    public void setInputView(View view) {
        mInputFrame.removeAllViews();
        mInputFrame.addView(view, new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        mInputFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
        mInputView = view;
    }

@@ -3442,6 +3434,9 @@ public class InputMethodService extends AbstractInputMethodService {
        return false;
    }

    /**
     * Not implemented in this class.
     */
    public void onAppPrivateCommand(String action, Bundle data) {
    }

@@ -4086,11 +4081,6 @@ public class InputMethodService extends AbstractInputMethodService {
                | (isInputViewShown() ? IME_VISIBLE : 0);
    }

    private boolean isAutomotive() {
        return getApplicationContext().getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_AUTOMOTIVE);
    }

    /**
     * Performs a dump of the InputMethodService's internal state.  Override
     * to add your own information to the dump.