Merge "Include pending media as well when deleting mediastore entries." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
442399b1c1
@@ -3827,6 +3827,18 @@ public abstract class ContentResolver implements ContentInterface {
|
||||
return queryArgs;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static @NonNull Bundle includeSqlSelectionArgs(@NonNull Bundle queryArgs,
|
||||
@Nullable String selection, @Nullable String[] selectionArgs) {
|
||||
if (selection != null) {
|
||||
queryArgs.putString(QUERY_ARG_SQL_SELECTION, selection);
|
||||
}
|
||||
if (selectionArgs != null) {
|
||||
queryArgs.putStringArray(QUERY_ARG_SQL_SELECTION_ARGS, selectionArgs);
|
||||
}
|
||||
return queryArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns structured sort args formatted as an SQL sort clause.
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.database;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.ContentValues;
|
||||
@@ -1548,4 +1549,24 @@ public class DatabaseUtils {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape the given argument for use in a {@code LIKE} statement.
|
||||
* @hide
|
||||
*/
|
||||
public static String escapeForLike(@NonNull String arg) {
|
||||
// Shamelessly borrowed from com.android.providers.media.util.DatabaseUtils
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < arg.length(); i++) {
|
||||
final char c = arg.charAt(i);
|
||||
switch (c) {
|
||||
case '%': sb.append('\\');
|
||||
break;
|
||||
case '_': sb.append('\\');
|
||||
break;
|
||||
}
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user