It turns out to be useful to allow enumeration on a per-tag basis,

and it's easy to support based on the data structures we have, so
add a tag parameter to getNextEvent().
This commit is contained in:
Dan Egnor
2009-10-20 13:05:17 -07:00
parent 4410ec8f7c
commit b3b06fc39b
3 changed files with 116 additions and 56 deletions

View File

@@ -244,7 +244,7 @@ public final class DropBoxService extends IDropBox.Stub {
mContentResolver, Settings.Gservices.DROPBOX_TAG_PREFIX + tag));
}
public synchronized DropBoxEntry getNextEntry(long millis) {
public synchronized DropBoxEntry getNextEntry(String tag, long millis) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.READ_LOGS)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("READ_LOGS permission required");
@@ -257,7 +257,10 @@ public final class DropBoxService extends IDropBox.Stub {
return null;
}
for (EntryFile entry : mAllFiles.contents.tailSet(new EntryFile(millis + 1))) {
FileList list = tag == null ? mAllFiles : mFilesByTag.get(tag);
if (list == null) return null;
for (EntryFile entry : list.contents.tailSet(new EntryFile(millis + 1))) {
if (entry.tag == null) continue;
try {
File file = (entry.flags & DropBoxEntry.IS_EMPTY) != 0 ? null : entry.file;