Loading core/java/android/app/ContextImpl.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1925,13 +1925,14 @@ class ContextImpl extends Context { // enough permissions; ask vold to create on our behalf. // enough permissions; ask vold to create on our behalf. final IMountService mount = IMountService.Stub.asInterface( final IMountService mount = IMountService.Stub.asInterface( ServiceManager.getService("mount")); ServiceManager.getService("mount")); int res = -1; try { try { res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); final int res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); } catch (Exception ignored) { } if (res != 0) { if (res != 0) { Log.w(TAG, "Failed to ensure directory: " + dir); Log.w(TAG, "Failed to ensure " + dir + ": " + res); dir = null; } } catch (Exception e) { Log.w(TAG, "Failed to ensure " + dir + ": " + e); dir = null; dir = null; } } } } Loading core/java/android/os/storage/StorageManager.java +8 −6 Original line number Original line Diff line number Diff line Loading @@ -817,17 +817,19 @@ public class StorageManager { /** {@hide} */ /** {@hide} */ private static @Nullable StorageVolume getStorageVolume(StorageVolume[] volumes, File file) { private static @Nullable StorageVolume getStorageVolume(StorageVolume[] volumes, File file) { File canonicalFile = null; try { try { canonicalFile = file.getCanonicalFile(); file = file.getCanonicalFile(); } catch (IOException ignored) { } catch (IOException ignored) { canonicalFile = null; return null; } } for (StorageVolume volume : volumes) { for (StorageVolume volume : volumes) { if (volume.getPathFile().equals(file)) { File volumeFile = volume.getPathFile(); return volume; try { volumeFile = volumeFile.getCanonicalFile(); } catch (IOException ignored) { continue; } } if (FileUtils.contains(volume.getPathFile(), canonicalFile)) { if (FileUtils.contains(volumeFile, file)) { return volume; return volume; } } } } Loading Loading
core/java/android/app/ContextImpl.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -1925,13 +1925,14 @@ class ContextImpl extends Context { // enough permissions; ask vold to create on our behalf. // enough permissions; ask vold to create on our behalf. final IMountService mount = IMountService.Stub.asInterface( final IMountService mount = IMountService.Stub.asInterface( ServiceManager.getService("mount")); ServiceManager.getService("mount")); int res = -1; try { try { res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); final int res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); } catch (Exception ignored) { } if (res != 0) { if (res != 0) { Log.w(TAG, "Failed to ensure directory: " + dir); Log.w(TAG, "Failed to ensure " + dir + ": " + res); dir = null; } } catch (Exception e) { Log.w(TAG, "Failed to ensure " + dir + ": " + e); dir = null; dir = null; } } } } Loading
core/java/android/os/storage/StorageManager.java +8 −6 Original line number Original line Diff line number Diff line Loading @@ -817,17 +817,19 @@ public class StorageManager { /** {@hide} */ /** {@hide} */ private static @Nullable StorageVolume getStorageVolume(StorageVolume[] volumes, File file) { private static @Nullable StorageVolume getStorageVolume(StorageVolume[] volumes, File file) { File canonicalFile = null; try { try { canonicalFile = file.getCanonicalFile(); file = file.getCanonicalFile(); } catch (IOException ignored) { } catch (IOException ignored) { canonicalFile = null; return null; } } for (StorageVolume volume : volumes) { for (StorageVolume volume : volumes) { if (volume.getPathFile().equals(file)) { File volumeFile = volume.getPathFile(); return volume; try { volumeFile = volumeFile.getCanonicalFile(); } catch (IOException ignored) { continue; } } if (FileUtils.contains(volume.getPathFile(), canonicalFile)) { if (FileUtils.contains(volumeFile, file)) { return volume; return volume; } } } } Loading