From db56b3c9aa14b633a51e6d873d4dc168ab9177d1 Mon Sep 17 00:00:00 2001
From: Rami Potinkara <rami.potinkara@qt.io>
Date: Sat, 17 Jun 2023 13:58:44 +0300
Subject: [PATCH] WIP extractedittext fullscreen portrait fix

Overwrite to extend with EditText and in addition
overwrite BaseInputConnection. This made this use case
to work. But work continues

Task-number: QTBUG-109367
Change-Id: Id389679ac64b6223a809844f59f042cce162ae52
---
 .../qt5/android/QtActivityDelegate.java       |  86 ++++++++-
 .../org/qtproject/qt5/android/QtEditText.java | 173 +++++++++++++++++-
 .../qt5/android/QtInputConnection.java        |  42 +++++
 .../android/qandroidinputcontext.cpp          | 111 ++++++++++-
 4 files changed, 397 insertions(+), 15 deletions(-)

diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 1218164d05..6f4b96985d 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -100,6 +100,9 @@ import java.util.Objects;
 
 import org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate;
 
+import android.util.Log; //RAMPE
+import android.view.inputmethod.ExtractedText; //RAMPE
+
 public class QtActivityDelegate
 {
     private Activity m_activity = null;
@@ -242,22 +245,32 @@ public class QtActivityDelegate
 
     public boolean setKeyboardVisibility(boolean visibility, long timeStamp)
     {
-        if (m_showHideTimeStamp > timeStamp)
+        Log.w(QtNative.QtTAG, "RAMPE qad::setKeyboardVisibility ->");        
+        if (m_showHideTimeStamp > timeStamp){
+            Log.w(QtNative.QtTAG, "RAMPE qad::setKeyboardVisibility 1 <-");        
             return false;
+        }
+//ORIG            return false;
         m_showHideTimeStamp = timeStamp;
 
-        if (m_keyboardIsVisible == visibility)
-            return false;
+        if (m_keyboardIsVisible == visibility){
+            Log.w(QtNative.QtTAG, "RAMPE qad::setKeyboardVisibility 2 <-");        
+                        return false;
+
+        }
+//ORIG            return false;
         m_keyboardIsVisible = visibility;
         QtNative.keyboardVisibilityUpdated(m_keyboardIsVisible);
 
         if (visibility == false)
             updateFullScreen(); // Hiding the keyboard clears the immersive mode, so we need to set it again.
 
+        Log.w(QtNative.QtTAG, "RAMPE qad::setKeyboardVisibility <-");        
         return true;
     }
     public void resetSoftwareKeyboard()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::resetSoftwareKeyboard ->");        
         if (m_imm == null)
             return;
         m_editText.postDelayed(new Runnable() {
@@ -267,10 +280,12 @@ public class QtActivityDelegate
                 m_editText.m_optionsChanged = false;
             }
         }, 5);
+        Log.w(QtNative.QtTAG, "RAMPE qad::resetSoftwareKeyboard <-");        
     }
 
     public void showSoftwareKeyboard(final int x, final int y, final int width, final int height, final int inputHints, final int enterKeyType)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::showSoftwareKeyboard ->");        
         if (m_imm == null)
             return;
 
@@ -443,10 +458,12 @@ public class QtActivityDelegate
                 }
             }
         }, 15);
+    Log.w(QtNative.QtTAG, "RAMPE qad::showSoftwareKeyboard <-");        
     }
 
     public void hideSoftwareKeyboard()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::hideSoftwareKeyboard ->");        
         if (m_imm == null)
             return;
         m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0, new ResultReceiver(new Handler()) {
@@ -464,10 +481,12 @@ public class QtActivityDelegate
                 }
             }
         });
+        Log.w(QtNative.QtTAG, "RAMPE qad::hideSoftwareKeyboard <-");        
     }
 
     String getAppIconSize(Activity a)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::getAppIconSize ->");        
         int size = a.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
         if (size < 36 || size > 512) { // check size sanity
             DisplayMetrics metrics = new DisplayMetrics();
@@ -479,15 +498,25 @@ public class QtActivityDelegate
             if (size > 512)
                 size = 512;
         }
+        Log.w(QtNative.QtTAG, "RAMPE qad::getAppIconSize <-");        
         return "\tQT_ANDROID_APP_ICON_SIZE=" + size;
     }
 
     public void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::updateSelection " +selStart+ " " +selEnd+ " " +candidatesStart+ " " +candidatesEnd+ " ->" );        
         if (m_imm == null)
             return;
 
+        Log.w(QtNative.QtTAG, "RAMPE qad::updateSelection " +selStart+ " " +selEnd+ " " +candidatesStart+ " " +candidatesEnd+ " text: " +m_editText );        
         m_imm.updateSelection(m_editText, selStart, selEnd, candidatesStart, candidatesEnd);
+        /*RAMPE GET_EXTRACTED_TEXT_MONITOR flag is set, you should be calling updateExtractedText(View, int, ExtractedText) ei toimi ->
+        ExtractedText extractedText = new ExtractedText();
+        extractedText.text = "kakkaa";   
+        m_imm.updateExtractedText(m_editText, 0, extractedText );
+        //RAMPE
+        */
+        Log.w(QtNative.QtTAG, "RAMPE qad::updateSelection " +selStart+ " " +selEnd+ " " +candidatesStart+ " " +candidatesEnd+ " <-" );  
     }
 
     // Values coming from QAndroidInputContext::CursorHandleShowMode
