
Description
When trying to insert content values via ContentProvider on LG G2 in activity.onResume() the application crashes after rotation change.
After rotation change SQLDatebaseHelper.getWirteableDatabase(String password) returns a db, which is readOnly == false, but when trying to insert values getting the following exception
java.lang.RuntimeException: Unable to resume activity {com.example.tmichelc.sqlciphertestapplication/com.example.tmichelc.sqlciphertestapplication.MainActivity}: net.sqlcipher.database.SQLiteException: error code 8: attempt to write a readonly database
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2795)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2824)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3755)
at android.app.ActivityThread.access$900(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5105)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Caused by: net.sqlcipher.database.SQLiteException: error code 8: attempt to write a readonly database
at net.sqlcipher.database.SQLiteStatement.native_execute(Native Method)
at net.sqlcipher.database.SQLiteStatement.execute(SQLiteStatement.java:58)
at net.sqlcipher.database.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1646)
at net.sqlcipher.database.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1528)
at com.example.tmichelc.sqlciphertestapplication.db.encrypted.SQLCipherContentProvider.insert(SQLCipherContentProvider.java:91)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:220)
at android.content.ContentResolver.insert(ContentResolver.java:1206)
at com.example.tmichelc.sqlciphertestapplication.db.base.AbstractContentValues.insert(AbstractContentValues.java:28)
at com.example.tmichelc.sqlciphertestapplication.MainActivity.testWriteToDatabase(MainActivity.java:104)
at com.example.tmichelc.sqlciphertestapplication.MainActivity.onResume(MainActivity.java:75)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
at android.app.Activity.performResume(Activity.java:5354)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2785)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2824)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3755)
at android.app.ActivityThread.access$900(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
at android.os.Handler.dispatchMessage(Handler.java:102)