Updater: Fix exporting updates
* getExternalStorageDirectory was deprecated in API level 29 * Use the proposed Context#getExternalFilesDirs(String) instead The following message can be found in the logs, followed by a crash: MediaProvider: Creating a non-default top level directory or deleting an existing one is not allowed! Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/3358 Change-Id: I81412985abc0f64d0fccb0d3069ac57ef6b4ffef
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2020 The LineageOS Project
|
* Copyright (C) 2017-2021 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -66,7 +66,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static File getExportPath(Context context) {
|
public static File getExportPath(Context context) {
|
||||||
File dir = new File(Environment.getExternalStorageDirectory(),
|
File dir = new File(context.getExternalFilesDir(null),
|
||||||
context.getString(R.string.export_path));
|
context.getString(R.string.export_path));
|
||||||
if (!dir.isDirectory()) {
|
if (!dir.isDirectory()) {
|
||||||
if (dir.exists() || !dir.mkdirs()) {
|
if (dir.exists() || !dir.mkdirs()) {
|
||||||
|
Reference in New Issue
Block a user