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;
|
package de.danoeh.antennapod.core.storage;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
@ -12,6 +13,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.media.MediaMetadataRetriever;
|
import android.media.MediaMetadataRetriever;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -326,10 +328,14 @@ public class PodDBAdapter {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
private SQLiteDatabase openDb() {
|
private SQLiteDatabase openDb() {
|
||||||
SQLiteDatabase newDb;
|
SQLiteDatabase newDb;
|
||||||
try {
|
try {
|
||||||
newDb = SingletonHolder.dbHelper.getWritableDatabase();
|
newDb = SingletonHolder.dbHelper.getWritableDatabase();
|
||||||
|
if (Build.VERSION.SDK_INT >= 16) {
|
||||||
|
newDb.disableWriteAheadLogging();
|
||||||
|
}
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
Log.e(TAG, Log.getStackTraceString(ex));
|
Log.e(TAG, Log.getStackTraceString(ex));
|
||||||
newDb = SingletonHolder.dbHelper.getReadableDatabase();
|
newDb = SingletonHolder.dbHelper.getReadableDatabase();
|
||||||
|
|
Loading…
Reference in New Issue