Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bdf03bf authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Minor changes (lint/remove warnings)

parent 8b43677d
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -29,11 +29,10 @@ android {
        vectorDrawables.useSupportLibrary = true
    }

    flavorDimensions "type"
    flavorDimensions "distribution"
    productFlavors {
        standard {
            versionName "2.0.6-beta1-ose"

            buildConfigField "boolean", "customCerts", "true"
        }
    }
@@ -84,11 +83,11 @@ dependencies {
    implementation 'com.github.yukuku:ambilwarna:2.0.1'
    implementation 'com.mikepenz:aboutlibraries:6.2.0'

    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
    implementation 'commons-io:commons-io:2.6'
    implementation 'dnsjava:dnsjava:2.1.8'
    implementation 'org.apache.commons:commons-lang3:3.7'
    implementation 'org.apache.commons:commons-collections4:4.1'
    implementation 'org.apache.commons:commons-lang3:3.8.1'
    implementation 'org.apache.commons:commons-collections4:4.2'

    // for tests
    androidTestImplementation 'androidx.test:runner:1.1.0'
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class CustomTlsSocketFactoryTest {


    private fun readResource(name: String): ByteArray {
        this.javaClass.classLoader.getResourceAsStream(name).use {
        javaClass.classLoader!!.getResourceAsStream(name).use {
            return IOUtils.toByteArray(it)
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
package at.bitfire.davdroid.settings

import at.bitfire.davdroid.App
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertFalse
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Test

class DefaultsProviderTest {
+2 −2
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@ package at.bitfire.davdroid.settings

import androidx.test.platform.app.InstrumentationRegistry
import at.bitfire.davdroid.App
import junit.framework.Assert.assertFalse
import junit.framework.Assert.assertTrue
import org.junit.After
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test

+8 −3
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ class AccountSettings(
    }

    @Suppress("unused")
    @SuppressLint("Recycle")
    /**
     * There is a mistake in this method. [TaskContract.Tasks.SYNC_VERSION] is used to store the
     * SEQUENCE and should not be used for the eTag.
@@ -251,7 +252,7 @@ class AccountSettings(
            provider.client.query(TaskProvider.syncAdapterUri(provider.tasksUri(), account),
                    arrayOf(TaskContract.Tasks._ID, TaskContract.Tasks.SYNC1, TaskContract.Tasks.SYNC2),
                    "${TaskContract.Tasks.ACCOUNT_TYPE}=? AND ${TaskContract.Tasks.ACCOUNT_NAME}=?",
                    arrayOf(account.type, account.name), null).use { cursor ->
                    arrayOf(account.type, account.name), null)!!.use { cursor ->
                while (cursor.moveToNext()) {
                    val id = cursor.getLong(0)
                    val eTag = cursor.getString(1)
@@ -271,12 +272,14 @@ class AccountSettings(
    }

    @Suppress("unused")
    @SuppressLint("Recycle")
    private fun update_6_7() {
        // add calendar colors
        context.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)?.let { provider ->
            try {
                AndroidCalendar.insertColors(provider, account)
            } finally {
                @Suppress("DEPRECATION")
                if (Build.VERSION.SDK_INT >= 24)
                    provider.close()
                else
@@ -291,7 +294,7 @@ class AccountSettings(
    }

    @Suppress("unused")
    @SuppressLint("ParcelClassLoader")
    @SuppressLint("Recycle", "ParcelClassLoader")
    private fun update_5_6() {
        context.contentResolver.acquireContentProviderClient(ContactsContract.AUTHORITY)?.let { provider ->
            val parcel = Parcel.obtain()
@@ -308,7 +311,7 @@ class AccountSettings(
                else {
                    parcel.unmarshall(raw, 0, raw.size)
                    parcel.setDataPosition(0)
                    val params = parcel.readBundle()
                    val params = parcel.readBundle()!!
                    val url = params.getString("url")?.let { HttpUrl.parse(it) }
                    if (url == null)
                        Logger.log.info("No address book URL, ignoring account")
@@ -343,6 +346,7 @@ class AccountSettings(
                throw ContactsStorageException("Couldn't migrate contacts to new address book", e)
            } finally {
                parcel.recycle()
                @Suppress("DEPRECATION")
                if (Build.VERSION.SDK_INT >= 24)
                    provider.close()
                else
@@ -371,6 +375,7 @@ class AccountSettings(
    }

    @Suppress("unused")
    @SuppressLint("Recycle")
    private fun update_2_3() {
        // Don't show a warning for Android updates anymore
        accountManager.setUserData(account, "last_android_version", null)
Loading