Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33e70bd6 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Stop indexing location metadata.

The new ACCESS_MEDIA_LOCATION permission is designed to protect
the location metadata of items the caller doesn't own, but we can't
easily perform partial filtering of metadata from returned Cursor
objects based on per-row ownership, so we're forced to outright stop
indexing and returning location metadata via queries.

Apps can still easily obtain location metadata using ExifInterface.

Bug: 111892141
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: I4d99e6aa7d94bb0e7a50ce86eb1ab0f1ed142d4a
parent 9b827a37
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -37515,8 +37515,8 @@ package android.provider {
    field public static final java.lang.String DATE_TAKEN = "datetaken";
    field public static final java.lang.String DESCRIPTION = "description";
    field public static final java.lang.String IS_PRIVATE = "isprivate";
    field public static final java.lang.String LATITUDE = "latitude";
    field public static final java.lang.String LONGITUDE = "longitude";
    field public static final deprecated java.lang.String LATITUDE = "latitude";
    field public static final deprecated java.lang.String LONGITUDE = "longitude";
    field public static final deprecated java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic";
    field public static final java.lang.String ORIENTATION = "orientation";
    field public static final deprecated java.lang.String PICASA_ID = "picasa_id";
@@ -37640,8 +37640,8 @@ package android.provider {
    field public static final java.lang.String DURATION = "duration";
    field public static final java.lang.String IS_PRIVATE = "isprivate";
    field public static final java.lang.String LANGUAGE = "language";
    field public static final java.lang.String LATITUDE = "latitude";
    field public static final java.lang.String LONGITUDE = "longitude";
    field public static final deprecated java.lang.String LATITUDE = "latitude";
    field public static final deprecated java.lang.String LONGITUDE = "longitude";
    field public static final deprecated java.lang.String MINI_THUMB_MAGIC = "mini_thumb_magic";
    field public static final java.lang.String RESOLUTION = "resolution";
    field public static final java.lang.String TAGS = "tags";
@@ -45865,8 +45865,8 @@ package android.text.style {
    method public deprecated java.lang.String getLocale();
    method public java.util.Locale getLocaleObject();
    method public int getSpanTypeId();
    method public int getUnderlineColor();
    method public java.lang.String[] getSuggestions();
    method public int getUnderlineColor();
    method public void setFlags(int);
    method public void updateDrawState(android.text.TextPaint);
    method public void writeToParcel(android.os.Parcel, int);
+25 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.database.DatabaseUtils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -1166,13 +1167,25 @@ public final class MediaStore {
            /**
             * The latitude where the image was captured.
             * <P>Type: DOUBLE</P>
             *
             * @deprecated location details are no longer indexed for privacy
             *             reasons, and this value is now always {@code null}.
             *             You can still manually obtain location metadata using
             *             {@link ExifInterface#getLatLong(float[])}.
             */
            @Deprecated
            public static final String LATITUDE = "latitude";

            /**
             * The longitude where the image was captured.
             * <P>Type: DOUBLE</P>
             *
             * @deprecated location details are no longer indexed for privacy
             *             reasons, and this value is now always {@code null}.
             *             You can still manually obtain location metadata using
             *             {@link ExifInterface#getLatLong(float[])}.
             */
            @Deprecated
            public static final String LONGITUDE = "longitude";

            /**
@@ -2410,13 +2423,25 @@ public final class MediaStore {
            /**
             * The latitude where the video was captured.
             * <P>Type: DOUBLE</P>
             *
             * @deprecated location details are no longer indexed for privacy
             *             reasons, and this value is now always {@code null}.
             *             You can still manually obtain location metadata using
             *             {@link ExifInterface#getLatLong(float[])}.
             */
            @Deprecated
            public static final String LATITUDE = "latitude";

            /**
             * The longitude where the video was captured.
             * <P>Type: DOUBLE</P>
             *
             * @deprecated location details are no longer indexed for privacy
             *             reasons, and this value is now always {@code null}.
             *             You can still manually obtain location metadata using
             *             {@link ExifInterface#getLatLong(float[])}.
             */
            @Deprecated
            public static final String LONGITUDE = "longitude";

            /**
+0 −6
Original line number Diff line number Diff line
@@ -1015,12 +1015,6 @@ public class MediaScanner implements AutoCloseable {
                    // exif is null
                }
                if (exif != null) {
                    float[] latlng = new float[2];
                    if (exif.getLatLong(latlng)) {
                        values.put(Images.Media.LATITUDE, latlng[0]);
                        values.put(Images.Media.LONGITUDE, latlng[1]);
                    }

                    long time = exif.getGpsDateTime();
                    if (time != -1) {
                        values.put(Images.Media.DATE_TAKEN, time);