Android - net.sqlcipher.database.SQLiteOpenHelper Could not open database

version : android-database-sqlcipher-3.5.9

SQLiteOpenHelper#getReadableDatabase(String password);
When this method is executed, it does not return. (Do not go to the next step)

This is only when you connect the display to HDMI with YOGA Book for Android (Android 7.1.1).
The probability of occurrence is about 90%.
It will not happen if the display is not connected to HDMI.

This problem does not occur on other models.
For example

YOGA Book for Android (Android 6.0.1)
Nexus 5X (Android 7.1.1)
Nexus 7 (Android 6.0.1)

Do you know why?

Here is the code snippet

public class MySQLiteOpenHelper extends SQLiteOpenHelper {

private static final String PASSWORD = "password";
private static final String DATABASE_FILE_NAME = "sample.db";
private static final int DATABASE_VERSION = 1;

public MySQLiteOpenHelper(Context context) {
    super(context, DATABASE_FILE_NAME, null, DATABASE_VERSION);
    SQLiteDatabase.loadLibs(context);
}

@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
    sqLiteDatabase.execSQL(
            "create table sample_table ("
                    + "_id  integer primary key autoincrement not null, "
                    + "text_column text not null, "
                    + "num_column integer not null)" );
}

public void read(){
    SQLiteDatabase db = getReadableDatabase(PASSWORD);	//<-- stop here
    db.close();
}

}

Thanks

Hi @tatsu

What are your results when you run the SQLCipher for Android test suite on the YOGA Book for Android?

Thanks for the response.

I ran the SQLCipher for Android test suite on the YOGA Book for Android, but I could not open the DB.
There is no response in executing SQLiteDatabase.openOrCreateDatabase().

When I ran the test suite on the Nexus7, it was all ok.

Hi @tatsu

Does the test suite application launch on the YOGA Book for Android? If so, when you run the application, does it crash? If there is a crash, would you please provide the complete stack trace? I’m trying to find out additional information regarding the instruction set architecture of the YOGA Book for Android. It appears it may be x86_64, but I am not certain. Can you confirm?

The test suite application launch.
It stops at the execution of SQLiteDatabase.openOrCreateDatabase() of the first test.
It freezes rather than crashing. As if deadlocked.

It seems to be a problem peculiar to YOGA Book for Android(Android 7.1.1).
I have two YOGA Book for Android(Android 7.1.1), but both are freezing the same way.

Hi @tatsu

What is the instruction set architecture of the YOGA Book for Android device? When you run the test suite it should write a message to logcat saying:

Running test suite on XYZ platform

Also, can you please provide a complete stack trace of the error when the test suite fails? We will need this to diagnose the issue any further.

Provide stack trace.
Do you know the cause by this?

05-15 15:15:13.597 5881-5881/? I/art: Late-enabling -Xcheck:jni
05-15 15:15:13.716 5881-5881/net.zetetic.sqlcipher.test I/TestSuiteActivity: onCreate
05-15 15:15:13.809 5881-5881/net.zetetic.sqlcipher.test I/ufoGralloc: Hello, this is UFO GRALLOC/Intel Corporation
05-15 15:15:13.809 5881-5881/net.zetetic.sqlcipher.test I/ufoGralloc: ro.camera.rec.pixel_format = 0x10f (271)
05-15 15:15:13.809 5881-5881/net.zetetic.sqlcipher.test I/ufoGralloc: ro.ycbcr.pixel_format = 0x10f (271)
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test I/OpenGLRenderer: Initialized EGL, version 1.4
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test D/OpenGLRenderer: Swap behavior 1
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test D/OpenGLRenderer: Swap behavior 0
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test D/ufoEGL: droid_create_context : config id = 11 conf->NativeVisualID=1
05-15 15:15:13.881 5881-5912/net.zetetic.sqlcipher.test I/ufoEGL: Requested context : GLES 2.0

                                                              [ 05-15 15:15:13.888  5881: 5912 I/         ]
                                                              GL_VERSION: OpenGL ES 3.1 - Build 4.70.10069-R
                                                              
                                                              [ 05-15 15:15:13.888  5881: 5912 I/         ]
                                                              GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 3.10 - Build 4.70.10069-R

05-15 15:15:13.888 5881-5912/net.zetetic.sqlcipher.test D/ufoEGL: Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
05-15 15:15:13.894 5881-5912/net.zetetic.sqlcipher.test D/ufo: Detected device 22B0:52 family 17:11
05-15 15:15:13.896 5881-5912/net.zetetic.sqlcipher.test D/ufoEGL: Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
05-15 15:15:16.498 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Running test suite on x86_64 platform
05-15 15:15:16.529 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Running test:Query Limit Test
05-15 15:15:16.529 5881-6015/net.zetetic.sqlcipher.test I/QueryLimitTest: Before prepareDatabaseEnvironment
05-15 15:15:16.529 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
05-15 15:15:16.529 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Before delete of database file
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/QueryLimitTest: Before getDatabasePath
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/QueryLimitTest: Before createDatabase
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/QueryLimitTest: Before ZeteticApplication.getInstance().createDatabase
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
05-15 15:15:16.530 5881-6015/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase

Hi @tatsu

Are you able to run the test suite successfully when the YOGA Book for Android is NOT connected to HDMI? What are your results then?