Merge "Implement rxjava2 LimitOffsetRxPagingSource" into androidx-main
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
index 1fff94c..6b428fe 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
@@ -52,7 +52,9 @@
     @TaskAction
     fun checkPlaygroundGradleConfiguration() {
         compareProperties()
-        compareGradleWrapperVersion()
+        // TODO: re-enable when https://github.com/gradle/gradle/issues/20778
+        //  is fixed.
+        // compareGradleWrapperVersion()
         // put the success into an output so that task can be up to date.
         outputFile.get().asFile.writeText("valid", Charsets.UTF_8)
     }
diff --git a/playground-common/gradle/wrapper/gradle-wrapper.properties b/playground-common/gradle/wrapper/gradle-wrapper.properties
index fcfb29d..5942dbf 100644
--- a/playground-common/gradle/wrapper/gradle-wrapper.properties
+++ b/playground-common/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220427150934+0000-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/room/room-paging-rxjava3/src/androidTest/kotlin/androidx/room/paging/rxjava3/LimitOffsetRxPagingSourceTest.kt b/room/room-paging-rxjava3/src/androidTest/kotlin/androidx/room/paging/rxjava3/LimitOffsetRxPagingSourceTest.kt
index 405e1ac..931185e 100644
--- a/room/room-paging-rxjava3/src/androidTest/kotlin/androidx/room/paging/rxjava3/LimitOffsetRxPagingSourceTest.kt
+++ b/room/room-paging-rxjava3/src/androidTest/kotlin/androidx/room/paging/rxjava3/LimitOffsetRxPagingSourceTest.kt
@@ -55,6 +55,7 @@
 import kotlinx.coroutines.rx3.await
 import kotlinx.coroutines.test.advanceUntilIdle
 import kotlinx.coroutines.test.runTest
+import org.junit.After
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -70,6 +71,12 @@
     @Rule
     val countingTaskExecutorRule = CountingTaskExecutorRule()
 
+    @After
+    fun tearDown() {
+        countingTaskExecutorRule.drainTasks(500, TimeUnit.MILLISECONDS)
+        assertTrue(countingTaskExecutorRule.isIdle)
+    }
+
     @Test
     fun initialLoad_empty() = setupAndRun { db ->
         val pagingSource = LimitOffsetRxPagingSourceImpl(db)
@@ -466,6 +473,8 @@
             assertTrue(job.isCancelled)
             assertTrue(isDisposed)
         }
+        // need to drain before closing testDb or else will throw SQLiteConnectionPool exception
+        countingTaskExecutorRule.drainTasks(500, TimeUnit.MILLISECONDS)
         testDb.close()
     }
 
@@ -543,13 +552,7 @@
         runTest {
             test(db)
         }
-        tearDown(db)
-    }
-
-    private fun tearDown(db: LimitOffsetTestDb) {
-        if (db.isOpen) db.close()
-        countingTaskExecutorRule.drainTasks(500, TimeUnit.MILLISECONDS)
-        assertTrue(countingTaskExecutorRule.isIdle)
+        db.close()
     }
 }