diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-11-19 18:26:06 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-11-19 18:26:06 +0100 |
commit | 562c0546c6e89f0720ab8ec88194be4357afb134 (patch) | |
tree | 440c550a670aca8a662e254cf845bdc4a21f66d9 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util | |
parent | 0eac49775484daf9319f5982e818f9223f0adf23 (diff) | |
download | open-keychain-562c0546c6e89f0720ab8ec88194be4357afb134.tar.gz open-keychain-562c0546c6e89f0720ab8ec88194be4357afb134.tar.bz2 open-keychain-562c0546c6e89f0720ab8ec88194be4357afb134.zip |
Handle denied storage permission, use ContentResolver.SCHEME_FILE constant
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java | 4 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java index bae119700..1c413034e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java @@ -161,7 +161,7 @@ public class FileHelper { } public static long getFileSize(Context context, Uri uri, long def) { - if ("file".equals(uri.getScheme())) { + if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { long size = new File(uri.getPath()).length(); if (size == 0) { size = def; @@ -293,7 +293,7 @@ public class FileHelper { } out.close(); - if ("file".equals(uri.getScheme())) { + if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { return new File(uri.getPath()).delete() ? 1 : 0; } else { return resolver.delete(uri, null, null); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java index f89d679bc..ab2841ed5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelperLollipop.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + package org.sufficientlysecure.keychain.util; |