Source:
<code>public boolean open(String path, SymmetricKey encryptionKey) throws SQLException { if (database != null && database.isOpen()) return true; boolean hasError = false; try { if (encryptionKey != null && !supportEncryption()) { Log.w(TAG, "Encryption not available (app not built with SQLCipher)"); throw new SQLException(SQLException.SQLITE_ENCRYPTION_NOTAVAILABLE, "Encryption not available"); } this.encryptionKey = encryptionKey; SQLiteDatabase.setDatabasePlatformSupport(getDatabasePlatformSupport()); database = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING, getWALConnectionPoolSize(), null, new ConnectionListener()); Log.v(Log.TAG_DATABASE, "%s: Opened Android sqlite db", this); } catch (SQLiteDatabaseCorruptException e) { hasError = true; <START> if (encryptionKey != null && supportEncryption()) { <END> Log.e(Log.TAG_DATABASE, "Unauthorized to open the SQLite database", e); throw new SQLException(SQLException.SQLITE_ENCRYPTION_UNAUTHORIZED, "Cannot decrypt or access the database"); } else { Log.e(Log.TAG_DATABASE, "The SQLite database file has been corrupted", e); throw new SQLException(SQLException.SQLITE_CORRUPT, e); } } catch (com.couchbase.lite.internal.database.SQLException e) { hasError = true; Log.e(Log.TAG_DATABASE, "Unable to open the SQLite database", e); throw new SQLException(e); } finally { if (hasError && database != null) database.close(); } return database.isOpen(); }</code><technical_language>This check cover 2 things: 1. If database is encrypted library is sqlite instead of sqlcipher. 2. If database is encrypted encryption key given</technical_language>

Target:
public boolean open(String path, SymmetricKey encryptionKey) throws SQLException { if (database != null && database.isOpen()) return true; boolean hasError = false; try { if (encryptionKey != null && !supportEncryption()) { Log.w(TAG, "Encryption not available (app not built with SQLCipher)"); throw new SQLException(SQLException.SQLITE_ENCRYPTION_NOTAVAILABLE, "Encryption not available"); } this.encryptionKey = encryptionKey; SQLiteDatabase.setDatabasePlatformSupport(getDatabasePlatformSupport()); database = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING, getWALConnectionPoolSize(), null, new ConnectionListener()); Log.v(Log.TAG_DATABASE, "%s: Opened Android sqlite db", this); } catch (SQLiteDatabaseCorruptException e) { hasError = true; if (encryptionKey != null && supportEncryption()) { Log.e(Log.TAG_DATABASE, "Unauthorized to open the SQLite database", e); throw new SQLException(SQLException.SQLITE_ENCRYPTION_UNAUTHORIZED, "Cannot decrypt or access the database"); } else { Log.e(Log.TAG_DATABASE, "Application might try to open the encrypted database " + "with the standard SQLite library or no password provided. " + "Otherwise, the SQLite database file has been corrupted. ", e); throw new SQLException(SQLException.SQLITE_CORRUPT, e); } } catch (com.couchbase.lite.internal.database.SQLException e) { hasError = true; Log.e(Log.TAG_DATABASE, "Unable to open the SQLite database", e); throw new SQLException(e); } finally { if (hasError && database != null) database.close(); } return database.isOpen(); }