Remove support for archives from External and Bugreport providers.

Change-Id: Ia281fe05a0a6a5dd6ff1b66d7197312cf4391793
Test: Compiles.
Bug: 31783726
diff --git a/packages/ExternalStorageProvider/Android.mk b/packages/ExternalStorageProvider/Android.mk
index ec6af2f..db825ff4 100644
--- a/packages/ExternalStorageProvider/Android.mk
+++ b/packages/ExternalStorageProvider/Android.mk
@@ -5,7 +5,6 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-documents-archive
 LOCAL_PACKAGE_NAME := ExternalStorageProvider
 LOCAL_CERTIFICATE := platform
 LOCAL_PRIVILEGED_MODULE := true
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index 1fe88f0..33d6b9a 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -44,7 +44,6 @@
 import android.provider.DocumentsProvider;
 import android.provider.MediaStore;
 import android.provider.Settings;
-import android.support.provider.DocumentArchiveHelper;
 import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.DebugUtils;
@@ -101,7 +100,6 @@
 
     private StorageManager mStorageManager;
     private Handler mHandler;
-    private DocumentArchiveHelper mArchiveHelper;
 
     private final Object mRootsLock = new Object();
 
@@ -115,7 +113,6 @@
     public boolean onCreate() {
         mStorageManager = (StorageManager) getContext().getSystemService(Context.STORAGE_SERVICE);
         mHandler = new Handler();
-        mArchiveHelper = new DocumentArchiveHelper(this, (char) 0);
 
         updateVolumes();
         return true;
@@ -377,10 +374,6 @@
         }
 
         final String mimeType = getTypeForFile(file);
-        if (mArchiveHelper.isSupportedArchiveType(mimeType)) {
-            flags |= Document.FLAG_ARCHIVE;
-        }
-
         final String displayName = file.getName();
         if (mimeType.startsWith("image/")) {
             flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
@@ -392,7 +385,6 @@
         row.add(Document.COLUMN_SIZE, file.length());
         row.add(Document.COLUMN_MIME_TYPE, mimeType);
         row.add(Document.COLUMN_FLAGS, flags);
-        row.add(DocumentArchiveHelper.COLUMN_LOCAL_FILE_PATH, file.getPath());
 
         // Only publish dates reasonably after epoch
         long lastModified = file.lastModified();
@@ -421,14 +413,6 @@
     @Override
     public boolean isChildDocument(String parentDocId, String docId) {
         try {
-            if (mArchiveHelper.isArchivedDocument(docId)) {
-                return mArchiveHelper.isChildDocument(parentDocId, docId);
-            }
-            // Archives do not contain regular files.
-            if (mArchiveHelper.isArchivedDocument(parentDocId)) {
-                return false;
-            }
-
             final File parent = getFileForDocId(parentDocId).getCanonicalFile();
             final File doc = getFileForDocId(docId).getCanonicalFile();
             return FileUtils.contains(parent, doc);
@@ -538,10 +522,6 @@
     @Override
     public Cursor queryDocument(String documentId, String[] projection)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.queryDocument(documentId, projection);
-        }
-
         final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
         includeFile(result, documentId, null);
         return result;
@@ -551,11 +531,6 @@
     public Cursor queryChildDocuments(
             String parentDocumentId, String[] projection, String sortOrder)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(parentDocumentId) ||
-                mArchiveHelper.isSupportedArchiveType(getDocumentType(parentDocumentId))) {
-            return mArchiveHelper.queryChildDocuments(parentDocumentId, projection, sortOrder);
-        }
-
         final File parent = getFileForDocId(parentDocumentId);
         final MatrixCursor result = new DirectoryCursor(
                 resolveDocumentProjection(projection), parentDocumentId, parent);
@@ -612,10 +587,6 @@
 
     @Override
     public String getDocumentType(String documentId) throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.getDocumentType(documentId);
-        }
-
         final File file = getFileForDocId(documentId);
         return getTypeForFile(file);
     }
