Assigned
Status Update
Comments
lu...@google.com <lu...@google.com>
an...@google.com <an...@google.com> #2
We don't support cross-process invalidations yet.
cr...@gmail.com <cr...@gmail.com> #3
At least , add a "refresh all observables" function to alpha4 ? i am trying to implement it by myself with your InvalidationTracker class
cm...@google.com <cm...@google.com>
lu...@google.com <lu...@google.com> #4
Okey, I made it and created a method to invalidate all observables below;
private void refreshAllLiveData() {
AppDataBase YOUR_DATABASE_WHICH_YOU_BUILD = .....
SupportSQLiteDatabase writableDatabase = YOUR_DATABASE_WHICH_YOU_BUILD.getOpenHelper().getWritableDatabase();
//get the database count;
Cursor cursor = writableDatabase.query("SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name != 'android_metadata' AND name != 'room_master_table';");
int tableCount = 0;
while(cursor.moveToNext()) {
tableCount = cursor.getInt(0);
}
for (int i = 0; i < tableCount; i++) {
//update version table with the incremented count because room modification log stores tables with ids instead of names
writableDatabase.execSQL("INSERT OR REPLACE INTO room_table_modification_log VALUES(null, "+(i)+")");
}
YOUR_DATABASE_WHICH_YOU_BUILD.getInvalidationTracker().refreshVersionsAsync();
}
-----
This is a workaroud for refreshing all live datas, I still prefer to use a proper API you implemented.
Thanx
private void refreshAllLiveData() {
AppDataBase YOUR_DATABASE_WHICH_YOU_BUILD = .....
SupportSQLiteDatabase writableDatabase = YOUR_DATABASE_WHICH_YOU_BUILD.getOpenHelper().getWritableDatabase();
//get the database count;
Cursor cursor = writableDatabase.query("SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name != 'android_metadata' AND name != 'room_master_table';");
int tableCount = 0;
while(cursor.moveToNext()) {
tableCount = cursor.getInt(0);
}
for (int i = 0; i < tableCount; i++) {
//update version table with the incremented count because room modification log stores tables with ids instead of names
writableDatabase.execSQL("INSERT OR REPLACE INTO room_table_modification_log VALUES(null, "+(i)+")");
}
YOUR_DATABASE_WHICH_YOU_BUILD.getInvalidationTracker().refreshVersionsAsync();
}
-----
This is a workaroud for refreshing all live datas, I still prefer to use a proper API you implemented.
Thanx
hu...@google.com <hu...@google.com> #5
Cross process invalidation is now support in Room 2.1.0 with the enableMultiInstanceInvalidation() API.
hu...@google.com <hu...@google.com> #6
Also, to work around the above Gradle bug (Unchanged files in classpath entry are reported as both ADDED and REMOVED when @Classpath is used
), we can:
- Process
REMOVED
files first, then processADDED
files. - Or detect when Gradle reports both
REMOVED
andADDED
for the same file, and consider it asMODIFIED
.
This is true for other transforms and tasks that use @Classpath
inputs, not just JacocoTransform
.
hu...@google.com <hu...@google.com> #7
To help reproduce this issue, I'm attaching a sample project created by the steps in
Description
Also need to add test to make sure it works with caching