summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-09-09 09:16:29 -0700
committerJeff Sharkey <jsharkey@android.com>2013-09-09 17:52:47 -0700
commit66bdbe486e572aee1b06e3dbea9daf87ceb0e1bb (patch)
treef9b577f6d38a34c4420b1899e9431fc82e525892
parent3c03d1b8b7d96209d7b83b6881421ddfc17ccc52 (diff)
downloadandroid_packages_providers_DownloadProvider-66bdbe486e572aee1b06e3dbea9daf87ceb0e1bb.zip
android_packages_providers_DownloadProvider-66bdbe486e572aee1b06e3dbea9daf87ceb0e1bb.tar.gz
android_packages_providers_DownloadProvider-66bdbe486e572aee1b06e3dbea9daf87ceb0e1bb.tar.bz2
Hint sorting, remove XML, follow refactor.
Bug: 10672973, 10577809 Change-Id: I92314c35b37ac590830e881489e6a88afd860de4
-rw-r--r--AndroidManifest.xml2
-rw-r--r--res/xml/document_provider.xml19
-rw-r--r--src/com/android/providers/downloads/DownloadStorageProvider.java31
3 files changed, 17 insertions, 35 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 49f039e..8e848d5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -87,7 +87,7 @@
android:permission="android.permission.MANAGE_DOCUMENTS">
<meta-data
android:name="android.content.DOCUMENT_PROVIDER"
- android:resource="@xml/document_provider" />
+ android:value="true" />
</provider>
<service android:name=".DownloadService"
diff --git a/res/xml/document_provider.xml b/res/xml/document_provider.xml
deleted file mode 100644
index 77891cb..0000000
--- a/res/xml/document_provider.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<documents-provider xmlns:android="http://schemas.android.com/apk/res/android"
- android:customRoots="true">
-</documents-provider>
diff --git a/src/com/android/providers/downloads/DownloadStorageProvider.java b/src/com/android/providers/downloads/DownloadStorageProvider.java
index f1cd8fa..9315ea3 100644
--- a/src/com/android/providers/downloads/DownloadStorageProvider.java
+++ b/src/com/android/providers/downloads/DownloadStorageProvider.java
@@ -83,12 +83,12 @@ public class DownloadStorageProvider extends DocumentsProvider {
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
final RowBuilder row = result.newRow();
- row.offer(Root.COLUMN_ROOT_ID, DOC_ID_ROOT);
- row.offer(Root.COLUMN_ROOT_TYPE, Root.ROOT_TYPE_SHORTCUT);
- row.offer(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_RECENTS);
- row.offer(Root.COLUMN_ICON, R.mipmap.ic_launcher_download);
- row.offer(Root.COLUMN_TITLE, getContext().getString(R.string.root_downloads));
- row.offer(Root.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
+ row.add(Root.COLUMN_ROOT_ID, DOC_ID_ROOT);
+ row.add(Root.COLUMN_ROOT_TYPE, Root.ROOT_TYPE_SHORTCUT);
+ row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_RECENTS);
+ row.add(Root.COLUMN_ICON, R.mipmap.ic_launcher_download);
+ row.add(Root.COLUMN_TITLE, getContext().getString(R.string.root_downloads));
+ row.add(Root.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
return result;
}
@@ -198,8 +198,9 @@ public class DownloadStorageProvider extends DocumentsProvider {
private void includeDefaultDocument(MatrixCursor result) {
final RowBuilder row = result.newRow();
- row.offer(Document.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
- row.offer(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
+ row.add(Document.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
+ row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
+ row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_LAST_MODIFIED);
}
private void includeDownloadFromCursor(MatrixCursor result, Cursor cursor) {
@@ -257,12 +258,12 @@ public class DownloadStorageProvider extends DocumentsProvider {
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LAST_MODIFIED_TIMESTAMP));
final RowBuilder row = result.newRow();
- row.offer(Document.COLUMN_DOCUMENT_ID, docId);
- row.offer(Document.COLUMN_DISPLAY_NAME, displayName);
- row.offer(Document.COLUMN_SUMMARY, summary);
- row.offer(Document.COLUMN_SIZE, size);
- row.offer(Document.COLUMN_MIME_TYPE, mimeType);
- row.offer(Document.COLUMN_LAST_MODIFIED, lastModified);
- row.offer(Document.COLUMN_FLAGS, flags);
+ row.add(Document.COLUMN_DOCUMENT_ID, docId);
+ row.add(Document.COLUMN_DISPLAY_NAME, displayName);
+ row.add(Document.COLUMN_SUMMARY, summary);
+ row.add(Document.COLUMN_SIZE, size);
+ row.add(Document.COLUMN_MIME_TYPE, mimeType);
+ row.add(Document.COLUMN_LAST_MODIFIED, lastModified);
+ row.add(Document.COLUMN_FLAGS, flags);
}
}