-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not set requireOriginal on Android photo picker uris. (#5162)
* Do not set requireOriginal on Android Picker uris. Android Picker (https://developer.android.com/training/data-storage/shared/photopicker) uris have MediaStore authority but does not accept requireOriginal.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
library/test/src/test/java/com/bumptech/glide/load/data/mediastore/MediaStoreUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.bumptech.glide.load.data.mediastore; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import android.net.Uri; | ||
import android.provider.MediaStore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(sdk = 18) | ||
public class MediaStoreUtilTest { | ||
|
||
@Test | ||
public void isAndroidPickerUri_notAndroidPickerUri_returnsFalse() { | ||
Uri mediaStoreUri = Uri.withAppendedPath(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, "123"); | ||
|
||
assertThat(MediaStoreUtil.isAndroidPickerUri(mediaStoreUri)).isFalse(); | ||
} | ||
|
||
@Test | ||
public void isAndroidPickerUri_identifiesAndroidPickerUri_returnsTrue() { | ||
Uri androidPickerUri = | ||
Uri.parse("content://media/picker/0/com.android.providers.media.photopicker/media/123"); | ||
|
||
assertThat(MediaStoreUtil.isAndroidPickerUri(androidPickerUri)).isTrue(); | ||
} | ||
} |