summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI/src/com
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-09-26 11:32:30 -0700
committerJeff Sharkey <jsharkey@android.com>2013-09-26 13:14:45 -0700
commitee2f7df9ee8a4f43c3b0858bad08a4f0a59a627f (patch)
tree82b57d14fea5eabb6e951ebebc976e1a0c451021 /packages/DocumentsUI/src/com
parent6e85d24210c4966e4a76ff3b099566dd45398e91 (diff)
downloadframeworks_base-ee2f7df9ee8a4f43c3b0858bad08a4f0a59a627f.zip
frameworks_base-ee2f7df9ee8a4f43c3b0858bad08a4f0a59a627f.tar.gz
frameworks_base-ee2f7df9ee8a4f43c3b0858bad08a4f0a59a627f.tar.bz2
Tighten flags enforcement, API to test Uris.
Check and throw if callers request invalid grant flags. Add API to test if a Uri is backend by a DocumentsProvider. Bug: 10919391, 10935608 Change-Id: Ifa6afefb95983558c8c64dc15ddf650e9fe07080
Diffstat (limited to 'packages/DocumentsUI/src/com')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/TestActivity.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/TestActivity.java b/packages/DocumentsUI/src/com/android/documentsui/TestActivity.java
index 9861399..57fc7e4 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/TestActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/TestActivity.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.provider.DocumentsContract;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
@@ -209,6 +210,9 @@ public class TestActivity extends Activity {
if (requestCode == CODE_READ) {
final Uri uri = data != null ? data.getData() : null;
if (uri != null) {
+ if (DocumentsContract.isDocumentUri(this, uri)) {
+ result += "; DOC_ID";
+ }
getContentResolver()
.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
InputStream is = null;
@@ -228,6 +232,9 @@ public class TestActivity extends Activity {
} else if (requestCode == CODE_WRITE) {
final Uri uri = data != null ? data.getData() : null;
if (uri != null) {
+ if (DocumentsContract.isDocumentUri(this, uri)) {
+ result += "; DOC_ID";
+ }
getContentResolver()
.takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
OutputStream os = null;