From f7fc304724bfde1684df3bd244f1e8391a0de921 Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Wed, 11 Jan 2017 18:35:38 -0800 Subject: [PATCH] Launch the Gallery app to manage photos from the Storage screen. This replaces the old behavior of opening the Files app and matches the latest mocks. Bug: 33199077 Test: settings robo Change-Id: Id6451300063fcb3f10c6272c2a2fa49fe1384ac5 --- .../storage/StorageItemPreferenceController.java | 8 +++++--- .../storage/StorageItemPreferenceControllerTest.java | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java index dce8a25cd71..7e98918b3a2 100644 --- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java +++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java @@ -54,6 +54,7 @@ public class StorageItemPreferenceController extends PreferenceController implements StorageMeasurement.MeasurementReceiver, LifecycleObserver, OnDestroy { private static final String TAG = "StorageItemPreference"; + private static final String IMAGE_MIME_TYPE = "image/*"; @VisibleForTesting static final String PHOTO_KEY = "pref_photos_videos"; @VisibleForTesting @@ -233,9 +234,10 @@ public class StorageItemPreferenceController extends PreferenceController } private Intent getPhotosIntent() { - Intent intent = new Intent(DocumentsContract.ACTION_BROWSE); - intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "images_root")); - intent.addCategory(Intent.CATEGORY_DEFAULT); + Intent intent = new Intent(); + intent.setAction(android.content.Intent.ACTION_VIEW); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); + intent.setType(IMAGE_MIME_TYPE); return intent; } diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java index b0c0b441c53..7776633f946 100644 --- a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java @@ -106,10 +106,8 @@ public class StorageItemPreferenceControllerTest { any(UserHandle.class)); Intent intent = argumentCaptor.getValue(); - assertThat(intent.getAction()).isEqualTo(DocumentsContract.ACTION_BROWSE); - assertThat(intent.getData()).isEqualTo(DocumentsContract.buildRootUri( - "com.android.providers.media.documents", - "images_root")); + assertThat(intent.getType()).isEqualTo("image/*"); + assertThat(intent.getAction()).isEqualTo(android.content.Intent.ACTION_VIEW); } @Test