@@ -624,10 +595,6 @@
     public ParcelFileDescriptor openDocument(
             String documentId, String mode, CancellationSignal signal)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.openDocument(documentId, mode, signal);
-        }
-
         final File file = getFileForDocId(documentId);
         final File visibleFile = getFileForDocId(documentId, true);
 
@@ -656,10 +623,6 @@
     public AssetFileDescriptor openDocumentThumbnail(
             String documentId, Point sizeHint, CancellationSignal signal)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.openDocumentThumbnail(documentId, sizeHint, signal);
-        }
-
         final File file = getFileForDocId(documentId);
         return DocumentsContract.openImageThumbnail(file);
     }
diff --git a/packages/Shell/Android.mk b/packages/Shell/Android.mk
index 81ab2ff..2170cc1 100644
--- a/packages/Shell/Android.mk
+++ b/packages/Shell/Android.mk
@@ -5,8 +5,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 \
-        android-support-documents-archive
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
 
 LOCAL_PACKAGE_NAME := Shell
 LOCAL_CERTIFICATE := platform
diff --git a/packages/Shell/src/com/android/shell/BugreportStorageProvider.java b/packages/Shell/src/com/android/shell/BugreportStorageProvider.java
index 9fd80d3..b9b77a4 100644
--- a/packages/Shell/src/com/android/shell/BugreportStorageProvider.java
+++ b/packages/Shell/src/com/android/shell/BugreportStorageProvider.java
@@ -27,7 +27,6 @@
 import android.provider.DocumentsContract.Document;
 import android.provider.DocumentsContract.Root;
 import android.provider.DocumentsProvider;
-import android.support.provider.DocumentArchiveHelper;
 import android.webkit.MimeTypeMap;
 
 import java.io.File;
@@ -48,12 +47,10 @@
     };
 
     private File mRoot;
-    private DocumentArchiveHelper mArchiveHelper;
 
     @Override
     public boolean onCreate() {
         mRoot = new File(getContext().getFilesDir(), "bugreports");
-        mArchiveHelper = new DocumentArchiveHelper(this, (char) 0);
         return true;
     }
 
@@ -72,10 +69,6 @@
     @Override
     public Cursor queryDocument(String documentId, String[] projection)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.queryDocument(documentId, projection);
-        }
-
         final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
         if (DOC_ID_ROOT.equals(documentId)) {
             final RowBuilder row = result.newRow();
@@ -94,11 +87,6 @@
     public Cursor queryChildDocuments(
             String parentDocumentId, String[] projection, String sortOrder)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(parentDocumentId) ||
-                mArchiveHelper.isSupportedArchiveType(getDocumentType(parentDocumentId))) {
-            return mArchiveHelper.queryChildDocuments(parentDocumentId, projection, sortOrder);
-        }
-
         final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
         if (DOC_ID_ROOT.equals(parentDocumentId)) {
             final File[] files = mRoot.listFiles();
@@ -116,10 +104,6 @@
     public ParcelFileDescriptor openDocument(
             String documentId, String mode, CancellationSignal signal)
             throws FileNotFoundException {
-        if (mArchiveHelper.isArchivedDocument(documentId)) {
-            return mArchiveHelper.openDocument(documentId, mode, signal);
-        }
-
         if (ParcelFileDescriptor.parseMode(mode) != ParcelFileDescriptor.MODE_READ_ONLY) {
             throw new FileNotFoundException("Failed to open: " + documentId + ", mode = " + mode);
         }
@@ -182,10 +166,6 @@
     private void addFileRow(MatrixCursor result, File file) {
         String mimeType = getTypeForName(file.getName());
         int flags = Document.FLAG_SUPPORTS_DELETE;
-        if (mArchiveHelper.isSupportedArchiveType(mimeType)) {
-            flags |= Document.FLAG_ARCHIVE;
-        }
-
         final RowBuilder row = result.newRow();
         row.add(Document.COLUMN_DOCUMENT_ID, getDocIdForFile(file));
         row.add(Document.COLUMN_MIME_TYPE, mimeType);