Bug 1446729 - 3. Move GeckoEditable/InputConnection to o.m.geckoview; r=esawin

Moving GeckoEditable and GeckoInputConnection to o.m.geckoview lets us
make the interfaces inside SessionTextInput package-private, so they
don't show up in the docs.

MozReview-Commit-ID: 1C8olyqj4sX

--HG--
rename : mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java => mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java
rename : mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java => mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoInputConnection.java
extra : rebase_source : d1538761e494f5e44a111e65febfbbf6e90dc1f3
This commit is contained in:
Jim Chen 2018-03-18 05:38:55 -04:00
parent dca37fe66f
commit bc927af5f3
5 changed files with 26 additions and 36 deletions

View File

@ -8,7 +8,6 @@ package org.mozilla.gecko;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.mozglue.JNIObject;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.SessionTextInput;
import android.graphics.RectF;
import android.os.IBinder;
@ -27,6 +26,8 @@ public final class GeckoEditableChild extends JNIObject implements IGeckoEditabl
private static final boolean DEBUG = false;
private static final String LOGTAG = "GeckoEditableChild";
private static final int NOTIFY_IME_TO_CANCEL_COMPOSITION = 9;
private final class RemoteChild extends IGeckoEditableChild.Stub {
@Override // IGeckoEditableChild
public void onKeyEvent(int action, int keyCode, int scanCode, int metaState,
@ -132,11 +133,9 @@ public final class GeckoEditableChild extends JNIObject implements IGeckoEditabl
private void notifyIME(final int type) {
if (DEBUG) {
ThreadUtils.assertOnGeckoThread();
Log.d(LOGTAG, "notifyIME(" + GeckoEditable.getConstantName(
SessionTextInput.EditableListener.class,
"NOTIFY_IME_", type) + ")");
Log.d(LOGTAG, "notifyIME(" + type + ")");
}
if (type == SessionTextInput.EditableListener.NOTIFY_IME_TO_CANCEL_COMPOSITION) {
if (type == NOTIFY_IME_TO_CANCEL_COMPOSITION) {
// Composition should have been canceled on the parent side through text
// update notifications. We cannot verify that here because we don't
// keep track of spans on the child side, but it's simple to add the
@ -158,9 +157,7 @@ public final class GeckoEditableChild extends JNIObject implements IGeckoEditabl
final int flags) {
if (DEBUG) {
ThreadUtils.assertOnGeckoThread();
Log.d(LOGTAG, "notifyIMEContext(" + GeckoEditable.getConstantName(
SessionTextInput.EditableListener.class,
"IME_STATE_", state) + ", \"" +
Log.d(LOGTAG, "notifyIMEContext(" + state + ", \"" +
typeHint + "\", \"" + modeHint + "\", \"" + actionHint +
"\", 0x" + Integer.toHexString(flags) + ")");
}
@ -195,12 +192,8 @@ public final class GeckoEditableChild extends JNIObject implements IGeckoEditabl
throws RemoteException {
if (DEBUG) {
ThreadUtils.assertOnGeckoThread();
StringBuilder sb = new StringBuilder("onTextChange(");
GeckoEditable.debugAppend(sb, text);
sb.append(", ").append(start).append(", ")
.append(unboundedOldEnd).append(", ")
.append(unboundedNewEnd).append(")");
Log.d(LOGTAG, sb.toString());
Log.d(LOGTAG, "onTextChange(" + text + ", " + start + ", " +
unboundedOldEnd + ", " + unboundedNewEnd + ")");
}
if (start < 0 || start > unboundedOldEnd) {

View File

@ -3,20 +3,20 @@
* 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;
package org.mozilla.geckoview;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.GeckoEditableChild;
import org.mozilla.gecko.IGeckoEditableChild;
import org.mozilla.gecko.IGeckoEditableParent;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.util.ThreadUtils.AssertBehavior;
import org.mozilla.geckoview.TextInputController;
import android.graphics.RectF;
import android.os.Handler;
@ -25,7 +25,6 @@ import android.os.Looper;
import android.os.RemoteException;
import android.text.Editable;
import android.text.InputFilter;
import android.text.NoCopySpan;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
@ -43,7 +42,7 @@ import android.view.KeyEvent;
* The field mText contains the actual underlying
* SpannableStringBuilder/Editable that contains our text.
*/
public final class GeckoEditable
/* package */ final class GeckoEditable
extends IGeckoEditableParent.Stub
implements InvocationHandler,
Editable,

View File

@ -3,17 +3,13 @@
* 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 java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
package org.mozilla.geckoview;
import org.mozilla.gecko.Clipboard;
import org.mozilla.gecko.InputMethods;
import org.mozilla.gecko.util.ActivityUtils;
import org.mozilla.gecko.util.GamepadUtils;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.SessionTextInput;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
@ -46,7 +42,11 @@ import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
public class GeckoInputConnection
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/* package */ final class GeckoInputConnection
extends BaseInputConnection
implements SessionTextInput.Delegate,
SessionTextInput.EditableListener {

View File

@ -6,9 +6,7 @@
package org.mozilla.geckoview;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.GeckoEditable;
import org.mozilla.gecko.GeckoEditableChild;
import org.mozilla.gecko.GeckoInputConnection;
import org.mozilla.gecko.IGeckoEditableParent;
import org.mozilla.gecko.NativeQueue;
import org.mozilla.gecko.util.ThreadUtils;
@ -31,8 +29,8 @@ import android.view.inputmethod.InputConnection;
*/
public final class SessionTextInput {
// Interface to access GeckoInputConnection from TextInputController.
public interface Delegate {
// Interface to access GeckoInputConnection from SessionTextInput.
/* package */ interface Delegate {
View getView();
Handler getHandler(Handler defHandler);
InputConnection onCreateInputConnection(EditorInfo attrs);
@ -45,7 +43,7 @@ public final class SessionTextInput {
}
// Interface to access GeckoEditable from GeckoInputConnection.
public interface EditableClient {
/* package */ interface EditableClient {
// The following value is used by requestCursorUpdates
// ONE_SHOT calls updateCompositionRects() after getting current composing
// character rects.
@ -66,7 +64,7 @@ public final class SessionTextInput {
}
// Interface to access GeckoInputConnection from GeckoEditable.
public interface EditableListener {
/* package */ interface EditableListener {
// IME notification type for notifyIME(), corresponding to NotificationToIME enum.
@WrapForJNI final int NOTIFY_IME_OF_TOKEN = -3;
@WrapForJNI final int NOTIFY_IME_OPEN_VKB = -2;

View File

@ -40,9 +40,9 @@ public class testANRReporter extends OldBaseTest {
+ " | sysTid=3485 nice=0 sched=0/0 cgrp=apps handle=1074852180\n"
+ " | state=S schedstat=( 0 0 0 ) utm=1065 stm=152 core=0\n"
+ " at java.lang.Object.wait(Native Method)\n"
+ " - waiting on <0x427ab340> (a org.mozilla.gecko.GeckoEditable$5)\n"
+ " - waiting on <0x427ab340> (a org.mozilla.geckoview.GeckoEditable$5)\n"
+ " at java.lang.Object.wait(Object.java:364)\n"
+ " at org.mozilla.gecko.GeckoEditable$5.run(GeckoEditable.java:746)\n"
+ " at org.mozilla.geckoview.GeckoEditable$5.run(GeckoEditable.java:746)\n"
+ " at android.os.Handler.handleCallback(Handler.java:733)\n"
+ " at android.os.Handler.dispatchMessage(Handler.java:95)\n"
+ " at android.os.Looper.loop(Looper.java:137)\n"