@@ -498,12 +527,13 @@ public class QtActivityDelegate
 
     public int getSelectHandleWidth()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::getSelectHandleWidth ->");        
         int width = 0;
         if (m_leftSelectionHandle != null && m_rightSelectionHandle != null)
             width = Math.max(m_leftSelectionHandle.width(), m_rightSelectionHandle.width());
         else if (m_cursorHandle != null)
             width = m_cursorHandle.width();
-
+        Log.w(QtNative.QtTAG, "RAMPE qad::getSelectHandleWidth <-");        
        return width;
    }
 
@@ -513,6 +543,7 @@ public class QtActivityDelegate
     */
     public void updateHandles(int mode, int editX, int editY, int editButtons, int x1, int y1, int x2, int y2, boolean rtl)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::getSelectHandleWidth ->");        
         switch (mode & 0xff)
         {
             case CursorHandleNotShown:
@@ -577,6 +608,7 @@ public class QtActivityDelegate
             if (m_editPopupMenu != null)
                 m_editPopupMenu.hide();
         }
+        Log.w(QtNative.QtTAG, "RAMPE qad::getSelectHandleWidth <-");        
     }
 
     private final DisplayManager.DisplayListener displayListener = new DisplayManager.DisplayListener()
@@ -586,6 +618,7 @@ public class QtActivityDelegate
 
        private boolean isSimilarRotation(int r1, int r2)
        {
+        Log.w(QtNative.QtTAG, "RAMPE qad::isSimilarRotation <->");        
         return (r1 == r2)
                || (r1 == Surface.ROTATION_0 && r2 == Surface.ROTATION_180)
                || (r1 == Surface.ROTATION_180 && r2 == Surface.ROTATION_0)
@@ -596,6 +629,7 @@ public class QtActivityDelegate
        @Override
        public void onDisplayChanged(int displayId)
        {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onDisplayChanged ->");        
            Display display = (Build.VERSION.SDK_INT < Build.VERSION_CODES.R)
                 ? m_activity.getWindowManager().getDefaultDisplay()
                 : m_activity.getDisplay();
@@ -609,6 +643,7 @@ public class QtActivityDelegate
 
            float refreshRate = display.getRefreshRate();
            QtNative.handleRefreshRateChanged(refreshRate);
+        Log.w(QtNative.QtTAG, "RAMPE qad::onDisplayChanged <-");        
        }
 
        @Override
@@ -617,6 +652,7 @@ public class QtActivityDelegate
 
    public boolean updateActivity(Activity activity)
    {
+    Log.w(QtNative.QtTAG, "RAMPE qad::updateActivity ->");        
        try {
            // set new activity
            loadActivity(activity);
@@ -629,6 +665,7 @@ public class QtActivityDelegate
            m_activity.setContentView(m_layout);
 
            // force c++ native activity object to update
+        Log.w(QtNative.QtTAG, "RAMPE qad::updateActivity <-");        
            return QtNative.updateNativeActivity();
        } catch (Exception e) {
            Log.w(QtNative.QtTAG, "Failed to update the activity.");
@@ -640,6 +677,7 @@ public class QtActivityDelegate
    private void loadActivity(Activity activity)
        throws NoSuchMethodException, PackageManager.NameNotFoundException
    {
+       Log.w(QtNative.QtTAG, "RAMPE qad::loadActivity ->");        
        m_activity = activity;
 
        QtNative.setActivity(m_activity, this);
@@ -671,10 +709,12 @@ public class QtActivityDelegate
 
        DisplayManager displayManager = (DisplayManager)m_activity.getSystemService(Context.DISPLAY_SERVICE);
        displayManager.registerDisplayListener(displayListener, null);
+       Log.w(QtNative.QtTAG, "RAMPE qad::loadActivity <-");        
    }
 
     public boolean loadApplication(Activity activity, ClassLoader classLoader, Bundle loaderParams)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::loadApplication ->");        
         /// check parameters integrity
         if (!loaderParams.containsKey(NATIVE_LIBRARIES_KEY)
                 || !loaderParams.containsKey(BUNDLED_LIBRARIES_KEY)
@@ -760,11 +800,13 @@ public class QtActivityDelegate
             m_applicationParameters = "";
 
         m_mainLib = QtNative.loadMainLibrary(m_mainLib, nativeLibsDir);
+        Log.w(QtNative.QtTAG, "RAMPE qad::loadApplication <-");        
         return m_mainLib != null;
     }
 
     public boolean startApplication()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::startApplication ->");        
         // start application
         try {
 
@@ -800,6 +842,8 @@ public class QtActivityDelegate
 
             if (null == m_surfaces)
                 onCreate(null);
+    
+            Log.w(QtNative.QtTAG, "RAMPE qad::startApplication <-");            
             return true;
         } catch (Exception e) {
             e.printStackTrace();
@@ -809,12 +853,15 @@ public class QtActivityDelegate
 
     public void onTerminate()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onTerminate ->");        
         QtNative.terminateQt();
         QtNative.m_qtThread.exit();
+        Log.w(QtNative.QtTAG, "RAMPE qad::onTerminate <-");        
     }
 
     public void onCreate(Bundle savedInstanceState)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onCreate ->");        
         m_quitApp = true;
         Runnable startApplication = null;
         if (null == savedInstanceState) {
@@ -905,15 +952,18 @@ public class QtActivityDelegate
             }
         });
         m_editPopupMenu = new EditPopupMenu(m_activity, m_layout);
+        Log.w(QtNative.QtTAG, "RAMPE qad::onCreate <-");        
     }
 
     public void hideSplashScreen()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::hideSplashScreen <->");        
         hideSplashScreen(0);
     }
 
     public void hideSplashScreen(final int duration)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::hideSplashScreen ->");        
         if (m_splashScreen == null)
             return;
 
