Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92639232 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by android-build-merger
Browse files

Merge "Use MediaStore.scanFile instead of manually inserting to MediaProvider." into qt-dev

am: 26bcc0e5

Change-Id: I43cf2e10642bf655cd00805b3c5dea54d4066fe9
parents b4b2e1d7 26bcc0e5
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.internal.content;
import android.annotation.CallSuper;
import android.annotation.Nullable;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
@@ -266,17 +265,7 @@ public abstract class FileSystemProvider extends DocumentsProvider {
        if (visibleFolder != null) {
            assert (visibleFolder.isDirectory());

            final long token = Binder.clearCallingIdentity();

            try {
                final ContentResolver resolver = getContext().getContentResolver();
                final Uri uri = MediaStore.Files.getDirectoryUri("external");
                ContentValues values = new ContentValues();
                values.put(MediaStore.Files.FileColumns.DATA, visibleFolder.getAbsolutePath());
                resolver.insert(uri, values);
            } finally {
                Binder.restoreCallingIdentity(token);
            }
            MediaStore.scanFile(getContext(), visibleFolder);
        }
    }