So, finally here I'm, after searching the Google and SO for this perticular problem which made me crasy from past 3 days. A lot of answers are out there but it seems that neither of them seems to solve this specific issue. Here is what I have found so far,
Show keyboard automatically
Android soft keyboard not working
How to hide and show Android Soft keyboard from an Accessibility Service
Window manager blocking keyboard for apps underneath floating chat head
Android: show soft keyboard automatically when focus is on an EditText
Android - Keyboard not appearing in floating window
EditText in it from AccessibilityService (This part is done).EditText.EditText (with a button click), and send it to the EditText of Messaging App, and then perform a click event on send button in Messaging App. This all will be done using AccessibilityService and not by the user.notification_panel or press the Back, Home or Recents button from the navigation area.Im unable to handle keyboard and its input on an EditText inflated using WindowManager in an AccessibilityService.

-> Inflated the view with window type TYPE_APPLICATION_OVERLAY and window flag FLAG_NOT_FOCUSABLE.
Able to acheive
AccessibilityService.notification_panel expands.Unable to acheive
EditText or programatically.what I have tried so far
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
chattingLayoutParams = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
)
} else {
chattingLayoutParams = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
)
}
and this (but not working)
val imm: InputMethodManager =
getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(someEditText, InputMethodManager.SHOW_IMPLICIT)
-> Inflated the view with window type TYPE_APPLICATION_OVERLAY and window flag FLAG_NOT_TOUCH_MODEL.
Able to acheive
Unable to acheive
SccessibilityService.notification_panel changes to remove overlayed window.What i have tried so far
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
chattingLayoutParams = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT
)
} else {
chattingLayoutParams = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT
)
}
AccessibilityService Config.xml file
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFeedbackType="feedbackSpoken"
android:accessibilityFlags="flagReportViewIds"
android:canRetrieveWindowContent="true"
android:notificationTimeout="100" />
I hope the problem is clear, please forgive for any inconvenience.
This is because of when you overlay screen the input manager required to meets the opacity condition not exceed InputManager.getMaximumObscuringOpacityForTouch() which is currently 0.8f.
Just set chattingLayoutParams.alpha = 0.8f to fix it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With