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

Commit a574ff29 authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Raise SDK compatibility level to 31 (Android 12); lint

parent c4f7abf7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -30,12 +30,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka'

android {
    compileSdkVersion 30
    compileSdkVersion 31
    buildToolsVersion '30.0.3'

    defaultConfig {
        minSdkVersion 16        // Android 4.1
        targetSdkVersion 30     // Android 11
        targetSdkVersion 31     // Android 12
    }

    compileOptions {
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ package at.bitfire.vcard4android.contactrow
import android.content.ContentValues
import android.provider.ContactsContract.CommonDataKinds.Email
import at.bitfire.vcard4android.Contact
import at.bitfire.vcard4android.datavalues.EmailHandler
import at.bitfire.vcard4android.property.CustomType
import ezvcard.parameter.EmailType
import org.junit.Assert.*
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ package at.bitfire.vcard4android.contactrow
import android.content.ContentValues
import android.provider.ContactsContract.CommonDataKinds.Photo
import at.bitfire.vcard4android.Contact
import at.bitfire.vcard4android.datavalues.PhotoHandler
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
+2 −15
Original line number Diff line number Diff line
@@ -150,9 +150,9 @@ open class AndroidContact(
        // - We'll only delete rows we have inserted so that unknown rows like
        //   vnd.android.cursor.item/important_people (= contact is in Samsung "edge panel") remain untouched.
        val typesToRemove = processor.builderMimeTypes()
        val sqlTypesToRemove = typesToRemove.map { mimeType ->
        val sqlTypesToRemove = typesToRemove.joinToString(",") { mimeType ->
            DatabaseUtils.sqlEscapeString(mimeType)
        }.joinToString(",")
        }
        batch.enqueue(BatchOperation.CpoBuilder
                .newDelete(dataSyncURI())
                .withSelection(Data.RAW_CONTACT_ID + "=? AND ${Data.MIMETYPE} IN ($sqlTypesToRemove)", arrayOf(id!!.toString())))
@@ -205,19 +205,6 @@ open class AndroidContact(

    // helpers

    protected fun insertDataBuilder(rawContactKeyName: String): BatchOperation.CpoBuilder {
        val builder = BatchOperation.CpoBuilder.newInsert(dataSyncURI())
        if (id == null)
            builder.withValueBackReference(rawContactKeyName, 0)
        else
            builder.withValue(rawContactKeyName, id)

        if (addressBook.readOnly)
            builder.withValue(Data.IS_READ_ONLY, 1)

        return builder
    }

    protected fun rawContactSyncURI(): Uri {
        val id = requireNotNull(id)
        return addressBook.syncAdapterURI(ContentUris.withAppendedId(RawContacts.CONTENT_URI, id))
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class BatchOperation(
     * @param end   index of last operation which will be run (exclusive!)
     * @throws RemoteException on calendar provider errors
     * @throws OperationApplicationException when the batch can't be processed
     * @throws CalendarStorageException if the transaction is too large
     * @throws ContactsStorageException if the transaction is too large
     */
    private fun runBatch(start: Int, end: Int) {
        if (end == start)
Loading