Skip to content

Commit c71f07c

Browse files
committed
Stop supporting android kitkat
1 parent 44e2b95 commit c71f07c

35 files changed

Lines changed: 135 additions & 317 deletions

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ buildscript {
22
ext {
33
// SDK
44
sdkCompileVersion = 28
5-
sdkMinVersion = 19
5+
sdkMinVersion = 21
66
sdkTargetVersion = 28
77

88
// Android jetpack

owncloudApp/src/main/java/com/owncloud/android/broadcastreceivers/ConnectivityActionReceiver.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,6 @@ private void wifiConnected(Context context) {
169169
Log_OC.d(TAG, "Requesting retry of camera uploads (& friends)");
170170
TransferRequester requester = new TransferRequester();
171171

172-
//Avoid duplicate uploads, because uploads retry is also managed in FileUploader
173-
//by using jobs in versions 5 or higher
174-
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
175-
requester.retryFailedUploads(
176-
MainApp.Companion.getAppContext(),
177-
null,
178-
// for the interrupted when Wifi fell, if any
179-
// (side effect: any upload failed due to network error will be
180-
// retried too, instant or not)
181-
UploadResult.NETWORK_CONNECTION,
182-
true
183-
);
184-
}
185-
186172
requester.retryFailedUploads(
187173
MainApp.Companion.getAppContext(),
188174
null,

owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class AvailableOfflineHandler {
4646
private String mAccountName;
4747
private JobScheduler mJobScheduler;
4848

49-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
5049
public AvailableOfflineHandler(Context context, String accountName) {
5150
mAccountName = accountName;
5251
mJobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
@@ -55,7 +54,6 @@ public AvailableOfflineHandler(Context context, String accountName) {
5554
/**
5655
* Schedule a periodic job to check whether recently updated available offline files need to be synchronized
5756
*/
58-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
5957
public void scheduleAvailableOfflineJob(Context context) {
6058
ComponentName serviceComponent = new ComponentName(context, AvailableOfflineSyncJobService.class);
6159
JobInfo.Builder builder;

owncloudApp/src/main/java/com/owncloud/android/files/services/AvailableOfflineSyncJobService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
* This job should be executed every 15 minutes since a file is set as available offline for the first time and stopped
5151
* when there's no available offline files
5252
*/
53-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
5453
public class AvailableOfflineSyncJobService extends JobService {
5554
private static final String TAG = "AvOfflineSyncJobService";
5655

owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsHandler.java

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,64 +55,60 @@ public CameraUploadsHandler(CameraUploadsConfiguration cameraUploadsConfiguratio
5555
* Schedule a periodic job to check pictures and videos to be uploaded
5656
*/
5757
public void scheduleCameraUploadsSyncJob(Context context) {
58+
// DB Connection
59+
CameraUploadsSyncStorageManager cameraUploadsSyncStorageManager = new
60+
CameraUploadsSyncStorageManager(context.getContentResolver());
5861

59-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
60-
61-
// DB Connection
62-
CameraUploadsSyncStorageManager cameraUploadsSyncStorageManager = new
63-
CameraUploadsSyncStorageManager(context.getContentResolver());
64-
65-
OCCameraUploadSync ocCameraUploadSync = cameraUploadsSyncStorageManager.
66-
getCameraUploadSync(null, null, null);
62+
OCCameraUploadSync ocCameraUploadSync = cameraUploadsSyncStorageManager.
63+
getCameraUploadSync(null, null, null);
6764

68-
// Initialize synchronization timestamps for pictures/videos, if needed
69-
if (ocCameraUploadSync == null ||
70-
ocCameraUploadSync.getPicturesLastSync() == 0 ||
71-
ocCameraUploadSync.getVideosLastSync() == 0) {
65+
// Initialize synchronization timestamps for pictures/videos, if needed
66+
if (ocCameraUploadSync == null ||
67+
ocCameraUploadSync.getPicturesLastSync() == 0 ||
68+
ocCameraUploadSync.getVideosLastSync() == 0) {
7269

73-
initializeCameraUploadSync(cameraUploadsSyncStorageManager, ocCameraUploadSync);
74-
}
70+
initializeCameraUploadSync(cameraUploadsSyncStorageManager, ocCameraUploadSync);
71+
}
7572

76-
ComponentName serviceComponent = new ComponentName(context, CameraUploadsSyncJobService.class);
77-
JobInfo.Builder builder;
73+
ComponentName serviceComponent = new ComponentName(context, CameraUploadsSyncJobService.class);
74+
JobInfo.Builder builder;
7875

79-
builder = new JobInfo.Builder(JOB_ID_CAMERA_UPLOAD, serviceComponent);
76+
builder = new JobInfo.Builder(JOB_ID_CAMERA_UPLOAD, serviceComponent);
8077

81-
builder.setPersisted(true);
78+
builder.setPersisted(true);
8279

83-
// Execute job every 15 minutes
84-
builder.setPeriodic(MILLISECONDS_INTERVAL_CAMERA_UPLOAD);
80+
// Execute job every 15 minutes
81+
builder.setPeriodic(MILLISECONDS_INTERVAL_CAMERA_UPLOAD);
8582

86-
// Extra data
87-
PersistableBundle extras = new PersistableBundle();
83+
// Extra data
84+
PersistableBundle extras = new PersistableBundle();
8885

89-
extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_SYNC_JOB_ID, JOB_ID_CAMERA_UPLOAD);
86+
extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_SYNC_JOB_ID, JOB_ID_CAMERA_UPLOAD);
9087

91-
extras.putString(Extras.EXTRA_ACCOUNT_NAME, mCameraUploadsConfig.getUploadAccountName());
88+
extras.putString(Extras.EXTRA_ACCOUNT_NAME, mCameraUploadsConfig.getUploadAccountName());
9289

93-
if (mCameraUploadsConfig.isEnabledForPictures()) {
94-
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_PICTURES_PATH, mCameraUploadsConfig.
95-
getUploadPathForPictures());
96-
}
90+
if (mCameraUploadsConfig.isEnabledForPictures()) {
91+
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_PICTURES_PATH, mCameraUploadsConfig.
92+
getUploadPathForPictures());
93+
}
9794

98-
if (mCameraUploadsConfig.isEnabledForVideos()) {
99-
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_VIDEOS_PATH, mCameraUploadsConfig.
100-
getUploadPathForVideos());
101-
}
95+
if (mCameraUploadsConfig.isEnabledForVideos()) {
96+
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_VIDEOS_PATH, mCameraUploadsConfig.
97+
getUploadPathForVideos());
98+
}
10299

103-
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_SOURCE_PATH, mCameraUploadsConfig.getSourcePath());
100+
extras.putString(Extras.EXTRA_CAMERA_UPLOADS_SOURCE_PATH, mCameraUploadsConfig.getSourcePath());
104101

105-
extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_BEHAVIOR_AFTER_UPLOAD, mCameraUploadsConfig.
106-
getBehaviourAfterUpload());
102+
extras.putInt(Extras.EXTRA_CAMERA_UPLOADS_BEHAVIOR_AFTER_UPLOAD, mCameraUploadsConfig.
103+
getBehaviourAfterUpload());
107104

108-
builder.setExtras(extras);
105+
builder.setExtras(extras);
109106

110-
Log_OC.d(TAG, "Scheduling a CameraUploadsSyncJobService");
107+
Log_OC.d(TAG, "Scheduling a CameraUploadsSyncJobService");
111108

112-
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
109+
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
113110

114-
jobScheduler.schedule(builder.build());
115-
}
111+
jobScheduler.schedule(builder.build());
116112
}
117113

