diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 09a21f8ba0cd8..4aa4d772fb544 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -841,6 +841,12 @@ public class DownloadManager { } ContentValues values = new ContentValues(); values.put(Downloads.Impl.COLUMN_DELETED, 1); + // if only one id is passed in, then include it in the uri itself. + // this will eliminate a full database scan in the download service. + if (ids.length == 1) { + return mResolver.update(ContentUris.withAppendedId(mBaseUri, ids[0]), values, + null, null); + } return mResolver.update(mBaseUri, values, getWhereClauseForIds(ids), getWhereArgsForIds(ids)); } diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index ff769ada47d92..683e603900311 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -382,6 +382,27 @@ public final class Downloads { */ public static final String COLUMN_ERROR_MSG = "errorMsg"; + /** + * This column stores the source of the last update to this row. + * This column is only for internal use. + * Valid values are indicated by LAST_UPDATESRC_* constants. + *
Type: INT
+ */ + public static final String COLUMN_LAST_UPDATESRC = "lastUpdateSrc"; + + /** + * default value for {@link #COLUMN_LAST_UPDATESRC}. + * This value is used when this column's value is not relevant. + */ + public static final int LAST_UPDATESRC_NOT_RELEVANT = 0; + + /** + * One of the values taken by {@link #COLUMN_LAST_UPDATESRC}. + * This value is used when the update is NOT to be relayed to the DownloadService + * (and thus spare DownloadService from scanning the database when this change occurs) + */ + public static final int LAST_UPDATESRC_DONT_NOTIFY_DOWNLOADSVC = 1; + /* * Lists the destinations that an application can specify for a download. */