Loading android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +25 −2 Original line number Original line Diff line number Diff line Loading @@ -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())) { Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +25 −2 Original line number Original line Diff line number Diff line Loading @@ -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())) { Loading