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

Commit e6029385 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Removed hidden API call to getCanonicalUri"

parents 042ae601 c584b19a
Loading
Loading
Loading
Loading
+25 −2
Original line number Original line Diff line number Diff line
@@ -444,9 +444,32 @@ public class BluetoothOppUtility {
            Log.e(TAG, "Not a file URI: " + uri);
            Log.e(TAG, "Not a file URI: " + uri);
            return false;
            return false;
        }
        }
        final File file = new File(uri.getCanonicalUri().getPath());

        if ("file".equals(uri.getScheme())) {
            String canonicalPath;
            try {
                canonicalPath = new File(uri.getPath()).getCanonicalPath();
            } catch (IOException e) {
                canonicalPath = uri.getPath();
            }
            File file = new File(canonicalPath);
            //if emulated
            if (Environment.isExternalStorageEmulated()) {
                //Gets legacy external storage path
                final String legacyPath = new File(
                        System.getenv("EXTERNAL_STORAGE")).toString();
                // Splice in user-specific path when legacy path is found
                if (canonicalPath.startsWith(legacyPath)) {
                    file = new File(
                            Environment.getExternalStorageDirectory().toString(),
                            canonicalPath.substring(legacyPath.length() + 1));
                }
            }
            return isSameOrSubDirectory(Environment.getExternalStorageDirectory(), file);
            return isSameOrSubDirectory(Environment.getExternalStorageDirectory(), file);
        }
        }
        return isSameOrSubDirectory(Environment.getExternalStorageDirectory(),
                new File(uri.getPath()));
    }


    static boolean isForbiddenContent(Uri uri) {
    static boolean isForbiddenContent(Uri uri) {
        if ("com.android.bluetooth.map.MmsFileProvider".equals(uri.getHost())) {
        if ("com.android.bluetooth.map.MmsFileProvider".equals(uri.getHost())) {