@@ -939,10 +989,12 @@ public class QtActivityDelegate
         });
 
         m_splashScreen.startAnimation(fadeOut);
+        Log.w(QtNative.QtTAG, "RAMPE qad::hideSplashScreen <-");        
     }
 
     public void notifyAccessibilityLocationChange(int viewId)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyAccessibilityLocationChange <->");        
         if (m_accessibilityDelegate == null)
             return;
         m_accessibilityDelegate.notifyLocationChange(viewId);
@@ -950,6 +1002,7 @@ public class QtActivityDelegate
 
     public void notifyObjectHide(int viewId, int parentId)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyObjectHide <->");        
         if (m_accessibilityDelegate == null)
             return;
         m_accessibilityDelegate.notifyObjectHide(viewId, parentId);
@@ -957,6 +1010,7 @@ public class QtActivityDelegate
 
     public void notifyObjectFocus(int viewId)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyObjectFocus <->");        
         if (m_accessibilityDelegate == null)
             return;
         m_accessibilityDelegate.notifyObjectFocus(viewId);
@@ -964,6 +1018,8 @@ public class QtActivityDelegate
 
     public void notifyValueChanged(int viewId, String value)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyValueChanged <->");        
+
         if (m_accessibilityDelegate == null)
             return;
         m_accessibilityDelegate.notifyValueChanged(viewId, value);
@@ -971,6 +1027,8 @@ public class QtActivityDelegate
 
     public void notifyScrolledEvent(int viewId)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyScrolledEvent <->");        
+
         if (m_accessibilityDelegate == null)
             return;
         m_accessibilityDelegate.notifyScrolledEvent(viewId);
@@ -978,6 +1036,8 @@ public class QtActivityDelegate
 
     public void notifyQtAndroidPluginRunning(boolean running)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::notifyQtAndroidPluginRunning <->");        
+
         m_isPluginRunning = running;
     }
 
@@ -1200,6 +1260,7 @@ public class QtActivityDelegate
                                     View v,
                                     ContextMenuInfo menuInfo)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onCreateContextMenu <->");        
         menu.clearHeader();
         QtNative.onCreateContextMenu(menu);
         m_contextMenuVisible = true;
@@ -1207,12 +1268,14 @@ public class QtActivityDelegate
 
     public void onCreatePopupMenu(Menu menu)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onCreatePopupMenu <->");        
         QtNative.fillContextMenu(menu);
         m_contextMenuVisible = true;
     }
 
     public void onContextMenuClosed(Menu menu)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onContextMenuClosed <->");        
         if (!m_contextMenuVisible)
             return;
         m_contextMenuVisible = false;
