Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App is crashing in Android 13 , getting issue Injecting input events ,in line no. MultiSpinnerSearch.java:185 #109

Open
DevTheKing opened this issue Apr 26, 2023 · 6 comments · Fixed by playmoweb/MultiSelectSpinner#1

Comments

@DevTheKing
Copy link

Fatal Exception: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.
at android.os.Parcel.createExceptionOrNull(Parcel.java:3040)
at android.os.Parcel.createException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:3007)
at android.os.Parcel.readException(Parcel.java:2949)
at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1294)
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1151)
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1180)
at android.app.Instrumentation.sendKeySync(Instrumentation.java:1135)
at android.app.Instrumentation.sendKeyDownUpSync(Instrumentation.java:1147)
at com.androidbuts.multispinnerfilter.MultiSpinnerSearch.lambda$onCancel$0(MultiSpinnerSearch.java:185)
at com.androidbuts.multispinnerfilter.-$$Lambda$MultiSpinnerSearch$p9xhRiNPdc-qw9SrA8LUwZsjeq0.run()
at java.lang.Thread.run(Thread.java:1012)

@MahmoudMagdyEllawatty
Copy link

same issue here.
do you find any solution?

@DevTheKing
Copy link
Author

DevTheKing commented May 8, 2023

@MahmoudMagdyEllawatty I downloaded the library and added it manually in my projects and given following permission in my AndroidManifest.xml file
<uses-permission android:name="android.permission.INJECT_EVENTS"/>
It fixed the problem

@Bahul045
Copy link

Bahul045 commented Aug 7, 2023

I have facing same issue, it crash in android 13

@AnshukumarAk
Copy link

@MahmoudMagdyEllawatty I downloaded the library and added it manually in my projects and given following permission in my AndroidManifest.xml file <uses-permission android:name="android.permission.INJECT_EVENTS"/> It fixed the problem

not fix issue

@monossido
Copy link

Not fixed!!

@rlebranchu
Copy link

rlebranchu commented Dec 2, 2024

Hi !
Has anyone found a solution for non-system_app applications?

Edited :
I've found a solution to prevent dropdowns from appearing without using Instrumentation.

Just replace :

/**
* To hide dropdown which is already opened at the time of performClick...
* This code will hide automatically and no need to tap by user.
*/
new Thread(new Runnable() {
@OverRide
public void run() {
Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
}
}).start();

By

this.onDetachedFromWindow();

This code will hide dropdown options when dialog will be cancelled.
Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants