Skip to content

Commit 9d48b4f

Browse files
authored
Merge pull request #1793 from owncloud/release_2.1.1
Release 2.1.1
2 parents 0c31e3c + 7223270 commit 9d48b4f

23 files changed

+182
-97
lines changed

AndroidManifest.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2121
xmlns:tools="http://schemas.android.com/tools"
2222
package="com.owncloud.android"
23-
android:versionCode="20100000"
24-
android:versionName="2.1.0" >
23+
android:versionCode="20100100"
24+
android:versionName="2.1.1" >
2525

2626
<uses-sdk
2727
android:minSdkVersion="14"
@@ -151,6 +151,17 @@
151151
</intent-filter>
152152
</provider>
153153

154+
<!-- new provider used to generate URIs without file:// scheme (forbidden from Android 7) -->
155+
<provider
156+
android:name="android.support.v4.content.FileProvider"
157+
android:authorities="@string/file_provider_authority"
158+
android:grantUriPermissions="true"
159+
android:exported="false">
160+
<meta-data
161+
android:name="android.support.FILE_PROVIDER_PATHS"
162+
android:resource="@xml/exposed_filepaths" />
163+
</provider>
164+
154165
<activity
155166
android:name=".authentication.AuthenticatorActivity"
156167
android:exported="true"

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.1.1 (September 2016)
2+
- Instant uploads work in Android 7.
3+
- Select your camera folder to upload pictures or videos from any
4+
camera app.
5+
- Multi-Window support for Android 7.
6+
- Size of folders shown in list of files.
7+
- Sort by size your list of files.
8+
19
## 2.1.0 (August 2016)
210
- Select and handle multiple files
311
- Sync files on tap

oc_jb_workaround/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.owncloud.android.workaround.accounts"
4-
android:versionCode="0100030"
5-
android:versionName="1.0.30" >
4+
android:versionCode="0100031"
5+
android:versionName="1.0.31" >
66

77
<uses-sdk
88
android:minSdkVersion="16"
9-
android:targetSdkVersion="23" />
9+
android:targetSdkVersion="24" />
1010

1111
<application
1212
android:allowBackup="false"

owncloud-android-library

Submodule owncloud-android-library updated from 855a060 to 1bbc67b

res/values/setup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<string name="account_type">owncloud</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
66
<string name="authority">org.owncloud</string>
77
<string name="document_provider_authority">org.owncloud.documents</string>
8+
<string name="file_provider_authority">org.owncloud.files</string>
89
<string name="search_suggest_authority">org.owncloud.search.users_and_groups</string>
910
<string name="search_suggest_intent_action">org.owncloud.search.users_and_groups.action.SHARE_WITH</string>
1011
<string name ="db_file">owncloud.db</string>

res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
<string name="common_loading">Loading &#8230;</string>
105105
<string name="common_unknown">unknown</string>
106106
<string name="common_error_unknown">Unknown error</string>
107+
<string name="common_pending">Pending</string>
107108
<string name="about_title">About</string>
108109
<string name="change_password">Change password</string>
109110
<string name="delete_account">Remove account</string>

res/xml/exposed_filepaths.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<paths xmlns:android="http://schemas.android.com/apk/res/android">
3+
<external-path name="file" path="/" />
4+
<!-- yes, valid for ALL external storage and not only our app folder, since we can't use @string/data_folder
5+
as a value for 'path' attribute; in practice, we will only generate URIs in our folders, of course -->
6+
</paths>

src/com/owncloud/android/datamodel/OCFile.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@
2626
import java.io.File;
2727

2828
import android.content.ContentResolver;
29+
import android.content.Context;
2930
import android.net.Uri;
31+
import android.os.Build;
3032
import android.os.Parcel;
3133
import android.os.Parcelable;
34+
import android.support.v4.content.FileProvider;
3235
import android.webkit.MimeTypeMap;
3336

37+
import com.owncloud.android.R;
38+
import com.owncloud.android.lib.common.network.WebdavUtils;
3439
import com.owncloud.android.lib.common.utils.Log_OC;
3540

