Get AccessibilityNodeInfo view to create overlay

I am writing an AccessibilityService , and I want to create view overlays on views from the current activity that the accessibility service can receive. I have no problem retrieving all AccessibilityNodeInfo objects from the current activity, but I don’t know how to get a view from these objects to create overlays. Unfortunately, there are just a few examples of accessibility services. Some of you may already have experience with this topic. I hope you can help me! Thanks!

EDITING: the document shows that overlays over the contents of the activity are possible:

A display overlay can perform these tasks thanks to the Android Accessibility Framework [10]. Using the accessibility API, it has the ability to access and verify the application GUI on the screen, without any changes or hardware to the application code. "*

Link: http://www.onarlioglu.com/publications/fc2015babelcrypt.pdf

Page 6 and 8. Thank you!

+5
source share
2 answers

You cannot get View objects from other applications, since View objects are in a separate process from yours.

+3
source

Window overlay with accessibility services is easy. I know this is an old question, but I thought I would add the answer anyway.

 RelativeLayout relativeLayout = new RelativeLayout(getContext()); WindowManager.LayoutParams topButtonParams = new WindowManager.LayoutParams( width, //The width of the screen height, //The height of the screen WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); //Just trust me, this alpha thing is important. I know it weird on a "translucent" view. topButtonParams.alpha = 100; relativeLayout.setLayoutParams(topButtonParams); mWindowManager.addView(relativeLayout, topButtonParams); 

Also, you need this permission in the manifest

 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> 

After you impose an invisible relative layout on top of the entire page, adding views to it is easy!

0
source

Source: https://habr.com/ru/post/1213425/


All Articles