118114
/**
@@ -161,6 +157,7 @@ private void initializeCameraUploadSync(CameraUploadsSyncStorageManager cameraUp
161157

162158
/**
163159
* Update timestamp (in milliseconds) from which to start checking pictures to upload
160+
*
164161
* @param lastSyncTimestamp
165162
*/
166163
public void updatePicturesLastSync(Context context, long lastSyncTimestamp) {
@@ -181,6 +178,7 @@ public void updatePicturesLastSync(Context context, long lastSyncTimestamp) {
181178

182179
/**
183180
* Update timestamp (in milliseconds) from which to start checking videos to upload
181+
*
184182
* @param lastSyncTimestamp
185183
*/
186184
public void updateVideosLastSync(Context context, long lastSyncTimestamp) {

owncloudApp/src/main/java/com/owncloud/android/files/services/CameraUploadsSyncJobService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import java.util.Date;
4646
import java.util.Locale;
4747

48-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
4948
public class CameraUploadsSyncJobService extends JobService {
5049

5150
private static final String TAG = CameraUploadsSyncJobService.class.getSimpleName();

owncloudApp/src/main/java/com/owncloud/android/files/services/RetryDownloadJobService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.owncloud.android.lib.common.utils.Log_OC;
3535
import com.owncloud.android.utils.Extras;
3636

37-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
3837
public class RetryDownloadJobService extends JobService {
3938

4039
private static final String TAG = RetryDownloadJobService.class.getName();

owncloudApp/src/main/java/com/owncloud/android/files/services/RetryUploadJobService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.owncloud.android.lib.common.utils.Log_OC;
3232
import com.owncloud.android.utils.Extras;
3333

34-
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
3534
public class RetryUploadJobService extends JobService {
3635

3736
private static final String TAG = RetryUploadJobService.class.getName();

owncloudApp/src/main/java/com/owncloud/android/files/services/TransferRequester.java

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
/**
5454
* Facade class providing methods to ease requesting commands to transfer services {@link FileUploader} and
5555
* {@link FileDownloader}.
56-
*
56+
* <p>
5757
* Protects client objects from the verbosity of {@link android.content.Intent}s.
58-
*
58+
* <p>
5959
* TODO add methods for {@link FileDownloader}, right now it's just about uploads
6060
*/
6161

@@ -171,13 +171,13 @@ public void retry(Context context, OCUpload upload, boolean requestedFromWifiBac
171171
/**
172172
* Retry a subset of all the stored failed uploads.
173173
*
174-
* @param context Caller {@link Context}
175-
* @param account If not null, only failed uploads to this OC account will be retried; otherwise,
176-
* uploads of all accounts will be retried.
177-
* @param uploadResult If not null, only failed uploads with the result specified will be retried;
178-
* otherwise, failed uploads due to any result will be retried.
179-
* @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back,
180-
* false otherwise
174+
* @param context Caller {@link Context}
175+
* @param account If not null, only failed uploads to this OC account will be retried; otherwise,
176+
* uploads of all accounts will be retried.
177+
* @param uploadResult If not null, only failed uploads with the result specified will be retried;
178+
* otherwise, failed uploads due to any result will be retried.
179+
* @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back,
180+
* false otherwise
181181
*/
182182
public void retryFailedUploads(Context context, Account account, UploadResult uploadResult,
183183
boolean requestedFromWifiBackEvent) {
@@ -201,9 +201,9 @@ public void retryFailedUploads(Context context, Account account, UploadResult up
201201
/**
202202
* Private implementation of retry.
203203
*
204-
* @param context Caller {@link Context}
205-
* @param account OC account where the upload will be retried.
206-
* @param upload Persisted upload to retry.
204+
* @param context Caller {@link Context}
205+
* @param account OC account where the upload will be retried.
206+
* @param upload Persisted upload to retry.
207207
* @param requestedFromWifiBackEvent true if the retry was requested because wifi connection was back,
208208
* false otherwise
209209
*/
@@ -235,8 +235,8 @@ private void retry(Context context, Account account, OCUpload upload, boolean re
235235
/**
236236
* Return 'true' when conditions for a scheduled retry are met.
237237
*
238-
* @param context Caller {@link Context}
239-
* @return 'true' when conditions for a scheduled retry are met, 'false' otherwise.
238+
* @param context Caller {@link Context}
239+
* @return 'true' when conditions for a scheduled retry are met, 'false' otherwise.
240240
*/
241241
boolean shouldScheduleRetry(Context context, Exception exception) {
242242
return (
@@ -251,10 +251,10 @@ boolean shouldScheduleRetry(Context context, Exception exception) {
251251
* Schedule a future retry of an upload, to be done when a connection via an unmetered network (free Wifi)
252252
* is available.
253253
*
254-
* @param context Caller {@link Context}.
255-
* @param jobId Identifier to set to the retry job.
256-
* @param accountName Local name of the OC account where the upload will be retried.
257-
* @param remotePath Full path of the file to upload, relative to root of the OC account.
254+
* @param context Caller {@link Context}.
255+
* @param jobId Identifier to set to the retry job.
256+
* @param accountName Local name of the OC account where the upload will be retried.
257+
* @param remotePath Full path of the file to upload, relative to root of the OC account.
258258
*/
259259
void scheduleUpload(Context context, int jobId, String accountName, String remotePath) {
260260
boolean scheduled = scheduleTransfer(
@@ -281,10 +281,10 @@ void scheduleUpload(Context context, int jobId, String accountName, String remot
281281
* Schedule a future retry of a download, to be done when a connection via an unmetered network (free Wifi)
282282
* is available.
283283
*
284-
* @param context Caller {@link Context}.
285-
* @param jobId Identifier to set to the retry job.
286-
* @param accountName Local name of the OC account where the download will be retried.
287-
* @param remotePath Full path of the file to download, relative to root of the OC account.
284+
* @param context Caller {@link Context}.
285+
* @param jobId Identifier to set to the retry job.
286+
* @param accountName Local name of the OC account where the download will be retried.
287+
* @param remotePath Full path of the file to download, relative to root of the OC account.
288288
*/
289289
void scheduleDownload(Context context, int jobId, String accountName, String remotePath) {
290290
boolean scheduled = scheduleTransfer(
@@ -311,12 +311,12 @@ void scheduleDownload(Context context, int jobId, String accountName, String rem
311311
* Schedule a future transfer of an upload, to be done when a connection via an unmetered network (free Wifi)
312312
* is available.
313313
*
314-
* @param context Caller {@link Context}.
315-
* @param scheduledRetryService Class of the appropriate retry service, either to retry downloads
316-
* or to retry uploads.
317-
* @param jobId Identifier to set to the retry job.
318-
* @param accountName Local name of the OC account where the upload will be retried.
319-
* @param remotePath Full path of the file to upload, relative to root of the OC account.
314+
* @param context Caller {@link Context}.
315+
* @param scheduledRetryService Class of the appropriate retry service, either to retry downloads
316+
* or to retry uploads.
317+
* @param jobId Identifier to set to the retry job.
318+
* @param accountName Local name of the OC account where the upload will be retried.
319+
* @param remotePath Full path of the file to upload, relative to root of the OC account.
320320
*/
321321
private boolean scheduleTransfer(
322322
Context context,
@@ -325,12 +325,6 @@ private boolean scheduleTransfer(
325325
String accountName,
326326
String remotePath
327327
) {
328-
329-
// JobShceduler requires Android >= 5.0 ; do not remove this protection while minSdkVersion is lower
330-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
331-
return false;
332-
}
333-
334328
ComponentName serviceComponent = new ComponentName(
335329
context,
336330
scheduledRetryService
@@ -361,9 +355,10 @@ private boolean scheduleTransfer(
361355

362356
/**
363357
* Retrieve the type of network connection required to schedule the last upload for an account
358+
*
364359
* @param context
365360
* @param accountName
366-
* @param remotePath to upload the file
361+
* @param remotePath to upload the file
367362
* @return 2 if only wifi is required, 1 if any internet connection is required (wifi or cellular)
368363
*/
369364
private int getRequiredNetworkType(Context context, String accountName, String remotePath) {

owncloudApp/src/main/java/com/owncloud/android/media/MediaControlView.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ private void initControllerView(View v) {
124124
if (mProgress != null) {
125125
if (mProgress instanceof SeekBar) {
126126
SeekBar seeker = (SeekBar) mProgress;
127-
DisplayUtils.colorPreLollipopHorizontalSeekBar(seeker);
128127
seeker.setOnSeekBarChangeListener(this);
129-
} else {
130-
DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgress);
131128
}
132129
mProgress.setMax(1000);
133130
}

0 commit comments

Comments
 (0)