Issue Migrating From android-database-sqlcipher:3.5.9 to sqlcipher-android:4.5.5

Hello
Now I am trying to update
implementation ‘net.zetetic:android-database-sqlcipher:3.5.9’ to implementation ‘net.zetetic:android-database-sqlcipher:4.5.4’

My implementation is mentioned below.
public DatabaseHelper open() throws SQLException {
SQLiteDatabase.loadLibs(this.context);
database = this.getWritableDatabase(Constants.api_secret);
return this;
}

public SQLiteDatabase getDatabase() {
    if (database == null) {
        SQLiteDatabase.loadLibs(this.context);
        database = getWritableDatabase(Constants.api_secret);
    }
    return database;
}

private DatabaseHelper(Context context) {
super(context, DBNAME, null, VERSION, new SQLiteDatabaseHook() {

        @Override
        public void preKey(SQLiteDatabase sqLiteDatabase) {

        }

        @Override
        public void postKey(SQLiteDatabase sqLiteDatabase) {
            try (Cursor cursor = sqLiteDatabase.rawQuery("PRAGMA cipher_migrate", null)) {
                // Check if migration was successful
                if (cursor != null && cursor.moveToFirst()) {
                    int result = cursor.getInt(0);
                    cursor.close();
                    if (result == 0) {
                        Log.d("DataBaseHelper", "migration is successful");
                    } else {
                        // Handle migration failure
                        throw new SQLiteException("Cipher migration failed");
                    }
                } else {
                    // Handle no result or cursor error
                    throw new SQLiteException("No result from PRAGMA cipher_migrate");
                }
            } catch (Exception e) {
                throw new SQLiteException("Error executing PRAGMA cipher_migrate", e);
            }
        }
    });
    this.context = context;
}

working fine but some times getting ANR.
Can you please let me know based on below link
postKey() implementation is correct or not( not sure why this change is causing ANR as log is printed - Migration is successful )?. Only for changing the version( 3.5.9 to 4.5.4) do I need to increase the db version?. Can you please help on this.