Fix bug preventing database import on Android 9.
Fixes #2925, fix suggested by ByteHamster.
This commit is contained in:
parent
9a92e66ffd
commit
f90ce4228b
|
@ -1,5 +1,6 @@
|
|||
package de.danoeh.antennapod.core.storage;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
@ -12,6 +13,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -326,10 +328,14 @@ public class PodDBAdapter {
|
|||
return this;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private SQLiteDatabase openDb() {
|
||||
SQLiteDatabase newDb;
|
||||
try {
|
||||
newDb = SingletonHolder.dbHelper.getWritableDatabase();
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
newDb.disableWriteAheadLogging();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Log.e(TAG, Log.getStackTraceString(ex));
|
||||
newDb = SingletonHolder.dbHelper.getReadableDatabase();
|
||||
|
|
Loading…
Reference in New Issue