Fix IllegalStateException in TvProvider
SQLiteOpenHelper will re-use the same DB instance for us.
We shouldn't close the DB gotten from SQLiteOpenHelper, which
may cause hazards to thread-safty.
Test: gts-tradefed run gts -m GtsTvTestCases
Bug: 38341610
Change-Id: Ia07e8a2aa11b8d86ce9c5cfa708cd60607bf7b34
diff --git a/src/com/android/providers/tv/TvProvider.java b/src/com/android/providers/tv/TvProvider.java
index 0a4577f..6abff89 100644
--- a/src/com/android/providers/tv/TvProvider.java
+++ b/src/com/android/providers/tv/TvProvider.java
@@ -1588,7 +1588,7 @@
if (!sInitialized) {
// Database is not accessed before and the projection maps and the blocked package list
// are not updated yet. Gets database here to make it initialized.
- mOpenHelper.getReadableDatabase().close();
+ mOpenHelper.getReadableDatabase();
}
}