I'm doing instrumentation on an apk to add more ids (like in R.id.name
) and set id for a specific widget, but I noticed something interesting:
- If I set an existing id (by "existing" I mean it is declared in
ids.xml
before compilation) to the widget, UiAutomator can capture that information when I'm dumping the view- Result:
<node index="2" text="Hello World" resource-id="com.example.example:id/testId" class="android.widget.TextView" ...>
- Result:
- For an id I instrumented (by "instrumented" I mean, it is inserted into
R.id
class using soot), for exampleR.id.inserted
, the value is assigned correctly to the widget ( inspected through debugger), but UiAutomator cannot capture it- Result:
<node index="2" text="Hello World" resource-id="" class="android.widget.TextView" ...>
- Result:
I wonder what is missing here? Are the ids declared in xmls compiled into something more than just R.id
?
Ok, seems like the id
is also contained in the resources.arsc
file. Without instrumenting it, UiAutomator cannot figure out the id. But I am confused how to do that, is there a way to do so?