How Lastpass knows the current URL in Chrome

When browsing in Chrome for Android, Lastpass appears with suggestions if it recognizes the URL as the one with which you connected the login data.

How do I know which URL Chrome is referring to? I know Lastpass uses Accessibility Services , but I wonder how it requests the current URL from Chrome.

PS. Apparently, it works only for Chrome (for example, it does not appear in Opera), so there may be something special for Chrome.

+6
source share
2 answers

LastPass on Android requests access permission using canRetrieveWindowContent true. This allows it to navigate the current view hierarchy and access views as AccessibilityNodeInfo objects.

The accessibility API allows you to search for nodes by the text displayed in the view, and also gives you a java class name for each such kind. AccessibilityNodeInfo # findAccessibilityNodeInfosByText

This feature does not work in Opera, probably because the developers never handled the logic for moving the view hierarchy for it.

Check out https://developer.android.com/guide/topics/ui/accessibility/services.html

+3
source

I generally use javascript, in addition to the Andoid functionality and with some hacks, you can get links to all open windows (and, for example, get their URL). See this answer since 2009 .

0
source

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


All Articles