mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 23:43:34 +01:00
Use user-friendly display path for local backup folder.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
f439e1f8e3
commit
db4c11cd53
@@ -11,7 +11,6 @@ import android.provider.MediaStore;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.signal.core.ui.CoreUiDependencies;
|
||||
@@ -91,12 +90,15 @@ public class StorageUtil {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@RequiresApi(24)
|
||||
public static @NonNull String getDisplayPath(@NonNull Context context, @NonNull Uri uri) {
|
||||
String lastPathSegment = Objects.requireNonNull(uri.getLastPathSegment());
|
||||
String backupVolume = lastPathSegment.replaceFirst(":.*", "");
|
||||
String backupName = lastPathSegment.replaceFirst(".*:", "");
|
||||
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
return backupName;
|
||||
}
|
||||
|
||||
StorageManager storageManager = ContextCompat.getSystemService(context, StorageManager.class);
|
||||
List<StorageVolume> storageVolumes = storageManager.getStorageVolumes();
|
||||
StorageVolume storageVolume = null;
|
||||
|
||||
Reference in New Issue
Block a user