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

Commit ce4d67b6 authored by Daisuke Teranishi's avatar Daisuke Teranishi Committed by Tomoharu Kasahara
Browse files

Use correct filename when adding to ringtone

If the title of the music file includes "/", it's recognized
as a directory separator.
Use correct filename to select the file properly.

Bug: 80202253
Test: Add mp3 which title includes "/" to ringtone

Change-Id: I9bb05f6fe2d7d4dbbdf4f67db7ac6fde04707979
parent ddceca85
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.database.Cursor;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.net.Uri;
import android.os.Environment;
import android.os.FileUtils;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.Process;
@@ -955,7 +956,8 @@ public class RingtoneManager {

        // Find a filename. Throws FileNotFoundException if none can be found.
        final File outFile = Utils.getUniqueExternalFile(mContext, subdirectory,
                Utils.getFileDisplayNameFromUri(mContext, fileUri), mimeType);
                FileUtils.buildValidFatFilename(Utils.getFileDisplayNameFromUri(mContext, fileUri)),
                        mimeType);

        // Copy contents to external ringtone storage. Throws IOException if the copy fails.
        try (final InputStream input = mContext.getContentResolver().openInputStream(fileUri);