Lawrence D'Oliveiro wrote:
> Why not provide your own commands for initializing a new database
> if it doesn't already exist? Save the user some work.

Hi Lawrence,

Regarding launcher-agnostic layout replication without root privileges.

I've been thinking about your suggestion, because it would be the holy
grail in an exact perfect replica of any Android phone to another.

Of course, it's trivial to find every user-installed single package...
 adb shell pm list packages -f

But replicating the homescreen layout is a non-trivial database problem.
 <https://i.postimg.cc/zvKdH4PX/homescreen-intent.jpg>

 Q: How do we obtain the homescreen {pane/folder/app/apk} location & order?
 A: ??? 

I punted, as you noted, by using an SQL database output by Nova Launcher.
 <https://i.postimg.cc/hvrv2tXL/nova-db.jpg>

But I agree, we'd rather create our own database of the Android homescreen.

The question is how to query Android homescreen pane names, locations, and 
folder names, locations, and app-icon names locations and action intents...
    ... without root privileges?

We "might" find that information in a dump of the current activities.
 adb shell dumpsys activity activities

But, if we want a layout-aware snapshot (folders, icons, positions) without 
relying on a launcher database file, maybe, just maybe, an uiautomator 
dump via ADB + Python XML parsing might be our best non-root alternative?
 <https://help.duoplus.net/docs/uiautomator-dump>

Try this on your desktop with the phone connected over Wi-Fi to adb:
 adb shell uiautomator dump /sdcard/window_dump.xml
  => UI hierchary dumped to: /sdcard/window_dump.xml

 adb pull /sdcard/window_dump.xml ./window_dump.xml
  => /sdcard/window_dump.xml: 1 file pulled, 0 skipped. 0.1 MB/s (1433 bytes in 
0.012s)

However, uiautomator dump only captures what is currently rendered on the
screen at that exact millisecond, but maybe we can find the apps and their
locastions hidden inside closed folders by programmatically swiping through 
every single pane and opening every folder via ADB clicks during the dump?

In addition, UI Automator only gives us bounding boxes (pixel coordinates)
rather than a clean relational grid or database model, so we'd have to 
infer the final layout based on knowledge of the launcher's grid geometry.

In summary, while parsing the launcher's layout database was essentially trivial
 <https://i.postimg.cc/28w4VzSk/sql-query.jpg>
rebuilding that layout database from scratch, is not something I know how to do.
-- 
Sometimes, together, with help from others, we can accomplish the impossible.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to