3641
import third_parties.daveKoeller.AlphanumComparator;
@@ -94,6 +99,14 @@ public OCFile[] newArray(int size) {
9499
private Uri mLocalUri;
95100

96101

102+
/**
103+
* Exportable URI to the local path of the file contents, if stored in the device.
104+
*
105+
* Cached after first call, until changed.
106+
*/
107+
private Uri mExposedFileUri;
108+
109+
97110
/**
98111
* Create new {@link OCFile} with given path.
99112
* <p/>
@@ -244,6 +257,32 @@ public Uri getStorageUri() {
244257
return mLocalUri;
245258
}
246259

260+
public Uri getExposedFileUri(Context context) {
261+
if (mLocalPath == null || mLocalPath.length() == 0) {
262+
return null;
263+
}
264+
if (mExposedFileUri == null) {
265+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
266+
// TODO - use FileProvider with any Android version, with deeper testing -> 2.2.0
267+
mExposedFileUri = Uri.parse(
268+
ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(mLocalPath)
269+
);
270+
} else {
271+
// Use the FileProvider to get a content URI
272+
try {
273+
mExposedFileUri = FileProvider.getUriForFile(
274+
context,
275+
context.getString(R.string.file_provider_authority),
276+
new File(mLocalPath)
277+
);
278+
} catch (IllegalArgumentException e) {
279+
Log_OC.e(TAG, "File can't be exported");
280+
}
281+
}
282+
}
283+
return mExposedFileUri;
284+
}
285+
247286
/**
248287
* Can be used to set the path where the file is stored
249288
*
@@ -252,6 +291,7 @@ public Uri getStorageUri() {
252291
public void setStoragePath(String storage_path) {
253292
mLocalPath = storage_path;
254293
mLocalUri = null;
294+
mExposedFileUri = null;
255295
}
256296

257297
/**

src/com/owncloud/android/db/PreferenceManager.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import com.owncloud.android.files.services.FileUploader;
3131
import com.owncloud.android.utils.FileStorageUtils;
3232

33+
import java.io.File;
34+
3335
/**
3436
* Helper to simplify reading of Preferences all around the app
3537
*/
@@ -90,17 +92,19 @@ public static InstantUploadsConfiguration getInstantUploadsConfiguration(Context
9092
(currentAccount == null) ? "" : currentAccount.name
9193
)
9294
);
95+
String uploadPath = prefs.getString(
96+
PREF__INSTANT_PICTURE_UPLOAD_PATH,
97+
context.getString(R.string.instant_upload_path) + OCFile.PATH_SEPARATOR
98+
);
9399
result.setUploadPathForPictures(
94-
prefs.getString(
95-
PREF__INSTANT_PICTURE_UPLOAD_PATH,
96-
context.getString(R.string.instant_upload_path) + OCFile.PATH_SEPARATOR
97-
)
100+
uploadPath.endsWith(File.separator) ? uploadPath : uploadPath + File.separator
101+
);
102+
uploadPath = prefs.getString(
103+
PREF__INSTANT_VIDEO_UPLOAD_PATH,
104+
context.getString(R.string.instant_upload_path) + OCFile.PATH_SEPARATOR
98105
);
99106
result.setUploadPathForVideos(
100-
prefs.getString(
101-
PREF__INSTANT_VIDEO_UPLOAD_PATH,
102-
context.getString(R.string.instant_upload_path) + OCFile.PATH_SEPARATOR
103-
)
107+
uploadPath.endsWith(File.separator) ? uploadPath : uploadPath + File.separator
104108
);
105109
result.setBehaviourAfterUpload(
106110
prefs.getString(

src/com/owncloud/android/operations/DownloadFileOperation.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,24 @@ protected RemoteOperationResult run(OwnCloudClient client) {
159159
if (result.isSuccess()) {
160160
mModificationTimestamp = mDownloadOperation.getModificationTimestamp();
161161
mEtag = mDownloadOperation.getEtag();
162+
if (FileStorageUtils.getUsableSpace(mAccount.name) < tmpFile.length()) {
163+
Log_OC.w(TAG, "Not enough space to copy " + tmpFile.getAbsolutePath());
164+
}
162165
newFile = new File(getSavePath());
163-
newFile.getParentFile().mkdirs();
166+
Log_OC.d(TAG, "Save path: " + newFile.getAbsolutePath());
167+
File parent = newFile.getParentFile();
168+
boolean created = parent.mkdirs();
169+
Log_OC.d(TAG, "Creation of parent folder " + parent.getAbsolutePath() + " succeeded: " + created);
170+
Log_OC.d(TAG, "Parent folder " + parent.getAbsolutePath() + " exists: " + parent.exists());
171+
Log_OC.d(TAG, "Parent folder " + parent.getAbsolutePath() + " is directory: " + parent.isDirectory());
164172
moved = tmpFile.renameTo(newFile);
165-
if (!moved)
173+
Log_OC.d(TAG, "New file " + newFile.getAbsolutePath() + " exists: " + newFile.exists());
174+
Log_OC.d(TAG, "New file " + newFile.getAbsolutePath() + " is directory: " + newFile.isDirectory());
175+
if (!moved) {
166176
result = new RemoteOperationResult(
167-
RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
177+
RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED
178+
);
179+
}
168180
}
169181
Log_OC.i(TAG, "Download of " + mFile.getRemotePath() + " to " + getSavePath() + ": " +
170182
result.getLogMessage());

0 commit comments

Comments
 (0)