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

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

Merge "Use MediaStore.scanFile instead of manually inserting to...

Merge "Use MediaStore.scanFile instead of manually inserting to MediaProvider." into qt-dev am: 26bcc0e5
am: 92639232

Change-Id: I6328e8488052ab15ef67b3d4956d968fe72a638a
parents 1734500a 92639232
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);
        }
    }