Remove DocumentsContract.ACTION_BROWSE.

Test: Code builds and tests pass.
Bug: 35760993
Change-Id: I7e540b71a7be60d250ffec899eb5c08941dc24a8
This commit is contained in:
Garfield Tan
2017-03-01 11:04:35 -08:00
parent 1f1be36aee
commit 2d01be108d
3 changed files with 18 additions and 9 deletions

View File

@@ -68,8 +68,10 @@ public class MusicViewHolderController implements FileViewHolderController {
@Override @Override
public void onClick(Fragment fragment) { public void onClick(Fragment fragment) {
Intent intent = new Intent(DocumentsContract.ACTION_BROWSE); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "audio_root")); intent.setDataAndType(
DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "audio_root"),
DocumentsContract.Root.MIME_TYPE_ITEM);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra(Intent.EXTRA_USER_ID, mUser); intent.putExtra(Intent.EXTRA_USER_ID, mUser);
Utils.launchIntent(fragment, intent); Utils.launchIntent(fragment, intent);

View File

@@ -483,20 +483,26 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
} break; } break;
case R.string.storage_detail_images: { case R.string.storage_detail_images: {
intent = new Intent(DocumentsContract.ACTION_BROWSE); intent = new Intent(Intent.ACTION_VIEW);
intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "images_root")); intent.setDataAndType(
DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "images_root"),
DocumentsContract.Root.MIME_TYPE_ITEM);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
} break; } break;
case R.string.storage_detail_videos: { case R.string.storage_detail_videos: {
intent = new Intent(DocumentsContract.ACTION_BROWSE); intent = new Intent(Intent.ACTION_VIEW);
intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "videos_root")); intent.setDataAndType(
DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "videos_root"),
DocumentsContract.Root.MIME_TYPE_ITEM);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
} break; } break;
case R.string.storage_detail_audio: { case R.string.storage_detail_audio: {
intent = new Intent(DocumentsContract.ACTION_BROWSE); intent = new Intent(DocumentsContract.Root.MIME_TYPE_ITEM);
intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "audio_root")); intent.setDataAndType(
DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "audio_root"),
DocumentsContract.Root.MIME_TYPE_ITEM);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_DEFAULT);
} break; } break;

View File

@@ -99,9 +99,10 @@ public class MusicViewHolderControllerTest {
verify(mFragment).startActivity(argumentCaptor.capture()); verify(mFragment).startActivity(argumentCaptor.capture());
Intent intent = argumentCaptor.getValue(); Intent intent = argumentCaptor.getValue();
assertThat(intent.getAction()).isEqualTo(DocumentsContract.ACTION_BROWSE); assertThat(intent.getAction()).isEqualTo(Intent.ACTION_VIEW);
assertThat(intent.getData()).isEqualTo(DocumentsContract.buildRootUri( assertThat(intent.getData()).isEqualTo(DocumentsContract.buildRootUri(
"com.android.providers.media.documents", "com.android.providers.media.documents",
"audio_root")); "audio_root"));
assertThat(intent.getType()).isEqualTo(DocumentsContract.Root.MIME_TYPE_ITEM);
} }
} }