diff options
| author | Daichi Hirono <hirono@google.com> | 2015-06-11 08:36:50 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-11 08:36:52 +0000 |
| commit | b51cdcc3a3f23ffbbc2c78ef3c69a97f18f03539 (patch) | |
| tree | 21214e903464e614126ab1556138c07b9cb0d0ca | |
| parent | 67e56c103945d4ba5c22e55ba2c1677cd776458e (diff) | |
| parent | c00d5d4d82620beba271e63875b93ad9cc39523f (diff) | |
Merge "Create package directory for MtpDocumentProvider."
4 files changed, 119 insertions, 0 deletions
diff --git a/packages/MtpDocumentsProvider/Android.mk b/packages/MtpDocumentsProvider/Android.mk new file mode 100644 index 000000000000..02cd6777cfe2 --- /dev/null +++ b/packages/MtpDocumentsProvider/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := MtpDocumentsProvider +LOCAL_CERTIFICATE := media + +include $(BUILD_PACKAGE) diff --git a/packages/MtpDocumentsProvider/AndroidManifest.xml b/packages/MtpDocumentsProvider/AndroidManifest.xml new file mode 100644 index 000000000000..9a1dc366b76a --- /dev/null +++ b/packages/MtpDocumentsProvider/AndroidManifest.xml @@ -0,0 +1,17 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.mtp" + android:sharedUserId="android.media"> + <application android:label="@string/app_label"> + <provider + android:name=".MtpDocumentsProvider" + android:authorities="com.android.mtp.documents" + android:grantUriPermissions="true" + android:exported="true" + android:permission="android.permission.MANAGE_DOCUMENTS" + android:enabled="false"> + <intent-filter> + <action android:name="android.content.action.DOCUMENTS_PROVIDER" /> + </intent-filter> + </provider> + </application> +</manifest> diff --git a/packages/MtpDocumentsProvider/res/values/strings.xml b/packages/MtpDocumentsProvider/res/values/strings.xml new file mode 100644 index 000000000000..37efdb5294d4 --- /dev/null +++ b/packages/MtpDocumentsProvider/res/values/strings.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2015 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. +--> + +<resources> + <!-- Title of the external storage application [CHAR LIMIT=32] --> + <string name="app_label">MTP Storage</string> +</resources> diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java new file mode 100644 index 000000000000..ba3067e17b3a --- /dev/null +++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2015 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. + */ + +package com.android.mtp; + +import android.database.Cursor; +import android.os.CancellationSignal; +import android.os.ParcelFileDescriptor; +import android.provider.DocumentsContract.Document; +import android.provider.DocumentsContract.Root; +import android.provider.DocumentsProvider; +import java.io.FileNotFoundException; + +public class MtpDocumentsProvider extends DocumentsProvider { + private static final String TAG = "MtpDocumentsProvider"; + public static final String AUTHORITY = "com.android.mtp.documents"; + + private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { + Root.COLUMN_ROOT_ID, Root.COLUMN_FLAGS, Root.COLUMN_ICON, + Root.COLUMN_TITLE, Root.COLUMN_DOCUMENT_ID, + Root.COLUMN_AVAILABLE_BYTES, + }; + + private static final String[] DEFAULT_DOCUMENT_PROJECTION = new String[] { + Document.COLUMN_DOCUMENT_ID, Document.COLUMN_MIME_TYPE, + Document.COLUMN_DISPLAY_NAME, Document.COLUMN_LAST_MODIFIED, + Document.COLUMN_FLAGS, Document.COLUMN_SIZE, + }; + + @Override + public boolean onCreate() { + return true; + } + + @Override + public Cursor queryRoots(String[] projection) throws FileNotFoundException { + return null; + } + + @Override + public Cursor queryDocument(String documentId, String[] projection) + throws FileNotFoundException { + return null; + } + + @Override + public Cursor queryChildDocuments(String parentDocumentId, + String[] projection, String sortOrder) + throws FileNotFoundException { + return null; + } + + @Override + public ParcelFileDescriptor openDocument(String documentId, String mode, + CancellationSignal signal) throws FileNotFoundException { + return null; + } +} |
