From 9db87f4a1c0cebe2d5d36267081699710a3fd0a4 Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Wed, 13 Dec 2017 22:57:21 -0500 Subject: [PATCH] Bug 1416918 - 4. Remove unused code; r=esawin Remove InputConnectionListener, which was replaced by TextInputController.Delegate, and remove IME_STATE_PLUGIN, which is not used anymore. MozReview-Commit-ID: GCbJXWNCmTk --HG-- extra : rebase_source : c90bc79585ce4c5b9c0de5e07b0ea52531b65e04 --- mobile/android/base/moz.build | 1 - .../mozilla/gecko/GeckoEditableListener.java | 1 - .../mozilla/gecko/GeckoInputConnection.java | 13 ++-------- .../gecko/InputConnectionListener.java | 25 ------------------- widget/android/GeckoEditableSupport.cpp | 6 +---- 5 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputConnectionListener.java diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 3060dd0375e7..3ac3f73ae6a6 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -408,7 +408,6 @@ gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x 'gfx/SurfaceTextureListener.java', 'gfx/VsyncSource.java', 'HapticFeedbackDelegate.java', - 'InputConnectionListener.java', 'InputMethods.java', 'media/AsyncCodec.java', 'media/AsyncCodecFactory.java', diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableListener.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableListener.java index c7ca0e259ad4..342b20aca0d0 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableListener.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableListener.java @@ -34,7 +34,6 @@ interface GeckoEditableListener { int IME_STATE_DISABLED = 0; int IME_STATE_ENABLED = 1; int IME_STATE_PASSWORD = 2; - int IME_STATE_PLUGIN = 3; void notifyIME(int type); void notifyIMEContext(int state, String typeHint, String modeHint, String actionHint, boolean inPrivateBrowsing, boolean isUserAction); diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java index d5e65a3499fc..36a5bc0fb977 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java @@ -552,8 +552,6 @@ import android.view.inputmethod.InputMethodManager; if (mIMEState == IME_STATE_PASSWORD || "password".equalsIgnoreCase(mIMETypeHint)) outAttrs.inputType |= InputType.TYPE_TEXT_VARIATION_PASSWORD; - else if (mIMEState == IME_STATE_PLUGIN) - outAttrs.inputType = InputType.TYPE_NULL; // "send key events" mode else if (mIMETypeHint.equalsIgnoreCase("url") || mIMETypeHint.equalsIgnoreCase("mozAwesomebar")) outAttrs.inputType |= InputType.TYPE_TEXT_VARIATION_URI; @@ -639,12 +637,6 @@ import android.view.inputmethod.InputMethodManager; Log.d(LOGTAG, "IME: CurrentInputMethod=" + mCurrentInputMethod); } - if (mIMEState == IME_STATE_PLUGIN) { - // Since we are using a temporary string as the editable, the selection is at 0 - outAttrs.initialSelStart = 0; - outAttrs.initialSelEnd = 0; - return mKeyInputConnection; - } Editable editable = getEditable(); outAttrs.initialSelStart = Selection.getSelectionStart(editable); outAttrs.initialSelEnd = Selection.getSelectionEnd(editable); @@ -770,8 +762,7 @@ import android.view.inputmethod.InputMethodManager; } private boolean shouldSkipKeyListener(int keyCode, KeyEvent event) { - if (mIMEState == IME_STATE_DISABLED || - mIMEState == IME_STATE_PLUGIN) { + if (mIMEState == IME_STATE_DISABLED) { return true; } // Preserve enter and tab keys for the browser @@ -921,7 +912,7 @@ import android.view.inputmethod.InputMethodManager; @Override // TextInputController.Delegate public synchronized boolean isInputActive() { - // make sure this picks up PASSWORD and PLUGIN states as well + // Make sure this picks up PASSWORD state as well. return mIMEState != IME_STATE_DISABLED; } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputConnectionListener.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputConnectionListener.java deleted file mode 100644 index baddc4ed25cc..000000000000 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputConnectionListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko; - -import android.os.Handler; -import android.view.KeyEvent; -import android.view.inputmethod.EditorInfo; -import android.view.inputmethod.InputConnection; - -/** - * Interface for interacting with GeckoInputConnection from GeckoView. - */ -interface InputConnectionListener -{ - Handler getHandler(Handler defHandler); - InputConnection onCreateInputConnection(EditorInfo outAttrs); - boolean onKeyPreIme(int keyCode, KeyEvent event); - boolean onKeyDown(int keyCode, KeyEvent event); - boolean onKeyLongPress(int keyCode, KeyEvent event); - boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event); - boolean onKeyUp(int keyCode, KeyEvent event); - boolean isIMEEnabled(); -} diff --git a/widget/android/GeckoEditableSupport.cpp b/widget/android/GeckoEditableSupport.cpp index 383ca7529ad6..bb71cc81993f 100644 --- a/widget/android/GeckoEditableSupport.cpp +++ b/widget/android/GeckoEditableSupport.cpp @@ -1339,10 +1339,6 @@ GeckoEditableSupport::WillDispatchKeyboardEvent( NS_IMETHODIMP_(IMENotificationRequests) GeckoEditableSupport::GetIMENotificationRequests() { - // While a plugin has focus, Listener doesn't need any notifications. - if (GetInputContext().mIMEState.mEnabled == IMEState::PLUGIN) { - return IMENotificationRequests(); - } return IMENotificationRequests(IMENotificationRequests::NOTIFY_TEXT_CHANGE); } @@ -1358,7 +1354,7 @@ GeckoEditableSupport::SetInputContext(const InputContext& aContext, mInputContext = aContext; - if (mInputContext.mIMEState.mEnabled == IMEState::ENABLED && + if (mInputContext.mIMEState.mEnabled != IMEState::DISABLED && aAction.UserMightRequestOpenVKB()) { // Don't reset keyboard when we should simply open the vkb mEditable->NotifyIME(GeckoEditableListener::NOTIFY_IME_OPEN_VKB);