diff options
author | 2020-01-17 19:00:50 -0700 | |
---|---|---|
committer | 2020-01-20 13:11:17 -0700 | |
commit | 5cff16b9001f2bc0a3949067bcf699b843def82e (patch) | |
tree | 749e7885f68002e75f0d9fc90777a5317710b4be /legacy | |
parent | 6b3ff6630d24df5c8e9a138069523319aa2c9fcd (diff) |
Consistent content change notifications.
In upcoming changes we're preparing to start sending change
notifications that include the actual operation type, such as insert,
update, or delete. We could try gathering this up in MediaProvider,
but that's already proven tedious and hard to ensure that we always
gather the correct set of IDs that have changed. That would be even
more difficult since update() or delete() calls don't always have
easy access to the MEDIA_TYPE of the items being changed.
The most robust solution would be to always get direct notifications
from SQLite as media items are changed. Thankfully we can use the
recently added SQLiteDatabase.setCustomScalarFunction() along with
triggers to get precise information on exactly when and how items
change in the database.
This new approach fixes several subtle and long-standing bugs where
update() and delete() thumbnail invalidation and change notifications
may have been incorrect when called without a transaction held, or
not updating MediaDocumentsProvider state. It also lets us bypass
postProcessMetadataForFuseRename() entirely, since any database
changes performed from FUSE will now automatically result in the
right side-effects.
Bug: 144464323, 147778086
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I261f410b47e08e407bc584581df1ed073566b1f8
Diffstat (limited to 'legacy')
-rw-r--r-- | legacy/src/com/android/providers/media/LegacyMediaProvider.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/legacy/src/com/android/providers/media/LegacyMediaProvider.java b/legacy/src/com/android/providers/media/LegacyMediaProvider.java index 4085a3aca..93d1b8ead 100644 --- a/legacy/src/com/android/providers/media/LegacyMediaProvider.java +++ b/legacy/src/com/android/providers/media/LegacyMediaProvider.java @@ -68,9 +68,9 @@ public class LegacyMediaProvider extends ContentProvider { Logging.initPersistent(persistentDir); mInternalDatabase = new DatabaseHelper(context, INTERNAL_DATABASE_NAME, - true, false, true, null, null); + true, false, true, null, null, null); mExternalDatabase = new DatabaseHelper(context, EXTERNAL_DATABASE_NAME, - false, false, true, null, null); + false, false, true, null, null, null); return true; } |