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

Commit aa8228a4 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Don't use an album for UriImages." into gb-ub-photos-arches

parents 38c5d92c 7db87e52
Loading
Loading
Loading
Loading
+0 −32
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.net.Uri;
import android.webkit.MimeTypeMap;

import com.android.gallery3d.app.GalleryApp;
import com.android.gallery3d.util.MediaSetUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
@@ -36,22 +35,6 @@ class UriSource extends MediaSource {

    private GalleryApp mApplication;

    //Array of accepted Uri paths
    private static final String[] ALLOWED_URIS = {
        "content://downloads/all_downloads/"
    };

    private static boolean checkIfUriStringAllowed(String uri){
        boolean ret = false;
        for(String u : ALLOWED_URIS) {
                if (uri.startsWith(u)){
                    ret = true;
                    break;
                }
        }
        return ret;
    }

    public UriSource(GalleryApp context) {
        super("uri");
        mApplication = context;
@@ -87,21 +70,6 @@ class UriSource extends MediaSource {
        return type;
    }

    @Override
    public Path getDefaultSetOf(Path item) {
        MediaObject object = mApplication.getDataManager().getMediaObject(item);
        if (object instanceof UriImage) {
            //Check if Uri path is for an item that should appear
            //in the downloads folder (checks against ALLOWED_URIS).
            String uri = ((UriImage)object).getContentUri().toString();
            if(!checkIfUriStringAllowed(uri))
                return null;
            return Path.fromString("/local/all").getChild(
                    MediaSetUtils.DOWNLOAD_BUCKET_ID);
        }
        return null;
    }

    @Override
    public Path findPathByUri(Uri uri, String type) {
        String mimeType = getMimeType(uri);