summaryrefslogtreecommitdiff
path: root/src/com/android/email/provider/ContentCache.java
Commit message (Collapse)AuthorAgeFilesLines
* Clean up a bunch of warningsScott Kennedy2013-06-251-30/+1
| | | | | Bug: 9565838 Change-Id: I5e95562bbf463f057cbcc4a9884427a774473b45
* Unify LogTagScott Kennedy2013-06-051-15/+15
| | | | | | | | | | | | | | | | | | | | There is now only one LogTag class. The static initializer of GmailApplication (existing) and EmailApplication (new) will now set the log tag to "Gmail" and "Email", respectively. Up until that code is run, it will be "UnifiedEmail". "setprop log.tag.Gmail VERBOSE" (or .Email) will trigger all logs to be printed as long as they go through LogUtils, regardless of what tag is used by that individual log. This lets us still turn on logging everywhere in one command, but also lets us use more descriptive tags (like the class name). And since we no longer have three com.android.mail.utils.LogTag classes, builds will be much easier. Also, we now use LogUtils everywhere. Change-Id: I55f1c7a66ce50ead54877a13e40256422a56dc39
* Cache column name/indexes so we can use getColumnIndex()Scott Kennedy2013-02-061-1/+2
| | | | | | | | MatrixCursor doesn't do this, so we need to add our own cache. Depends on Ia5ffd31f54a2a335f495df5e0d1a0886ee08c14b Change-Id: Ica78e3cec747bf86fcef16508156e359216c64fe
* DO NOT MERGE: Move emailcommon2 sources to emailcommonMarc Blank2012-06-281-12/+12
| | | | Change-Id: I06df7e467cd2e0117df8b8db3ddc6ff9da13f1c7
* Revert to old Email appMarc Blank2012-04-251-1/+1
| | | | | | * These are the last sources in the ICS-MR1 tree Change-Id: Ida4651bddd92a06a518d00f3e1f275ab3a80c8ae
* Use Map.Entry, not HashMap.EntryAndy McFadden2012-01-201-1/+1
| | | | | | | Map.Entry is the defined return value from entrySet(). HashMap.Entry shouldn't be used directly. Change-Id: I855f7a4e855776deb83754ca89c2a4128e9e04a2
* onMove in CachedCursor shouldn't call the underlying cursor's methodMarc Blank2011-10-191-1/+1
| | | | | Bug: 5472277 Change-Id: Ida5a840d2d27941bb8b548a4d2d985b1082e93b6
* Fix cursor-related errors:Marc Blank2011-06-221-1/+18
| | | | | | | | | 1) Have CachedCursor implement CrossProcessCursor; still need to figure out how this ever worked 2) Close cursor used internally in findMailboxOfType Bug: 4869024 Change-Id: Id20d37b7b83e133aa4d5fe9293a42ae217024f01
* Improve EmailContent caching...Marc Blank2011-06-211-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Guarantee that up to 16 Account (with HostAuths), and Policy rows are always cached. Also, 6 commonly used Mailboxes per Account (Inbox, Outbox, Drafts, Sent, Trash, and Search) * Precache these rows when EmailProvider starts up * Ensure that newly added, precachable rows are cached when created * Clean up some inefficient/wrong caching code * Fix a commonly called method in NotificationManager in which we load a single Mailbox row using selection vs withAppendedId * Confirm that we don't read from the database in typical use and heavy message loading * Add a special URI for finding mailbox by type (using the cache) * Add special-case code for EmailContent.count(Account.CONTENT_URI) which is used in a number of places (including on the UI thread) and whose value is easily determined * Add a special URI to get the default account id * Confirm that all unit tests work The goal here is to be able to load all Account, HostAuth, Policy, and Mailbox objects (by id) without worrying about disk access. There will still be a single disk read for uncommon Mailbox reads, but this should be considered acceptable. Change-Id: Ibc9aa7acc73185e360b0b6f3053b90a985e97210 TODO: Unit tests
* Lock cache puts while running testsTodd Kennedy2011-06-081-2/+12
| | | | Change-Id: I04c88ee70f9d72252fd1c5114d560a28fcee1b56
* React to LruCache.entryEvicted renamed to LruCache.entryRemovedJesse Wilson2011-02-251-3/+4
| | | | | Change-Id: Iab20ce0386ee4dabc8490dbde5cd2208626c293c http://b/3461302
* Adopt LruCache in Email's ContentCache.Jesse Wilson2011-02-111-36/+22
| | | | | | | | | LruCache simply wraps LinkedHashMap for a better API. Performance/hit rate should not be impacted. Tracking bug: http://b/3184897 Change-Id: Icbac38d3cea5f8c522df7a883d8e74a8f3786b92
* Use a field rather than a superclass for ContentCache's cache.Jesse Wilson2011-02-021-34/+36
| | | | | | | | This makes it easier for cache experiments to swap out the LinkedHashMap for another cache. http://b/3184897 Change-Id: Iacdb266e41f5a98efd9bb30bc09ff8fff5a0a5a9
* Fix ConcurrentAccessException in unit testsTodd Kennedy2011-01-311-2/+1
| | | | | | | | The ContentCache is now an LRU cache. This means we must NOT access the cache while using any iterator over the cache. In this case, we were calling get() using an iterator of cache keys. Change-Id: I2d1feabff7474b6f2a230b98f97df067ab7ccd9c
* am 9a09129d: am 1122e0f6: Merge "Remove cache statistics logging" into honeycombMarc Blank2011-01-281-1/+2
|\ | | | | | | | | * commit '9a09129d0928712ad84a11027812ff0a63afed4a': Remove cache statistics logging
| * Remove cache statistics loggingMarc Blank2011-01-281-1/+2
| | | | | | | | | | | | | | | | * Use static final flag to control this * Set flag to false for all commits Bug: 3403725 Change-Id: I70c89aaf2f0b226206e505a14e9a8f1ed2ebb51a
* | Make ContentCache LRU, rather than LRIMarc Blank2011-01-281-1/+2
|/ | | | | Bug: 3403111 Change-Id: I12993a8185db1bebe760f8bd1a8d22683bcdddc3
* Fix synchronization issue w/ closing CachedCursorMarc Blank2010-12-261-4/+3
| | | | | | Bug: 3306031 Change-Id: I3000cf92c27e93b2df94799492fb9960a3d795dc
* Properly return zero-count cursor from getMatrixCursorMarc Blank2010-12-201-0/+3
| | | | Change-Id: I574528bf56b5a82ecbaab3d3501b26e7afb974ec
* Synchronize properly with ContentCache; document synchronizationMarc Blank2010-12-161-4/+11
| | | | | Bug: 3291682 Change-Id: I69c4a3b2ee62a41e6488b63deeb975e510a3f554
* Enable cache logging for debugging (w/ STOPSHIP)Marc Blank2010-12-151-11/+12
| | | | Change-Id: I97493430f2aedcb070bc6d1789e47b562394eeb3
* Never close underlying cursor if there are active usersMarc Blank2010-12-031-6/+11
| | | | | | Bug: 3249537 Bug: 3238216 Change-Id: I281f0b0d6319adaffd78fe8e4c3da6f126eb71da
* Don't throw exception on moveToPosition in CachedCursorMarc Blank2010-11-301-11/+6
| | | | | | | * Just return false Bug: 3240290 Change-Id: I808ca88c7897c573d19c2c2c92b179b4106a6dd3
* Fix deadlock in ContentCacheMarc Blank2010-11-231-4/+9
| | | | | | | | | | * The situation is that putCursor() is called from a reading thread while invalidate() is called from a writing thread * putCursor() must not hold the monitor lock on ContentCache while moving the underlying cursor to position 0 Bug: 3224203 Change-Id: I35b798dccf245c761dc79c39ced4fc8c0cfb9d78
* Allow ProviderTests to work with ContentCacheMarc Blank2010-11-171-10/+14
| | | | | Bug: 3204331 Change-Id: I5399345c2b759fb34d3dc7c694eb0eef8d7de493
* Minor cleanups for ContentCacheAndy Stadler2010-11-161-35/+46
| | | | | | | | | * Change CounterMap to not extend HashMap * Renamed remove() to subtract() * Comment out a failing test * Add a flag that prevents any objects from being cached Change-Id: I74754133b505178e8b0166390f69509f006a3da2
* EmailProvider content cachingMarc Blank2010-11-161-0/+799
* In this CL, we cache individual rows, based on the CONTENT_PROJECTION defined for the most common queries (Account, HostAuth, Mailbox, and Message) * Queries on individual rows (most often Class.restoreClassById()) will look to the cache first, rather than querying the database * Queries on smaller projections will build MatrixCursor's from cached data * Write-through caching updates the cache with changed columns * Experiments with live data indicate that > 95% of queries that are cacheable (single row, no selection) can be retrieved from the cache, thereby saving a great deal of disk access. * Timing experiments show that cache hits are > 40x faster than cache misses * Unit tests for the various classes exist, with more coming TODO ---- * More unit tests Change-Id: I386a948a2f4cc02b6548d07d9b2fefd1e018a262