|
| 1 | +import java.util.Map; |
| 2 | +import java.util.Set; |
| 3 | + |
| 4 | +import android.content.ContentProvider; |
| 5 | +import android.content.ContentResolver; |
| 6 | +import android.database.Cursor; |
| 7 | +import android.database.DatabaseUtils; |
| 8 | +import android.database.sqlite.SQLiteQueryBuilder; |
| 9 | +import android.net.Uri; |
| 10 | +import android.os.CancellationSignal; |
| 11 | + |
| 12 | +public class FlowSteps { |
| 13 | + public static <T> T taint() { |
| 14 | + return null; |
| 15 | + } |
| 16 | + |
| 17 | + private static abstract class MyContentProvider extends ContentProvider { |
| 18 | + // Dummy class to test for sub classes |
| 19 | + } |
| 20 | + |
| 21 | + private static abstract class MyContentResolver extends ContentResolver { |
| 22 | + // Dummy class to test for sub classes |
| 23 | + } |
| 24 | + |
| 25 | + private static abstract class MySQLiteQueryBuilder extends SQLiteQueryBuilder { |
| 26 | + // Dummy class to test for sub classes |
| 27 | + } |
| 28 | + |
| 29 | + public static String[] appendSelectionArgs() { |
| 30 | + String[] originalValues = taint(); |
| 31 | + String[] newValues = taint(); |
| 32 | + return DatabaseUtils.appendSelectionArgs(originalValues, newValues); |
| 33 | + } |
| 34 | + |
| 35 | + public static String concatenateWhere() { |
| 36 | + String a = taint(); |
| 37 | + String b = taint(); |
| 38 | + return DatabaseUtils.concatenateWhere(a, b); |
| 39 | + } |
| 40 | + |
| 41 | + public static String buildQueryString(MySQLiteQueryBuilder target) { |
| 42 | + target = taint(); |
| 43 | + boolean distinct = taint(); |
| 44 | + String tables = taint(); |
| 45 | + String[] columns = taint(); |
| 46 | + String where = taint(); |
| 47 | + String groupBy = taint(); |
| 48 | + String having = taint(); |
| 49 | + String orderBy = taint(); |
| 50 | + String limit = taint(); |
| 51 | + return SQLiteQueryBuilder.buildQueryString(distinct, tables, columns, where, groupBy, having, orderBy, limit); |
| 52 | + } |
| 53 | + |
| 54 | + public static String buildQuery(MySQLiteQueryBuilder target) { |
| 55 | + target = taint(); |
| 56 | + String[] projectionIn = taint(); |
| 57 | + String selection = taint(); |
| 58 | + String groupBy = taint(); |
| 59 | + String having = taint(); |
| 60 | + String sortOrder = taint(); |
| 61 | + String limit = taint(); |
| 62 | + return target.buildQuery(projectionIn, selection, groupBy, having, sortOrder, limit); |
| 63 | + } |
| 64 | + |
| 65 | + public static String buildQuery2(MySQLiteQueryBuilder target) { |
| 66 | + target = taint(); |
| 67 | + String[] projectionIn = taint(); |
| 68 | + String selection = taint(); |
| 69 | + String[] selectionArgs = taint(); |
| 70 | + String groupBy = taint(); |
| 71 | + String having = taint(); |
| 72 | + String sortOrder = taint(); |
| 73 | + String limit = taint(); |
| 74 | + return target.buildQuery(projectionIn, selection, selectionArgs, groupBy, having, sortOrder, limit); |
| 75 | + } |
| 76 | + |
| 77 | + public static String buildUnionQuery(MySQLiteQueryBuilder target) { |
| 78 | + target = taint(); |
| 79 | + String[] subQueries = taint(); |
| 80 | + String sortOrder = taint(); |
| 81 | + String limit = taint(); |
| 82 | + return target.buildUnionQuery(subQueries, sortOrder, limit); |
| 83 | + } |
| 84 | + |
| 85 | + public static String buildUnionSubQuery2(MySQLiteQueryBuilder target) { |
| 86 | + target = taint(); |
| 87 | + String typeDiscriminatorColumn = taint(); |
| 88 | + String[] unionColumns = taint(); |
| 89 | + Set<String> columnsPresentInTable = taint(); |
| 90 | + int computedColumnsOffset = taint(); |
| 91 | + String typeDiscriminatorValue = taint(); |
| 92 | + String selection = taint(); |
| 93 | + String[] selectionArgs = taint(); |
| 94 | + String groupBy = taint(); |
| 95 | + String having = taint(); |
| 96 | + return target.buildUnionSubQuery(typeDiscriminatorColumn, unionColumns, columnsPresentInTable, |
| 97 | + computedColumnsOffset, typeDiscriminatorValue, selection, selectionArgs, groupBy, having); |
| 98 | + } |
| 99 | + |
| 100 | + public static void buildUnionSubQuery3(MySQLiteQueryBuilder target) { |
| 101 | + target = taint(); |
| 102 | + String typeDiscriminatorColumn = taint(); |
| 103 | + String[] unionColumns = taint(); |
| 104 | + Set<String> columnsPresentInTable = taint(); |
| 105 | + int computedColumnsOffset = taint(); |
| 106 | + String typeDiscriminatorValue = taint(); |
| 107 | + String selection = taint(); |
| 108 | + String groupBy = taint(); |
| 109 | + String having = taint(); |
| 110 | + target.buildUnionSubQuery(typeDiscriminatorColumn, unionColumns, columnsPresentInTable, computedColumnsOffset, |
| 111 | + typeDiscriminatorValue, selection, groupBy, having); |
| 112 | + } |
| 113 | + |
| 114 | + public static Cursor query(MyContentResolver target) { |
| 115 | + Uri uri = taint(); |
| 116 | + String[] projection = taint(); |
| 117 | + String selection = taint(); |
| 118 | + String[] selectionArgs = taint(); |
| 119 | + String sortOrder = taint(); |
| 120 | + CancellationSignal cancellationSignal = taint(); |
| 121 | + return target.query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal); |
| 122 | + } |
| 123 | + |
| 124 | + public static Cursor query(MyContentProvider target) { |
| 125 | + Uri uri = taint(); |
| 126 | + String[] projection = taint(); |
| 127 | + String selection = taint(); |
| 128 | + String[] selectionArgs = taint(); |
| 129 | + String sortOrder = taint(); |
| 130 | + CancellationSignal cancellationSignal = taint(); |
| 131 | + return target.query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal); |
| 132 | + } |
| 133 | + |
| 134 | + public static Cursor query2(MyContentResolver target) { |
| 135 | + Uri uri = taint(); |
| 136 | + String[] projection = taint(); |
| 137 | + String selection = taint(); |
| 138 | + String[] selectionArgs = taint(); |
| 139 | + String sortOrder = taint(); |
| 140 | + return target.query(uri, projection, selection, selectionArgs, sortOrder); |
| 141 | + } |
| 142 | + |
| 143 | + public static Cursor query2(MyContentProvider target) { |
| 144 | + Uri uri = taint(); |
| 145 | + String[] projection = taint(); |
| 146 | + String selection = taint(); |
| 147 | + String[] selectionArgs = taint(); |
| 148 | + String sortOrder = taint(); |
| 149 | + return target.query(uri, projection, selection, selectionArgs, sortOrder); |
| 150 | + } |
| 151 | + |
| 152 | + public static void appendColumns() { |
| 153 | + StringBuilder s = taint(); |
| 154 | + String[] columns = taint(); |
| 155 | + SQLiteQueryBuilder.appendColumns(s, columns); |
| 156 | + } |
| 157 | + |
| 158 | + public static void setProjectionMap(MySQLiteQueryBuilder target) { |
| 159 | + target = taint(); |
| 160 | + Map<String, String> columnMap = taint(); |
| 161 | + target.setProjectionMap(columnMap); |
| 162 | + } |
| 163 | + |
| 164 | + public static void setTables(MySQLiteQueryBuilder target) { |
| 165 | + target = taint(); |
| 166 | + String inTables = taint(); |
| 167 | + target.setTables(inTables); |
| 168 | + } |
| 169 | + |
| 170 | + public static void appendWhere(MySQLiteQueryBuilder target) { |
| 171 | + target = taint(); |
| 172 | + CharSequence inWhere = taint(); |
| 173 | + target.appendWhere(inWhere); |
| 174 | + } |
| 175 | + |
| 176 | + public static void appendWhereStandalone(MySQLiteQueryBuilder target) { |
| 177 | + target = taint(); |
| 178 | + CharSequence inWhere = taint(); |
| 179 | + target.appendWhereStandalone(inWhere); |
| 180 | + } |
| 181 | +} |
0 commit comments