[Demonstration 1]

[Buggy Method]
private static void performEmergencyCall(Context context) {
    Intent intent = new Intent(Intent.ACTION_CALL_EMERGENCY);
    intent.setData(getPhoneUri(context));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

[Buggy Hunk]
context.startActivity(intent);

[Patch]
context.startActivityAsUser(intent, UserHandle.CURRENT);

[Demonstration 2]

[Buggy Method]
public void onQPyExec(View v) {
    if (checkAppInstalledByName(getApplicationContext(), extPlgPlusName)) {
        Toast.makeText(this, "Sample of calling QPython API", Toast.LENGTH_SHORT).show();
        Intent intent = new Intent();
        intent.setClassName(extPlgPlusName, extPlgPlusName + ".MPyApi");
        intent.setAction(extPlgPlusName + ".action.MPyApi");
        Bundle mBundle = new Bundle();
        mBundle.putString("app", "myappid");
        mBundle.putString("act", "onPyApi");
        // any String flag you may use in your context
        mBundle.putString("flag", "onQPyExec");
        // param String param you may use in your context
        mBundle.putString("param", "");
        /*
	         * The String Python code, you can put your py file in res or raw or intenet, so that you can get it the same way, which can make it scalable
	         */
        EditText codeTxt = (EditText) findViewById(R.id.edit_text);
        String code = codeTxt.getText().toString();
        mBundle.putString("pycode", code);
        intent.putExtras(mBundle);
        startActivityForResult(intent, SCRIPT_EXEC_PY);
    } else {
        Toast.makeText(getApplicationContext(), "Please install QPython first", Toast.LENGTH_LONG).show();
        try {
            Uri uLink = Uri.parse("market://details?id=com.hipipal.qpyplus");
            Intent intent = new Intent(Intent.ACTION_VIEW, uLink);
            startActivity(intent);
        } catch (Exception e) {
            Uri uLink = Uri.parse("http://qpython.com");
            Intent intent = new Intent(Intent.ACTION_VIEW, uLink);
            startActivity(intent);
        }
    }
}

[Buggy Hunk]
intent.setClassName(extPlgPlusName, extPlgPlusName+".MPyApi");

[Patch]
intent.setClassName(extPlgPlusName, "org.qpython.qpylib.MPyApi");

[Demonstration 3]

[Buggy Method]
@Override
public SuccessfulUploadCallbackUrlResponse imageUrlUpload(ImageUrlUploadCallbackUrlRequest imageUrlUploadCallbackUrlRequest) {
    final WebTarget webTarget = jerseyClient.target(imageUrl);
    final Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(wrapAuth(imageUrlUploadCallbackUrlRequest), MediaType.APPLICATION_JSON_TYPE));
    return handleCallbackUrlResponse(response);
}

[Buggy Hunk]
final WebTarget webTarget = jerseyClient.target(imageUrl);

[Patch]
final WebTarget webTarget = client.target(imageUrl);