DO NOT MERGE
Guard the camera workaround with a targetsdk check
BUG: 149569689
Test: portrait shots by camera show up in gallery
Change-Id: I63d1412a9e0c3dfdcad2199dfd871f4b8956234e
Merged-In: I63d1412a9e0c3dfdcad2199dfd871f4b8956234e
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 8928999..3b98ab8 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4491,7 +4491,10 @@
private int updateInternal(Uri uri, ContentValues initialValues, String userWhere,
String[] userWhereArgs) {
- if ("com.google.android.GoogleCamera".equals(getCallingPackageOrSelf())) {
+ // Limit the hacky workaround to camera targeting Q and below, to allow newer versions
+ // of camera that does the right thing to work correctly.
+ if ("com.google.android.GoogleCamera".equals(getCallingPackageOrSelf())
+ && getCallingPackageTargetSdkVersion() <= Build.VERSION_CODES.Q) {
if (matchUri(uri, false) == IMAGES_MEDIA_ID) {
Log.w(TAG, "Working around app bug in b/111966296");
uri = MediaStore.Files.getContentUri("external", ContentUris.parseId(uri));