Merge "Launch the Gallery app to manage photos from the Storage screen."

This commit is contained in:
TreeHugger Robot
2017-01-17 21:02:56 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ public class StorageItemPreferenceController extends PreferenceController
implements StorageMeasurement.MeasurementReceiver, LifecycleObserver, OnDestroy { implements StorageMeasurement.MeasurementReceiver, LifecycleObserver, OnDestroy {
private static final String TAG = "StorageItemPreference"; private static final String TAG = "StorageItemPreference";
private static final String IMAGE_MIME_TYPE = "image/*";
@VisibleForTesting @VisibleForTesting
static final String PHOTO_KEY = "pref_photos_videos"; static final String PHOTO_KEY = "pref_photos_videos";
@VisibleForTesting @VisibleForTesting
@@ -233,9 +234,10 @@ public class StorageItemPreferenceController extends PreferenceController
} }
private Intent getPhotosIntent() { private Intent getPhotosIntent() {
Intent intent = new Intent(DocumentsContract.ACTION_BROWSE); Intent intent = new Intent();
intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "images_root")); intent.setAction(android.content.Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.setType(IMAGE_MIME_TYPE);
return intent; return intent;
} }

View File

@@ -106,10 +106,8 @@ public class StorageItemPreferenceControllerTest {
any(UserHandle.class)); any(UserHandle.class));
Intent intent = argumentCaptor.getValue(); Intent intent = argumentCaptor.getValue();
assertThat(intent.getAction()).isEqualTo(DocumentsContract.ACTION_BROWSE); assertThat(intent.getType()).isEqualTo("image/*");
assertThat(intent.getData()).isEqualTo(DocumentsContract.buildRootUri( assertThat(intent.getAction()).isEqualTo(android.content.Intent.ACTION_VIEW);
"com.android.providers.media.documents",
"images_root"));
} }
@Test @Test