Loading core/java/android/provider/DocumentsContract.java +0 −2 Original line number Diff line number Diff line Loading @@ -118,8 +118,6 @@ public final class DocumentsContract { */ public static final String EXTRA_PROMPT = "android.provider.extra.PROMPT"; /** {@hide} */ public static final String ACTION_MANAGE_ROOT = "android.provider.action.MANAGE_ROOT"; /** {@hide} */ public static final String ACTION_MANAGE_DOCUMENT = "android.provider.action.MANAGE_DOCUMENT"; Loading packages/DocumentsUI/AndroidManifest.xml +4 −12 Original line number Diff line number Diff line Loading @@ -39,18 +39,6 @@ </intent-filter> </activity> <activity android:name=".DownloadsActivity" android:theme="@style/DocumentsTheme" android:label="@string/downloads_label" android:icon="@drawable/ic_doc_text"> <intent-filter> <action android:name="android.provider.action.MANAGE_ROOT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.document/root" /> </intent-filter> </activity> <activity android:name=".LauncherActivity" android:theme="@android:style/Theme.NoDisplay" Loading @@ -71,6 +59,10 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW_DOWNLOADS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.provider.action.BROWSE" /> <category android:name="android.intent.category.DEFAULT" /> Loading packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.javadeleted 100644 → 0 +0 −185 Original line number Diff line number Diff line /* * 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. */ package com.android.documentsui; import static com.android.documentsui.State.ACTION_MANAGE; import static com.android.documentsui.dirlist.DirectoryFragment.ANIM_NONE; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.DocumentsContract; import android.support.design.widget.Snackbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toolbar; import com.android.documentsui.dirlist.DirectoryFragment; import com.android.documentsui.dirlist.Model; import com.android.documentsui.model.DocumentInfo; import com.android.documentsui.model.RootInfo; import java.util.Arrays; import java.util.List; // Let's face it. MANAGE_ROOT is used almost exclusively // for downloads, and is specialized for this purpose. // So it is now thusly christened. public class DownloadsActivity extends BaseActivity { private static final String TAG = "DownloadsActivity"; public DownloadsActivity() { super(R.layout.downloads_activity, TAG); } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); final Context context = this; Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitleTextAppearance(context, android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title); if (!mState.restored) { // In this case, we set the activity title in AsyncTask.onPostExecute(). To prevent // talkback from reading aloud the default title, we clear it here. setTitle(""); final Uri rootUri = getIntent().getData(); new LoadRootTask(this, rootUri).executeOnExecutor(getExecutorForCurrentDirectory()); } else { refreshCurrentRootAndDirectory(ANIM_NONE); } } @Override void includeState(State state) { state.action = ACTION_MANAGE; state.acceptMimes = new String[] { "*/*" }; state.allowMultiple = true; state.showSize = true; state.excludedAuthorities = getExcludedAuthorities(); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); mNavigator.update(); } @Override public String getDrawerTitle() { return null; // being and nothingness } @Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); final MenuItem createDir = menu.findItem(R.id.menu_create_dir); final MenuItem pasteFromCb = menu.findItem(R.id.menu_paste_from_clipboard); final MenuItem fileSize = menu.findItem(R.id.menu_file_size); createDir.setVisible(false); pasteFromCb.setEnabled(false); fileSize.setVisible(false); Menus.disableHiddenItems(menu); return true; } @Override void refreshDirectory(int anim) { final FragmentManager fm = getFragmentManager(); final RootInfo root = getCurrentRoot(); final DocumentInfo cwd = getCurrentDirectory(); assert(!mSearchManager.isSearching()); // If started in manage roots mode, there has to be a cwd (i.e. the root dir of the managed // root). assert(cwd != null); // Normal boring directory DirectoryFragment.showDirectory(fm, root, cwd, anim); } @Override public void onDocumentPicked(DocumentInfo doc, Model model) { assert(!doc.isDirectory()); // First try managing the document; we expect manager to filter // based on authority, so we don't grant. final Intent manage = new Intent(DocumentsContract.ACTION_MANAGE_DOCUMENT); manage.setData(doc.derivedUri); try { startActivity(manage); } catch (ActivityNotFoundException ex) { // Fall back to viewing. final Intent view = new Intent(Intent.ACTION_VIEW); view.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); view.setData(doc.derivedUri); try { startActivity(view); } catch (ActivityNotFoundException ex2) { Snackbars.makeSnackbar(this, R.string.toast_no_application, Snackbar.LENGTH_SHORT) .show(); } } } @Override public void onDocumentsPicked(List<DocumentInfo> docs) {} @Override void onTaskFinished(Uri... uris) { Log.d(TAG, "onFinished() " + Arrays.toString(uris)); final Intent intent = new Intent(); if (uris.length == 1) { intent.setData(uris[0]); } else if (uris.length > 1) { final ClipData clipData = new ClipData( null, mState.acceptMimes, new ClipData.Item(uris[0])); for (int i = 1; i < uris.length; i++) { clipData.addItem(new ClipData.Item(uris[i])); } intent.setClipData(clipData); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); setResult(Activity.RESULT_OK, intent); finish(); } public static DownloadsActivity get(Fragment fragment) { return (DownloadsActivity) fragment.getActivity(); } } packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java +4 −4 Original line number Diff line number Diff line Loading @@ -108,10 +108,10 @@ public class FilesActivity extends BaseActivity { // authority. That way a misbehaving provider won't result in an ANR. loadRoot(uri); } else { if (DEBUG) Log.d(TAG, "Launching into Home directory."); // If all else fails, try to load "Home" directory. final Uri homeUri = DocumentsContract.buildHomeUri(); loadRoot(homeUri); if (DEBUG) Log.d(TAG, "All other means skipped. Launching into default directory."); Uri defaultUri = DocumentsContract.buildRootUri( "com.android.providers.downloads.documents", "downloads"); loadRoot(defaultUri); } final @DialogType int dialogType = intent.getIntExtra( Loading packages/DocumentsUI/src/com/android/documentsui/Metrics.java +3 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.documentsui; import static android.os.Environment.STANDARD_DIRECTORIES; import static com.android.documentsui.Shared.DEBUG; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.StringDef; Loading Loading @@ -58,7 +59,7 @@ public final class Metrics { private static final String COUNT_CREATE_MIME = "docsui_create_mime"; private static final String COUNT_GET_CONTENT_MIME = "docsui_get_content_mime"; private static final String COUNT_BROWSE_ROOT = "docsui_browse_root"; private static final String COUNT_MANAGE_ROOT = "docsui_manage_root"; @Deprecated private static final String COUNT_MANAGE_ROOT = "docsui_manage_root"; private static final String COUNT_MULTI_WINDOW = "docsui_multi_window"; private static final String COUNT_FILEOP_SYSTEM = "docsui_fileop_system"; private static final String COUNT_FILEOP_EXTERNAL = "docsui_fileop_external"; Loading Loading @@ -194,7 +195,7 @@ public final class Metrics { private static final int ACTION_CREATE = 3; private static final int ACTION_GET_CONTENT = 4; private static final int ACTION_OPEN_TREE = 5; private static final int ACTION_MANAGE = 6; @Deprecated private static final int ACTION_MANAGE = 6; private static final int ACTION_BROWSE = 7; private static final int ACTION_PICK_COPY_DESTINATION = 8; Loading Loading @@ -246,9 +247,6 @@ public final class Metrics { case State.ACTION_GET_CONTENT: logHistogram(context, COUNT_GET_CONTENT_MIME, sanitizeMime(intent.getType())); break; case State.ACTION_MANAGE: logHistogram(context, COUNT_MANAGE_ROOT, sanitizeRoot(uri)); break; case State.ACTION_BROWSE: logHistogram(context, COUNT_BROWSE_ROOT, sanitizeRoot(uri)); break; Loading Loading @@ -641,8 +639,6 @@ public final class Metrics { return ACTION_GET_CONTENT; case State.ACTION_OPEN_TREE: return ACTION_OPEN_TREE; case State.ACTION_MANAGE: return ACTION_MANAGE; case State.ACTION_BROWSE: return ACTION_BROWSE; case State.ACTION_PICK_COPY_DESTINATION: Loading Loading
core/java/android/provider/DocumentsContract.java +0 −2 Original line number Diff line number Diff line Loading @@ -118,8 +118,6 @@ public final class DocumentsContract { */ public static final String EXTRA_PROMPT = "android.provider.extra.PROMPT"; /** {@hide} */ public static final String ACTION_MANAGE_ROOT = "android.provider.action.MANAGE_ROOT"; /** {@hide} */ public static final String ACTION_MANAGE_DOCUMENT = "android.provider.action.MANAGE_DOCUMENT"; Loading
packages/DocumentsUI/AndroidManifest.xml +4 −12 Original line number Diff line number Diff line Loading @@ -39,18 +39,6 @@ </intent-filter> </activity> <activity android:name=".DownloadsActivity" android:theme="@style/DocumentsTheme" android:label="@string/downloads_label" android:icon="@drawable/ic_doc_text"> <intent-filter> <action android:name="android.provider.action.MANAGE_ROOT" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.document/root" /> </intent-filter> </activity> <activity android:name=".LauncherActivity" android:theme="@android:style/Theme.NoDisplay" Loading @@ -71,6 +59,10 @@ <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW_DOWNLOADS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.provider.action.BROWSE" /> <category android:name="android.intent.category.DEFAULT" /> Loading
packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.javadeleted 100644 → 0 +0 −185 Original line number Diff line number Diff line /* * 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. */ package com.android.documentsui; import static com.android.documentsui.State.ACTION_MANAGE; import static com.android.documentsui.dirlist.DirectoryFragment.ANIM_NONE; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.DocumentsContract; import android.support.design.widget.Snackbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toolbar; import com.android.documentsui.dirlist.DirectoryFragment; import com.android.documentsui.dirlist.Model; import com.android.documentsui.model.DocumentInfo; import com.android.documentsui.model.RootInfo; import java.util.Arrays; import java.util.List; // Let's face it. MANAGE_ROOT is used almost exclusively // for downloads, and is specialized for this purpose. // So it is now thusly christened. public class DownloadsActivity extends BaseActivity { private static final String TAG = "DownloadsActivity"; public DownloadsActivity() { super(R.layout.downloads_activity, TAG); } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); final Context context = this; Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitleTextAppearance(context, android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title); if (!mState.restored) { // In this case, we set the activity title in AsyncTask.onPostExecute(). To prevent // talkback from reading aloud the default title, we clear it here. setTitle(""); final Uri rootUri = getIntent().getData(); new LoadRootTask(this, rootUri).executeOnExecutor(getExecutorForCurrentDirectory()); } else { refreshCurrentRootAndDirectory(ANIM_NONE); } } @Override void includeState(State state) { state.action = ACTION_MANAGE; state.acceptMimes = new String[] { "*/*" }; state.allowMultiple = true; state.showSize = true; state.excludedAuthorities = getExcludedAuthorities(); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); mNavigator.update(); } @Override public String getDrawerTitle() { return null; // being and nothingness } @Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); final MenuItem createDir = menu.findItem(R.id.menu_create_dir); final MenuItem pasteFromCb = menu.findItem(R.id.menu_paste_from_clipboard); final MenuItem fileSize = menu.findItem(R.id.menu_file_size); createDir.setVisible(false); pasteFromCb.setEnabled(false); fileSize.setVisible(false); Menus.disableHiddenItems(menu); return true; } @Override void refreshDirectory(int anim) { final FragmentManager fm = getFragmentManager(); final RootInfo root = getCurrentRoot(); final DocumentInfo cwd = getCurrentDirectory(); assert(!mSearchManager.isSearching()); // If started in manage roots mode, there has to be a cwd (i.e. the root dir of the managed // root). assert(cwd != null); // Normal boring directory DirectoryFragment.showDirectory(fm, root, cwd, anim); } @Override public void onDocumentPicked(DocumentInfo doc, Model model) { assert(!doc.isDirectory()); // First try managing the document; we expect manager to filter // based on authority, so we don't grant. final Intent manage = new Intent(DocumentsContract.ACTION_MANAGE_DOCUMENT); manage.setData(doc.derivedUri); try { startActivity(manage); } catch (ActivityNotFoundException ex) { // Fall back to viewing. final Intent view = new Intent(Intent.ACTION_VIEW); view.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); view.setData(doc.derivedUri); try { startActivity(view); } catch (ActivityNotFoundException ex2) { Snackbars.makeSnackbar(this, R.string.toast_no_application, Snackbar.LENGTH_SHORT) .show(); } } } @Override public void onDocumentsPicked(List<DocumentInfo> docs) {} @Override void onTaskFinished(Uri... uris) { Log.d(TAG, "onFinished() " + Arrays.toString(uris)); final Intent intent = new Intent(); if (uris.length == 1) { intent.setData(uris[0]); } else if (uris.length > 1) { final ClipData clipData = new ClipData( null, mState.acceptMimes, new ClipData.Item(uris[0])); for (int i = 1; i < uris.length; i++) { clipData.addItem(new ClipData.Item(uris[i])); } intent.setClipData(clipData); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); setResult(Activity.RESULT_OK, intent); finish(); } public static DownloadsActivity get(Fragment fragment) { return (DownloadsActivity) fragment.getActivity(); } }
packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java +4 −4 Original line number Diff line number Diff line Loading @@ -108,10 +108,10 @@ public class FilesActivity extends BaseActivity { // authority. That way a misbehaving provider won't result in an ANR. loadRoot(uri); } else { if (DEBUG) Log.d(TAG, "Launching into Home directory."); // If all else fails, try to load "Home" directory. final Uri homeUri = DocumentsContract.buildHomeUri(); loadRoot(homeUri); if (DEBUG) Log.d(TAG, "All other means skipped. Launching into default directory."); Uri defaultUri = DocumentsContract.buildRootUri( "com.android.providers.downloads.documents", "downloads"); loadRoot(defaultUri); } final @DialogType int dialogType = intent.getIntExtra( Loading
packages/DocumentsUI/src/com/android/documentsui/Metrics.java +3 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.documentsui; import static android.os.Environment.STANDARD_DIRECTORIES; import static com.android.documentsui.Shared.DEBUG; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.StringDef; Loading Loading @@ -58,7 +59,7 @@ public final class Metrics { private static final String COUNT_CREATE_MIME = "docsui_create_mime"; private static final String COUNT_GET_CONTENT_MIME = "docsui_get_content_mime"; private static final String COUNT_BROWSE_ROOT = "docsui_browse_root"; private static final String COUNT_MANAGE_ROOT = "docsui_manage_root"; @Deprecated private static final String COUNT_MANAGE_ROOT = "docsui_manage_root"; private static final String COUNT_MULTI_WINDOW = "docsui_multi_window"; private static final String COUNT_FILEOP_SYSTEM = "docsui_fileop_system"; private static final String COUNT_FILEOP_EXTERNAL = "docsui_fileop_external"; Loading Loading @@ -194,7 +195,7 @@ public final class Metrics { private static final int ACTION_CREATE = 3; private static final int ACTION_GET_CONTENT = 4; private static final int ACTION_OPEN_TREE = 5; private static final int ACTION_MANAGE = 6; @Deprecated private static final int ACTION_MANAGE = 6; private static final int ACTION_BROWSE = 7; private static final int ACTION_PICK_COPY_DESTINATION = 8; Loading Loading @@ -246,9 +247,6 @@ public final class Metrics { case State.ACTION_GET_CONTENT: logHistogram(context, COUNT_GET_CONTENT_MIME, sanitizeMime(intent.getType())); break; case State.ACTION_MANAGE: logHistogram(context, COUNT_MANAGE_ROOT, sanitizeRoot(uri)); break; case State.ACTION_BROWSE: logHistogram(context, COUNT_BROWSE_ROOT, sanitizeRoot(uri)); break; Loading Loading @@ -641,8 +639,6 @@ public final class Metrics { return ACTION_GET_CONTENT; case State.ACTION_OPEN_TREE: return ACTION_OPEN_TREE; case State.ACTION_MANAGE: return ACTION_MANAGE; case State.ACTION_BROWSE: return ACTION_BROWSE; case State.ACTION_PICK_COPY_DESTINATION: Loading