arguslab/Argus-SAF

Question: Is there a way to retrieve corresponding widget for callback methods?

sangamk opened this issue · 9 comments

For the callbacks apk.model.getCallbackMethodsis there a way to find the layout widget that calls that method? If there is one ofcourse.

public void click(View view){
}
<button android:onClick="click"/>

or for:

findById(id).setOnClickListener
fgwei commented

Yes, the click method should be collected as callback method for getCallbackMethods.

Yes but can I also find out which widget is linked to that method?
So I want to find this -> <button android:onClick="click"/>

For this ->

public void click(View view){
}
<button android:onClick="click"/>

I got it working.

However I can't find out how to find the buttonview (button2) for these kinds of methods ->

        Button b = findViewById(R.id.button2);
        b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getApplicationContext(), ThirdActvity.class));
            }
        })

How would I go about doing this? Is there a way to see what view is passed on to the onClick method?

Anyone?

fgwei commented

This onClick method will be automatically collected as a callback method for this component.
To find the view binding you need to do a point-to analysis to figure out when setOnClickListener get called which button object it is called upon and what is the OnClickListener is been registered.

Thx I will give it a try:
To clarify I am only interested in the type of the widget that calls the method not its name. So android.widget.Button or android.widget.TextView

fgwei commented

You may use something like ExplicitValueFinder

So I got it working for most of the callbackmethods. However, I am missing some information. Specifically for menu items and support views. Is there a reason that Menus and support views are not part of the layoutcontrol or is it a missing feature?