For a testing purpose, I use adb shell dumpsys activity <activity_name>
to dump the information of the fragments in the foreground activity.
The problem is that the dumped fragment name only contains the class name rather than its full name (full name means package name + class name). For example, if the fragment's full name is aaa.bbb.ccc.MyFragment
, the dumped fragment name will be MyFragment
.
This is not a severe problem if the app is not obfuscated. However, when an app is obfuscated, the dumped fragment name will mostly be like a single character (e.g., a
, b
, c
, ...). Therefore it's hard to distinguish two different fragments simply by their dumped names.
Why does the Android OS choose to only dump the class name? What are the difficulties of dumping the full name? Are there any other options that an adb user can do to get the full name of the fragments at runtime?