@@ -1221,12 +1284,14 @@ public class QtActivityDelegate
 
     public boolean onContextItemSelected(MenuItem item)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onContextItemSelected <->");        
         m_contextMenuVisible = false;
         return QtNative.onContextItemSelected(item.getItemId(), item.isChecked());
     }
 
     public void openContextMenu(final int x, final int y, final int w, final int h)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::openContextMenu <->");        
         m_layout.postDelayed(new Runnable() {
                 @Override
                 public void run() {
@@ -1252,11 +1317,13 @@ public class QtActivityDelegate
 
     public void closeContextMenu()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::closeContextMenu <->");        
         m_activity.closeContextMenu();
     }
 
     private void setActionBarVisibility(boolean visible)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::setActionBarVisibility <->");        
         if (m_activity.getActionBar() == null)
             return;
         if (ViewConfiguration.get(m_activity).hasPermanentMenuKey() || !visible)
@@ -1266,6 +1333,7 @@ public class QtActivityDelegate
     }
 
     public void insertNativeView(int id, View view, int x, int y, int w, int h) {
+        Log.w(QtNative.QtTAG, "RAMPE qad::insertNativeView <->");        
         if (m_dummyView != null) {
             m_layout.removeView(m_dummyView);
             m_dummyView = null;
@@ -1287,6 +1355,8 @@ public class QtActivityDelegate
     }
 
     public void createSurface(int id, boolean onTop, int x, int y, int w, int h, int imageDepth) {
+        Log.w(QtNative.QtTAG, "RAMPE qad::createSurface <->");        
+
         if (m_surfaces.size() == 0) {
             TypedValue attr = new TypedValue();
             m_activity.getTheme().resolveAttribute(android.R.attr.windowBackground, attr, true);
@@ -1323,6 +1393,7 @@ public class QtActivityDelegate
     }
 
     public void setSurfaceGeometry(int id, int x, int y, int w, int h) {
+        Log.w(QtNative.QtTAG, "RAMPE qad::setSurfaceGeometry <->");        
         if (m_surfaces.containsKey(id)) {
             QtSurface surface = m_surfaces.get(id);
             QtLayout.LayoutParams params = new QtLayout.LayoutParams(w, h, x, y);
@@ -1344,7 +1415,7 @@ public class QtActivityDelegate
 
     public void destroySurface(int id) {
         View view = null;
-
+        Log.w(QtNative.QtTAG, "RAMPE qad::destroySurface <->");        
         if (m_surfaces.containsKey(id)) {
             view = m_surfaces.remove(id);
         } else if (m_nativeViews.containsKey(id)) {
@@ -1367,11 +1438,13 @@ public class QtActivityDelegate
 
     public int getSurfaceCount()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::getSurfaceCount <->");        
         return m_surfaces.size();
     }
 
     public void bringChildToFront(int id)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::bringChildToFront <->");        
         View view = m_surfaces.get(id);
         if (view != null) {
             final int surfaceCount = getSurfaceCount();
@@ -1387,6 +1460,7 @@ public class QtActivityDelegate
 
     public void bringChildToBack(int id)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::bringChildToBack <->");        
         View view = m_surfaces.get(id);
         if (view != null) {
             m_layout.moveChild(view, 0);
@@ -1402,6 +1476,7 @@ public class QtActivityDelegate
 
     public boolean dispatchGenericMotionEvent (MotionEvent ev)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::dispatchGenericMotionEvent <->");        
         if (m_started && QtNative.dispatchGenericMotionEvent(ev))
             return true;
 
@@ -1415,6 +1490,7 @@ public class QtActivityDelegate
 
     public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qad::onRequestPermissionsResult <->");        
         QtNative.sendRequestPermissionsResult(requestCode, permissions, grantResults);
     }
 }
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
index e6da5482ca..d2ad76b43a 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
@@ -45,14 +45,26 @@ import android.text.InputType;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputConnection;
+import android.widget.EditText; //RAMPE
+import android.view.inputmethod.BaseInputConnection; //RAMPE
+import android.view.inputmethod.ExtractedText; // RAMPE
+import android.view.inputmethod.ExtractedTextRequest; //RAMPE
+import android.view.inputmethod.CompletionInfo; //RAMPE
+import android.view.inputmethod.CorrectionInfo; //RAMPE
+import android.view.KeyEvent;//RAMPE
+import android.os.Bundle;//RAMPE
+import android.os.Handler;//RAMPE
+import android.view.inputmethod.InputContentInfo;//RAMPE
+import android.util.Log;//RAMPE
 
-public class QtEditText extends View
+public class QtEditText extends EditText
 {
     int m_initialCapsMode = 0;
     int m_imeOptions = 0;
     int m_inputType = InputType.TYPE_CLASS_TEXT;
     boolean m_optionsChanged = false;
     QtActivityDelegate m_activityDelegate;
+    String TAG = "RAMPE";
 
     public void setImeOptions(int m_imeOptions)
     {
@@ -82,9 +94,11 @@ public class QtEditText extends View
     public QtEditText(Context context, QtActivityDelegate activityDelegate)
     {
         super(context);
+        Log.w(TAG, "qet::QtEditText ->");        
         setFocusable(true);
         setFocusableInTouchMode(true);
         m_activityDelegate = activityDelegate;
+        Log.w(TAG, "qet::QtEditText <-");        
     }
     public QtActivityDelegate getActivityDelegate()
     {
@@ -94,11 +108,158 @@ public class QtEditText extends View
     @Override
     public InputConnection onCreateInputConnection(EditorInfo outAttrs)
     {
-        outAttrs.inputType = m_inputType;
-        outAttrs.imeOptions = m_imeOptions;
-        outAttrs.initialCapsMode = m_initialCapsMode;
-        outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
-        return new QtInputConnection(this);
+        Log.w(TAG, "qet::onCreateInputConnection -> " +outAttrs.inputType+ " vs " +m_inputType+ " " +outAttrs.imeOptions+ " vs "+m_imeOptions );        
+//        outAttrs.inputType = m_inputType;
+//        outAttrs.imeOptions = m_imeOptions;
+//        outAttrs.initialCapsMode = m_initialCapsMode;
+//        outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
+//        return new QtInputConnection(this);
+
+        outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
+        outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_DONE;
+        final InputConnection ic = super.onCreateInputConnection(outAttrs);
+        return new BaseInputConnection(this, true){
+            @Override
+            public CharSequence getTextBeforeCursor(int i, int i1) {
+                return null;
+            }
+
+            @Override
+            public CharSequence getTextAfterCursor(int i, int i1) {
+                return null;
+            }
+
+            @Override
+            public CharSequence getSelectedText(int i) {
+                return null;
+            }
+
+            @Override
+            public int getCursorCapsMode(int i) {
+                return 0;
+            }
+
+//does work
+            @Override
+            public ExtractedText getExtractedText(ExtractedTextRequest arg0, int arg1) {
+
+                Log.w(TAG, "getExtractedText " + arg0 + " , " + arg1);
+                ExtractedText extractedText =  ic.getExtractedText(arg0,arg1); //RAMPE needed to get via ic otherwise new A's won't come to screen
+                return extractedText;
+//does work
+            }
+
+            @Override
+            public boolean deleteSurroundingText(int i, int i1) {
+                return false;
+            }
+
+            @Override
+            public boolean deleteSurroundingTextInCodePoints(int i, int i1) {
+                return false;
+            }
+
+            @Override
+            public boolean setComposingText(CharSequence charSequence, int i) {
+                return false;
+            }
+
+            @Override
+            public boolean setComposingRegion(int i, int i1) {
+                return false;
+            }
+
+            @Override
+            public boolean finishComposingText() {
+                return false;
+            }
+
+            //works
+            @Override
+            public boolean commitText(CharSequence text, int newCursorPosition) {
+                Log.w(TAG, "commitText(\"" + text + "\", " + newCursorPosition + ")");
+                boolean res = ic.commitText(text,newCursorPosition);
+                Log.w(TAG, "commitText res " + res);
+                return res;
+                //works
+            }
+
+            @Override
+            public boolean commitCompletion(CompletionInfo completionInfo) {
+                return false;
+            }
+
+            @Override
+            public boolean commitCorrection(CorrectionInfo correctionInfo) {
+                return false;
+            }
+
+            @Override
+            public boolean setSelection(int i, int i1) {
+                return false;
+            }
+
+            @Override
+            public boolean performEditorAction(int i) {
+                return false;
+            }
+
+            @Override
+            public boolean performContextMenuAction(int i) {
+                return false;
+            }
+
+            @Override
+            public boolean beginBatchEdit() {
+                return false;
+            }
+
+            @Override
+            public boolean endBatchEdit() {
+                return false;
+            }
+
+            @Override
+            public boolean sendKeyEvent(KeyEvent keyEvent) {
+                return false;
+            }
+
+            @Override
+            public boolean clearMetaKeyStates(int i) {
+                return false;
+            }
+
+            @Override
+            public boolean reportFullscreenMode(boolean b) {
+                return false;
+            }
+
+            @Override
+            public boolean performPrivateCommand(String s, Bundle bundle) {
+                return false;
+            }
+
+            @Override
+            public boolean requestCursorUpdates(int i) {
+                return false;
+            }
+
+            @Override
+            public Handler getHandler() {
+                return null;
+            }
+
+            @Override
+            public void closeConnection() {
+                super.closeConnection();
+            }
+
+            @Override
+            public boolean commitContent(InputContentInfo inputContentInfo, int i,  Bundle bundle) {
+                return false;
+            }
+        };
+    
     }
 
 // // DEBUG CODE
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
index 729c244b2c..0a9f67fba8 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
@@ -52,6 +52,8 @@ import android.view.KeyEvent;
 import android.graphics.Rect;
 import android.app.Activity;
 import android.util.DisplayMetrics;
+import android.util.Log; //RAMPE
+import android.view.View; //RAMPE
 
 class QtExtractedText
 {
@@ -126,22 +128,27 @@ public class QtInputConnection extends BaseInputConnection
 
     private void setClosing(boolean closing)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::setClosing-> " +closing );	
         if (closing) {
             m_view.postDelayed(new HideKeyboardRunnable(), 100);
         } else {
             QtNative.activityDelegate().setKeyboardVisibility(true, System.nanoTime());
         }
+        Log.w(QtNative.QtTAG, "RAMPE qic::setClosing " +closing+ " <-" );	
     }
 
     public QtInputConnection(QtEditText targetView)
     {
         super(targetView, true);
+        Log.w(QtNative.QtTAG, "RAMPE qic::qic ->");	        
         m_view = targetView;
+        Log.w(QtNative.QtTAG, "RAMPE qic::qic <-");	        
     }
 
     @Override
     public boolean beginBatchEdit()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::beginBatchEdit <->");	  
         setClosing(false);
         return QtNativeInputConnection.beginBatchEdit();
     }
@@ -149,6 +156,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean endBatchEdit()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::endBatchEdit <->");	  
         setClosing(false);
         return QtNativeInputConnection.endBatchEdit();
     }
@@ -156,6 +164,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean commitCompletion(CompletionInfo text)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::commitCompletion <->");	          
         setClosing(false);
         return QtNativeInputConnection.commitCompletion(text.getText().toString(), text.getPosition());
     }
@@ -163,13 +172,32 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean commitText(CharSequence text, int newCursorPosition)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::commitText-> " +text.toString()+ " " +text.toString()+ " " +newCursorPosition);	 
         setClosing(false);
+        Log.w(QtNative.QtTAG, "RAMPE qic::commitText " +text.toString()+ " " +text.toString()+ " " +newCursorPosition+ " <-");	
+        /*RAMPE NOT WORKING
+        InputMethodManager imm = (InputMethodManager)m_view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+        if (imm != null)
+            {
+            ExtractedText extractedText = new ExtractedText();
+            extractedText.text = text.toString();   
+            imm.updateExtractedText( m_view, 0, extractedText );
+            }
+        //RAMPE 
+        */
+        /*RAMPE TRY kun QtEditText extends ExtractEditText NOT HELPING
+            ExtractedText extractedText = new ExtractedText();
+            extractedText.text = text.toString();   
+            m_view.setExtractedText(extractedText);
+        //RAMPE TRY
+        */
         return QtNativeInputConnection.commitText(text.toString(), newCursorPosition);
     }
 
     @Override
     public boolean deleteSurroundingText(int leftLength, int rightLength)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::deleteSurroundingText <->");	                  
         setClosing(false);
         return QtNativeInputConnection.deleteSurroundingText(leftLength, rightLength);
     }
@@ -177,6 +205,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean finishComposingText()
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::finishComposingText <->");	                  
         // on some/all android devices hide event is not coming, but instead finishComposingText() is called twice
         setClosing(true);
         return QtNativeInputConnection.finishComposingText();
@@ -185,12 +214,14 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public int getCursorCapsMode(int reqModes)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::getCursorCapsMode <->");	                  
         return QtNativeInputConnection.getCursorCapsMode(reqModes);
     }
 
     @Override
     public ExtractedText getExtractedText(ExtractedTextRequest request, int flags)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::getExtractedText-> "+request+" " +flags);	
         QtExtractedText qExtractedText = QtNativeInputConnection.getExtractedText(request.hintMaxChars,
                                                                                   request.hintMaxLines,
                                                                                   flags);
@@ -204,29 +235,34 @@ public class QtInputConnection extends BaseInputConnection
         extractedText.selectionStart = qExtractedText.selectionStart;
         extractedText.startOffset = qExtractedText.startOffset;
         extractedText.text = qExtractedText.text;
+        Log.w(QtNative.QtTAG, "RAMPE qic::getExtractedText " +request+ " " +extractedText.text.toString()+ " " +flags+ " <-");	
         return extractedText;
     }
 
     public CharSequence getSelectedText(int flags)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::getSelectedText<-> " +flags);	
         return QtNativeInputConnection.getSelectedText(flags);
     }
 
     @Override
     public CharSequence getTextAfterCursor(int length, int flags)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::getTextAfterCursor <->");	                  
         return QtNativeInputConnection.getTextAfterCursor(length, flags);
     }
 
     @Override
     public CharSequence getTextBeforeCursor(int length, int flags)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::getTextBeforeCursor <->");	                  
         return QtNativeInputConnection.getTextBeforeCursor(length, flags);
     }
 
     @Override
     public boolean performContextMenuAction(int id)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::performContextMenuAction <->");	                  
         switch (id) {
         case ID_SELECT_ALL:
             return QtNativeInputConnection.selectAll();
@@ -263,6 +299,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean sendKeyEvent(KeyEvent event)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::sendKeyEvent "+event+" ->");	                  
         // QTBUG-85715
         // If the sendKeyEvent was invoked, it means that the button not related with composingText was used
         // In such case composing text (if it exists) should be finished immediately
@@ -287,15 +324,18 @@ public class QtInputConnection extends BaseInputConnection
                                             KeyEvent.META_SHIFT_ON);
                     return super.sendKeyEvent(fakeEvent);
                 default:
