浏览代码

Merge pull request #1923 from nextcloud/fix-1911

Fix #1911
Mario Đanić 7 年之前
父节点
当前提交
24cd4fce11

+ 1 - 0
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -396,6 +396,7 @@ public class FileUploader extends Service
                         currentAccount = failedUpload.getAccount(context);
                     }
 
+                    charging = charging || Device.getBatteryStatus(context).getBatteryPercent() == 1;
                     if (!isPowerSaving && gotNetwork && checkIfUploadCanBeRetried(failedUpload, gotWifi, charging)) {
                             retry(context, currentAccount, failedUpload);
                         }

+ 2 - 1
src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -354,7 +354,8 @@ public class UploadFileOperation extends SyncOperation {
             }
 
             // Check if charging conditions are met and delays the upload otherwise
-            if (mWhileChargingOnly && !Device.getBatteryStatus(mContext).isCharging()) {
+            if (mWhileChargingOnly && (!Device.getBatteryStatus(mContext).isCharging() && Device.getBatteryStatus
+                    (mContext).getBatteryPercent() < 1)) {
                 Log_OC.d(TAG, "Upload delayed until the device is charging: " + getRemotePath());
                 return new RemoteOperationResult(ResultCode.DELAYED_FOR_CHARGING);
             }