Removed CustomContentProvider.openFile() as it was used for Google Earth integration.

This commit is contained in:
Dennis Guse
2019-08-18 13:22:41 +02:00
parent f30e3cd5cd
commit 4fa2401b27
2 changed files with 1 additions and 28 deletions
@@ -20,7 +20,6 @@ import android.content.ContentProvider;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.UriMatcher; import android.content.UriMatcher;
import android.database.Cursor; import android.database.Cursor;
import android.database.SQLException; import android.database.SQLException;
@@ -29,18 +28,12 @@ import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder; import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri; import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import de.dennisguse.opentracks.util.FileUtils;
import java.io.File;
import java.io.FileNotFoundException;
/** /**
* A {@link ContentProvider} that handles access to track points, tracks, and * A {@link ContentProvider} that handles access to track points, tracks, and
* waypoints tables. * waypoints tables.
@@ -277,23 +270,6 @@ public class CustomContentProvider extends ContentProvider {
return count; return count;
} }
@Override
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
try {
File file = new File(uri.getPath());
if (file.exists()) {
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
}
throw new FileNotFoundException(uri.getPath());
} finally {
File dir = new File(getContext().getCacheDir(), FileUtils.PLAY_TRACKS_DIR);
for (File file : dir.listFiles()) {
file.delete();
}
getContext().revokeUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
}
/** /**
* Gets the {@link UrlType} for a url. * Gets the {@link UrlType} for a url.
* *
@@ -35,10 +35,7 @@ public class FileUtils {
* Used to transfer picture from the camera. * Used to transfer picture from the camera.
*/ */
public static final String FILEPROVIDER = BuildConfig.APPLICATION_ID + ".fileprovider"; public static final String FILEPROVIDER = BuildConfig.APPLICATION_ID + ".fileprovider";
/**
* The play tracks directory in the app's cache directory.
*/
public static final String PLAY_TRACKS_DIR = "temp";
/** /**
* Our external storage directory. * Our external storage directory.
*/ */