[Wala-wala] Inner class methods as Entrypoints

11 views
Skip to first unread message

Parjanya Vyas

unread,
Mar 11, 2022, 4:51:10 PM3/11/22
to wala...@lists.sourceforge.net
Hi all,

I apologize in advance if this question already has an answer or seems naive. I was looking through the following thread:

I believe I am facing an issue because of the same root cause as this, when building a call graph for the following class:
public class MainActivity extends AppCompatActivity {
    Button callBtn;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.callBtn = (Button) findViewById(R.id.callBtn);
        this.callBtn.setOnClickListener(new View.OnClickListener() { // from class: com.parjanya.samplepermissionapp.MainActivity.2
            @Override
            public void onClick(View view) {
                MainActivity.this.startNewActivity(PhoneCallActivity.class);
            }
        });
    }
    public void startNewActivity(Class<?> activityClass) {
        startActivity(new Intent(this, activityClass));
    }
}
I include MainActivity$2::onClick as an entrypoint when creating a call graph using the vanilla zero-one CFA builder.
The node corresponding to the invocation of startNewActivity in this call graph does not have a successor node. Therefore, I cannot find a node in the entire call graph that has an invocation to startActivity as an SSAAbstractInvokeInstruction in its basic block.

A subclass of Entrypoint with an overriden implementation of makeArgument function was suggested as a possible solution to this problem.
However, I am not really sure what enhancements should be done, or how to go about doing this, since I am fairly new to WALA.

Can you please help me out or point me in the right direction?

Thanks a lot!

Yours
Parjanya Vyas

Manu Sridharan

unread,
Apr 19, 2022, 2:11:25 PM4/19/22
to WALA discussion and Q&A
Dear Parjanya,

I’m really sorry for the late reply.  This case is a bit tricky I think.  For the CFA builders to discover this call target, they will need to compute a non-empty points-to set for the MainActivity.this expression inside onClick.  That will be hard to hack up just using the Entrypoint functionality.  I think what you really want is some kind of model of the Activity that constructs a MainActivity, invokes onCreate(), and then maybe somehow invokes the onClick routine.  

Are you aware of Droidel?


The code is out of date, but an approach like that might be what you need.  We would be very happy to publicize a solution if you’ve found one; let us know.

Best,
Manu


_______________________________________________
Wala-wala mailing list
Wala...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wala-wala
Reply all
Reply to author
Forward
0 new messages