import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class TestStartActivityToGetIntent {

    static Object source(String kind) {
        return null;
    }

    static void sink(Object sink) {}

    public void test(Context ctx, Activity act) {

        // test all methods that start an activity
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("ctx-start"));
            ctx.startActivity(intent);
        }
        {
            // Intent intent1 = new Intent(null, SomeActivity2.class);
            // intent1.putExtra("data", (String) source("ctx-starts"));
            // Intent intent2 = new Intent(null, SomeActivity3.class);
            // intent2.putExtra("data", (String) source("ctx-starts"));
            // Intent[] intents = {intent1, intent2};
            // ctx.startActivities(intents);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("act-start"));
            act.startActivity(intent);
        }
        {
            // Intent[] intent = {new Intent(null, SomeActivity.class)};
            // intent[0].putExtra("data", (String) source("act-starts"));
            // act.startActivities(intent);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("start-for-result"));
            act.startActivityForResult(intent, 0);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("start-if-needed"));
            act.startActivityIfNeeded(intent, 0);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("start-matching"));
            act.startNextMatchingActivity(intent);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("start-from-child"));
            act.startActivityFromChild(null, intent, 0);
        }
        {
            Intent intent = new Intent(null, SomeActivity.class);
            intent.putExtra("data", (String) source("start-from-frag"));
            act.startActivityFromFragment(null, intent, 0);
        }

        // test 4-arg Intent constructor
        {
            Intent intent = new Intent(null, null, null, SomeActivity.class);
            intent.putExtra("data", (String) source("4-arg"));
            ctx.startActivity(intent);
        }

        // safe test
        {
            Intent intent = new Intent(null, SafeActivity.class);
            intent.putExtra("data", "safe");
            ctx.startActivity(intent);
        }
    }

    static class SomeActivity extends Activity {

        public void test() {
            sink(getIntent().getStringExtra("data")); // $ hasValueFlow=ctx-start hasValueFlow=act-start hasValueFlow=start-for-result hasValueFlow=start-if-needed hasValueFlow=start-matching hasValueFlow=start-from-child hasValueFlow=start-from-frag hasValueFlow=4-arg
        }

    }

    // static class SomeActivity2 extends Activity {

    //     public void test() {
    //         sink(getIntent().getStringExtra("data")); // $ hasValueFlow=ctx-starts
    //     }

    // }

    // static class SomeActivity3 extends Activity {

    //     public void test() {
    //         sink(getIntent().getStringExtra("data")); // $ hasValueFlow=ctx-starts
    //     }

    // }

    static class SafeActivity extends Activity {

        public void test() {
            sink(getIntent().getStringExtra("data")); // Safe
        }
    }
}

@@ -308,12 +308,8 @@
 est 
-all 
 meth
@@ -553,774 +553,158 @@
     
-// Intent intent1 = new Intent(null, SomeActivity2.class);%0A            // intent1.putExtra(%22data%22, (String) source(%22ctx-starts%22));%0A            // Intent intent2 = new Intent(null, SomeActivity3.class);%0A            // intent2.putExtra(%22data%22, (String) source(%22ctx-starts%22));%0A            // Intent%5B%5D intents = %7Bintent1, intent2%7D;%0A            // ctx.startActivities(intents);%0A        %7D%0A        %7B%0A            Intent intent = new Intent(null, SomeActivity.class);%0A            intent.putExtra(%22data%22, (String) source(%22act-start%22));%0A            act.startActivity(intent);%0A        %7D%0A        %7B%0A            // Intent%5B%5D intent = %7Bnew Intent(null, SomeActivity.class)%7D;%0A            // intent%5B0%5D.putExtra(%22data%22, (String) source(%22act-starts%22));%0A            // act.startActivities
+Intent intent = new Intent(null, SomeActivity.class);%0A            intent.putExtra(%22data%22, (String) source(%22act-start%22));%0A            act.startActivity
 (int
@@ -2596,400 +2596,8 @@
  %7D%0A%0A
-    // static class SomeActivity2 extends Activity %7B%0A%0A    //     public void test() %7B%0A    //         sink(getIntent().getStringExtra(%22data%22)); // $ hasValueFlow=ctx-starts%0A    //     %7D%0A%0A    // %7D%0A%0A    // static class SomeActivity3 extends Activity %7B%0A%0A    //     public void test() %7B%0A    //         sink(getIntent().getStringExtra(%22data%22)); // $ hasValueFlow=ctx-starts%0A    //     %7D%0A%0A    // %7D%0A%0A
     

update act tests