+                    Log.w(QtNative.QtTAG, "RAMPE qic::sendKeyEvent default "+event);	                  
                    break;
             }
         }
+        Log.w(QtNative.QtTAG, "RAMPE qic::sendKeyEvent "+event+" <-");	                  
         return super.sendKeyEvent(event);
     }
 
     @Override
     public boolean setComposingText(CharSequence text, int newCursorPosition)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::setComposingText <->");	                  
         setClosing(false);
         return QtNativeInputConnection.setComposingText(text.toString(), newCursorPosition);
     }
@@ -303,6 +343,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean setComposingRegion(int start, int end)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::setComposingRegion <->");	                  
         setClosing(false);
         return QtNativeInputConnection.setComposingRegion(start, end);
     }
@@ -310,6 +351,7 @@ public class QtInputConnection extends BaseInputConnection
     @Override
     public boolean setSelection(int start, int end)
     {
+        Log.w(QtNative.QtTAG, "RAMPE qic::setSelection <->");	                  
         setClosing(false);
         return QtNativeInputConnection.setSelection(start, end);
     }
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 4d04db7edd..966dd8a872 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -115,6 +115,8 @@ static void runOnQtThread(const std::function<void()> &func)
 
 static jboolean beginBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
 {
+    qWarning("RAMPE qaics::beginBatchEdit <->");    
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -128,6 +130,8 @@ static jboolean beginBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
 
 static jboolean endBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
 {
+    qWarning("RAMPE qaics::endBatchEdit <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -143,6 +147,8 @@ static jboolean endBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
 
 static jboolean commitText(JNIEnv *env, jobject /*thiz*/, jstring text, jint newCursorPosition)
 {
+    qWarning("RAMPE qaics::commitText ->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -156,11 +162,14 @@ static jboolean commitText(JNIEnv *env, jobject /*thiz*/, jstring text, jint new
 #endif
     jboolean res = JNI_FALSE;
     runOnQtThread([&]{res = m_androidInputContext->commitText(str, newCursorPosition);});
+    qWarning("RAMPE qaics::commitText <-");    
     return res;
 }
 
 static jboolean deleteSurroundingText(JNIEnv */*env*/, jobject /*thiz*/, jint leftLength, jint rightLength)
 {
+    qWarning("RAMPE qaics::deleteSurroundingText <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -174,6 +183,8 @@ static jboolean deleteSurroundingText(JNIEnv */*env*/, jobject /*thiz*/, jint le
 
 static jboolean finishComposingText(JNIEnv */*env*/, jobject /*thiz*/)
 {
+    qWarning("RAMPE qaics::finishComposingText <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -187,6 +198,8 @@ static jboolean finishComposingText(JNIEnv */*env*/, jobject /*thiz*/)
 
 static jint getCursorCapsMode(JNIEnv */*env*/, jobject /*thiz*/, jint reqModes)
 {
+    qWarning("RAMPE qaics::getCursorCapsMode <->");
+
     if (!m_androidInputContext)
         return 0;
 
@@ -197,6 +210,7 @@ static jint getCursorCapsMode(JNIEnv */*env*/, jobject /*thiz*/, jint reqModes)
 
 static jobject getExtractedText(JNIEnv *env, jobject /*thiz*/, int hintMaxChars, int hintMaxLines, jint flags)
 {
+    qWarning("RAMPE qaics::getExtractedText ->");
     if (!m_androidInputContext)
         return 0;
 
@@ -218,11 +232,13 @@ static jobject getExtractedText(JNIEnv *env, jobject /*thiz*/, int hintMaxChars,
                         env->NewString(reinterpret_cast<const jchar *>(extractedText.text.constData()),
                                        jsize(extractedText.text.length())));
 
+    qWarning("RAMPE qaics::getExtractedText <-");
     return object;
 }
 
 static jstring getSelectedText(JNIEnv *env, jobject /*thiz*/, jint flags)
 {
+    qWarning("RAMPE qaics::getSelectedText ->");    
     if (!m_androidInputContext)
         return 0;
 
@@ -233,11 +249,15 @@ static jstring getSelectedText(JNIEnv *env, jobject /*thiz*/, jint flags)
 #endif
     if (text.isEmpty())
         return 0;
+
+    qWarning("RAMPE qaics::getSelectedText <-");    
     return env->NewString(reinterpret_cast<const jchar *>(text.constData()), jsize(text.length()));
 }
 
 static jstring getTextAfterCursor(JNIEnv *env, jobject /*thiz*/, jint length, jint flags)
 {
+    qWarning("RAMPE qaics::getTextAfterCursor <->");
+
     if (!m_androidInputContext)
         return 0;
 
@@ -251,6 +271,8 @@ static jstring getTextAfterCursor(JNIEnv *env, jobject /*thiz*/, jint length, ji
 
 static jstring getTextBeforeCursor(JNIEnv *env, jobject /*thiz*/, jint length, jint flags)
 {
+    qWarning("RAMPE qaics::getTextBeforeCursor <->");
+
     if (!m_androidInputContext)
         return 0;
 
@@ -264,6 +286,8 @@ static jstring getTextBeforeCursor(JNIEnv *env, jobject /*thiz*/, jint length, j
 
 static jboolean setComposingText(JNIEnv *env, jobject /*thiz*/, jstring text, jint newCursorPosition)
 {
+    qWarning("RAMPE qaics::setComposingText <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -282,6 +306,8 @@ static jboolean setComposingText(JNIEnv *env, jobject /*thiz*/, jstring text, ji
 
 static jboolean setComposingRegion(JNIEnv */*env*/, jobject /*thiz*/, jint start, jint end)
 {
+    qWarning("RAMPE qaics::setComposingRegion <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -296,6 +322,8 @@ static jboolean setComposingRegion(JNIEnv */*env*/, jobject /*thiz*/, jint start
 
 static jboolean setSelection(JNIEnv */*env*/, jobject /*thiz*/, jint start, jint end)
 {
+    qWarning("RAMPE qaics::setSelection <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -375,6 +403,8 @@ static jboolean paste(JNIEnv */*env*/, jobject /*thiz*/)
 
 static jboolean updateCursorPosition(JNIEnv */*env*/, jobject /*thiz*/)
 {
+    qWarning("RAMPE qaics::updateCursorPosition <->");
+
     if (!m_androidInputContext)
         return JNI_FALSE;
 
@@ -436,6 +466,7 @@ QAndroidInputContext::QAndroidInputContext()
     , m_batchEditNestingLevel(0)
     , m_focusObject(0)
 {
+    qWarning("RAMPE qaic::QAndroidInputContext <->"); 
     jclass clazz = QJNIEnvironmentPrivate::findClass(QtNativeInputConnectionClassName);
     if (Q_UNLIKELY(!clazz)) {
         qCritical() << "Native registration unable to find class '"
@@ -936,14 +967,74 @@ void QAndroidInputContext::hideSelectionHandles()
 
 void QAndroidInputContext::update(Qt::InputMethodQueries queries)
 {
+    qWarning("RAMPE qaic::update 0x%x ->", this );     
     QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery(queries);
+// orig    if (query.isNull())
+//        return;
+    //RAMPE TRY
     if (query.isNull())
-        return;
+        {
+        qWarning("RAMPE qaic::update null");                
+        }
+    else
+        {
+        qWarning("RAMPE qaic::update full");                
+        const int cursorPos = getAbsoluteCursorPosition(query);
+        int realSelectionStart = cursorPos;
+        int realSelectionEnd = cursorPos;
+        int cpos = query->value(Qt::ImCursorPosition).toInt();
+        int anchor = query->value(Qt::ImAnchorPosition).toInt();
+        int textBC = query->value(Qt::ImTextBeforeCursor).toInt();
+        int textAC = query->value(Qt::ImTextAfterCursor).toInt();
+        int textS = query->value(Qt::ImSurroundingText).toInt();
+        qWarning("RAMPE qaic::update full et: " +m_extractedText.text.toLatin1() );
+        if (cpos != anchor) {
+            int blockPos = getBlockPosition(query);
+            realSelectionStart = blockPos + cpos;
+            realSelectionEnd = blockPos + anchor;
+            qWarning("RAMPE qaic::update != full %d %d %d", cursorPos, realSelectionStart, realSelectionEnd);              
+            }
+        else{
+            qWarning("RAMPE qaic::update full %d %d %d %d %d %d", cursorPos, cpos, anchor, textBC, textAC, textS);              
+            }
+        }
+        /* RAMPE THIS NOT READY MADE POSSIBLE TO GET THE "A"'S READ, BUT JUST NOT YET SHOWN WIP*/
+    QSharedPointer<QInputMethodQueryEvent> query2 = focusObjectInputMethodQuery(Qt::ImCursorPosition | Qt::ImAbsolutePosition | Qt::ImAnchorPosition);
+    if (!query2.isNull()){
+
+        const int cursorPos = getAbsoluteCursorPosition(query);
+        const int blockPos = getBlockPosition(query);
+
+        // It is documented that we should try to return hintMaxChars
+        // characters, but standard Android controls always return all text, and
+        // there are input methods out there that (surprise) seem to depend on
+        // what happens in reality rather than what's documented.
+
+        QVariant textBeforeCursor = QInputMethod::queryFocusObject(Qt::ImTextBeforeCursor, INT_MAX);
+        QVariant textAfterCursor = QInputMethod::queryFocusObject(Qt::ImTextAfterCursor, INT_MAX);
+        if (textBeforeCursor.isValid() && textAfterCursor.isValid()) {
+            qWarning("RAMPE qaic::update"); 
+            if (focusObjectIsComposing()) {
+                m_extractedText.text =
+                        textBeforeCursor.toString() + m_composingText + textAfterCursor.toString();
+                qWarning("RAMPE qaic::update 1-1"); 
+            } else {
+                qWarning("RAMPE qaic::update 1-2"); 
+                m_extractedText.text = textBeforeCursor.toString() + textAfterCursor.toString();
+            }
+
+            m_extractedText.startOffset = qMax(0, cursorPos - textBeforeCursor.toString().length());
+            }
+        }
+    //RAMPE
+    qWarning("RAMPE qaic::update 0x%x <-", this );     
+
 #warning TODO extract the needed data from query
 }
 
 void QAndroidInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
 {
+    qWarning("RAMPE qaic::invokeAction <->"); 
 #warning TODO Handle at least QInputMethod::ContextMenu action
     Q_UNUSED(action)
     Q_UNUSED(cursorPosition)
@@ -1056,7 +1147,9 @@ jboolean QAndroidInputContext::endBatchEdit()
 */
 jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPosition)
 {
+    qWarning("RAMPE qaic::commitText " +text.toLatin1()+ "%d ->" ,(int)newCursorPosition);
     BatchEditLock batchEditLock(this);
+    qWarning("RAMPE qaic::commitText " +text.toLatin1()+ "%d <-" ,(int)newCursorPosition);    
     return setComposingText(text, newCursorPosition) && finishComposingText();
 }
 
@@ -1179,12 +1272,14 @@ jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint right
 // Android docs say the cursor must not move
 jboolean QAndroidInputContext::finishComposingText()
 {
+    qWarning("RAMPE qaic::finishComposingText ->"); 
     BatchEditLock batchEditLock(this);
 
     if (!focusObjectStopComposing())
         return JNI_FALSE;
 
     clear();
+    qWarning("RAMPE qaic::finishComposingText <-"); 
     return JNI_TRUE;
 }
 
@@ -1297,12 +1392,13 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
 }
 
 
-
-const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedText(jint /*hintMaxChars*/, jint /*hintMaxLines*/, jint /*flags*/)
+//original /*flags*/)
+const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedText(jint /*hintMaxChars*/, jint /*hintMaxLines*/, jint flags)
 {
     // Note to self: "if the GET_EXTRACTED_TEXT_MONITOR flag is set, you should be calling
     // updateExtractedText(View, int, ExtractedText) whenever you call
     // updateSelection(View, int, int, int, int)."  QTBUG-37980
+    qWarning("RAMPE qaic::getExtractedText " +m_extractedText.text.toLatin1()+ " flag %d ->", flags); 
 
     QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery(
             Qt::ImCursorPosition | Qt::ImAbsolutePosition | Qt::ImAnchorPosition);
@@ -1320,15 +1416,19 @@ const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedTex
     QVariant textBeforeCursor = QInputMethod::queryFocusObject(Qt::ImTextBeforeCursor, INT_MAX);
     QVariant textAfterCursor = QInputMethod::queryFocusObject(Qt::ImTextAfterCursor, INT_MAX);
     if (textBeforeCursor.isValid() && textAfterCursor.isValid()) {
+        qWarning("RAMPE qaic::getExtractedText 1"); 
         if (focusObjectIsComposing()) {
             m_extractedText.text =
                     textBeforeCursor.toString() + m_composingText + textAfterCursor.toString();
+             qWarning("RAMPE qaic::getExtractedText 1-1"); 
         } else {
+             qWarning("RAMPE qaic::getExtractedText 1-2"); 
             m_extractedText.text = textBeforeCursor.toString() + textAfterCursor.toString();
         }
 
         m_extractedText.startOffset = qMax(0, cursorPos - textBeforeCursor.toString().length());
     } else {
+        qWarning("RAMPE qaic::getExtractedText 2"); 
         m_extractedText.text = focusObjectInputMethodQuery(Qt::ImSurroundingText)
                 ->value(Qt::ImSurroundingText).toString();
 
@@ -1339,9 +1439,11 @@ const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedTex
     }
 
     if (focusObjectIsComposing()) {
+        qWarning("RAMPE qaic::getExtractedText 3"); 
         m_extractedText.selectionStart = m_composingCursor - m_extractedText.startOffset;
         m_extractedText.selectionEnd = m_extractedText.selectionStart;
     } else {
+        qWarning("RAMPE qaic::getExtractedText 4"); 
         m_extractedText.selectionStart = cursorPos - m_extractedText.startOffset;
         m_extractedText.selectionEnd =
                 blockPos + query->value(Qt::ImAnchorPosition).toInt() - m_extractedText.startOffset;
@@ -1350,12 +1452,13 @@ const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedTex
         if (m_extractedText.selectionStart > m_extractedText.selectionEnd)
             std::swap(m_extractedText.selectionStart, m_extractedText.selectionEnd);
     }
-
+    qWarning("RAMPE qaic::getExtractedText " +m_extractedText.text.toLatin1()+ " flag %d <-", flags ); 
     return m_extractedText;
 }
 
 QString QAndroidInputContext::getSelectedText(jint /*flags*/)
 {
+    qWarning("RAMPE qaic::getSelectedText <->"); 
     QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
     if (query.isNull())
         return QString();
-- 
2.25.1

