public void runCleanupOperation ( ) { final SQLiteDatabase db = getDb ( ) ; if ( db == null || ! db . isOpen ( ) ) { if ( Configuration . getInstance ( ) . isDebugMode ( ) ) { Log . d ( IMapView . LOGTAG , "Finished init thread, aborted due to null database reference" ) ; } return ; } // index creation is run now (regardless of the table size) // therefore potentially on a small table, for better index creation performances createIndex ( db ) ; final long dbLength = db_file . length ( ) ; if ( dbLength <= Configuration . getInstance ( ) . getTileFileSystemCacheMaxBytes ( ) ) { return ; } runCleanupOperation ( dbLength - Configuration . getInstance ( ) . getTileFileSystemCacheTrimBytes ( ) , Configuration . getInstance ( ) . getTileGCBulkSize ( ) , Configuration . getInstance ( ) . getTileGCBulkPauseInMillis ( ) , true ) ; }
this could be a long running operation don t run on the UI thread unless necessary . This function prunes the database for old or expired tiles .