Add shutdown() to providers.

They're needed for unit tests.
I was hoping this would solve some of the unit test issues, but it didn't look
like so.  But still they're nice to have.

Change-Id: Ibf6ae78055560d27aac5934d567a17084de99d84
This commit is contained in:
Makoto Onuki 2010-08-20 14:56:44 -07:00
parent a14a24a5bc
commit 6c36b4c613
2 changed files with 21 additions and 0 deletions

View File

@ -478,4 +478,12 @@ public class AttachmentProvider extends ContentProvider {
c.close();
}
}
/**
* Need this to suppress warning in unit tests.
*/
@Override
public void shutdown() {
// Don't call super.shutdown(), which emits a warning...
}
}

View File

@ -635,6 +635,19 @@ public class EmailProvider extends ContentProvider {
return helper.getReadableDatabase();
}
/** {@inheritDoc} */
@Override
public void shutdown() {
if (mDatabase != null) {
mDatabase.close();
mDatabase = null;
}
if (mBodyDatabase != null) {
mBodyDatabase.close();
mBodyDatabase = null;
}
}
/*package*/ static void deleteOrphans(SQLiteDatabase database, String tableName) {
if (database != null) {
// We'll look at all of the items in the table; there won't be many typically