remove Android 4.4. code block from kotlin files

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2020-11-30 09:54:33 +01:00
parent 0849cf21bd
commit a72bf7bc78
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 2 additions and 23 deletions

View file

@ -25,8 +25,6 @@ package com.nextcloud.client.jobs
import android.content.ContentResolver
import android.content.Context
import android.content.res.Resources
import android.os.Build
import android.os.PowerManager
import android.os.PowerManager.WakeLock
import android.text.TextUtils
import androidx.exifinterface.media.ExifInterface
@ -37,7 +35,6 @@ import com.nextcloud.client.core.Clock
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.network.ConnectivityService
import com.nextcloud.client.preferences.AppPreferences
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.datamodel.FilesystemDataProvider
@ -82,16 +79,7 @@ class FilesSyncWork(
}
override fun doWork(): Result {
var wakeLock: WakeLock? = null
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
wakeLock = powerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK,
MainApp.getAuthority() +
WAKELOCK_TAG_SEPARATION + TAG
)
wakeLock.acquire(WAKELOCK_ACQUIRE_TIMEOUT_MS)
}
val wakeLock: WakeLock? = null
val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
// If we are in power save mode, better to postpone upload
if (powerManagementService.isPowerSavingEnabled && !overridePowerSaving) {

View file

@ -23,8 +23,6 @@ package com.nextcloud.client.jobs
import android.content.ContentResolver
import android.content.Context
import android.os.Build
import android.os.PowerManager
import android.os.PowerManager.WakeLock
import androidx.work.Worker
import androidx.work.WorkerParameters
@ -32,7 +30,6 @@ import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.network.ConnectivityService
import com.owncloud.android.MainApp
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
@ -59,14 +56,8 @@ class OfflineSyncWork constructor(
}
override fun doWork(): Result {
var wakeLock: WakeLock? = null
val wakeLock: WakeLock? = null
if (!powerManagementService.isPowerSavingEnabled && !connectivityService.isInternetWalled) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
val wakeLockTag = MainApp.getAuthority() + WAKELOCK_TAG_SEPARATION + TAG
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, wakeLockTag)
wakeLock.acquire(WAKELOCK_ACQUISITION_TIMEOUT_MS)
}
val users = userAccountManager.allUsers
for (user in users) {
val storageManager = FileDataStorageManager(user.toPlatformAccount(), contentResolver)