-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Added Boss Key Detection Method #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally got some time to dive into the actual logic.
I'm seeing some crashes. Mentioned my concern at the apt line number.
builder.setNegativeButton("NO", (dialog, whichButton) -> dialog.dismiss()); | ||
AlertDialog alert = builder.create(); | ||
alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); | ||
alert.show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to wrap my head around this. I get a android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
error once I get past a permission not allowed for this window type (by modifying line 64 to use TYPE_TOAST).
I feel that the error is correct in it's right, so asking here to clarify. From my understanding:
- We capture every key event and create an instance of the
KeyDetection
Activity. Since this is created directly via constructor no lifecycle methods are called/managed. - When the activity is actually created, the static field stores Activity reference. This reference is now used by another object instance created when a new keypress is sent. This means we are accessing the activity from a completely different instance of the same class.
- Now, when we try to access the window and set type of this alert created with the earlier activity context, the layout manager thinks activity is stopped because it's not matching the callee's context (callee is on the thread belonging to the accessibility service). Window Manager bails out crashing the whole party during dialog creation.
I think we cannot use alert.getWindow().setType()
Would like to gain some clarity over why are we using this?
And did you encounter crashes while testing this locally?
Another thing I thought about was sending each event to a new object might be a recipe for disaster, but since most of the codebase is hacky, I'm okay with this hack xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using stock emulator with API level 28 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was using that for Nougat, beacuse i use Firestick 4k, i added an API level check this will solve it. Tested on Android 10.
Had no crashes whatsoever because it was compatible with Nougat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling "Bordered Window" and "Boss key Toggle" will enable scroll mode. (in Mouse Mode)
When the pointer is at any of the side, pressing the same button will scroll the page from center
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the latest version
https://github.com/sweenwolf/matvt/releases/tag/v1.0.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the added scroll functionality!
Unfortunately I couldn't get the accessibility service to start on the emulator after this commit
Will debug over the weekend to get to the cause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, I tested this on Android TV emulator API 29, its working just fine.
MATVT on AndroidTV Emu - https://youtu.be/5ttWGTRZba8
MATVT in JioTV in Firestick 4k - https://youtu.be/64jIpjBFLPg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugged the issue, turns out was a cache invalidation problem at my end.
Code is perfectly fine, Thanks!
Thanks a lot for the contributions @sweenwolf |
No description provided.