diff options
author | 2025-03-10 08:22:08 -0700 | |
---|---|---|
committer | 2025-03-10 08:22:08 -0700 | |
commit | b1f4da5f6917437e2ead2c87baf87468c447ba1d (patch) | |
tree | a2a3604ee7c21d96366a858bbfb47d3d20a59b6d /src | |
parent | 27a0cf037a0d11975b75bb2af1960bbe046ac843 (diff) | |
parent | 118ae6a7599855537a8497a124a799e3550defa3 (diff) |
Merge "Don't call notifyChange on main thread" into main
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/media/MediaProvider.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index c931ff243..51efa9210 100644 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -11889,14 +11889,15 @@ public class MediaProvider extends ContentProvider { final ContentResolver resolver = getContext().getContentResolver(); final Uri uri = getBaseContentUri(volumeName); // TODO(b/182396009) we probably also want to notify clone profile (and vice versa) - resolver.notifyChange(getBaseContentUri(volumeName), null); + ForegroundThread.getExecutor().execute(() -> { + resolver.notifyChange(getBaseContentUri(volumeName), null); + }); if (LOGV) Log.v(TAG, "Attached volume: " + volume); if (!MediaStore.VOLUME_INTERNAL.equals(volumeName)) { - // Also notify on synthetic view of all devices - resolver.notifyChange(getBaseContentUri(MediaStore.VOLUME_EXTERNAL), null); - ForegroundThread.getExecutor().execute(() -> { + // Also notify on synthetic view of all devices + resolver.notifyChange(getBaseContentUri(MediaStore.VOLUME_EXTERNAL), null); mExternalDatabase.runWithTransaction((db) -> { ensureNecessaryFolders(volume, db); return null; @@ -11957,11 +11958,15 @@ public class MediaProvider extends ContentProvider { } final ContentResolver resolver = getContext().getContentResolver(); - resolver.notifyChange(getBaseContentUri(volumeName), null); + ForegroundThread.getExecutor().execute(() -> { + resolver.notifyChange(getBaseContentUri(volumeName), null); + }); if (!MediaStore.VOLUME_INTERNAL.equals(volumeName)) { - // Also notify on synthetic view of all devices - resolver.notifyChange(getBaseContentUri(MediaStore.VOLUME_EXTERNAL), null); + ForegroundThread.getExecutor().execute(() -> { + // Also notify on synthetic view of all devices + resolver.notifyChange(getBaseContentUri(MediaStore.VOLUME_EXTERNAL), null); + }); } if (LOGV) Log.v(TAG, "Detached volume: " + volumeName); |