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

Unverified Commit 4c5c8c3e authored by Ricki Hirner's avatar Ricki Hirner Committed by GitHub
Browse files

Don't disable AndroidX startup completely (#1603)

* Add test

* Update AndroidManifest.xml to configure Hilt/WorkManager integration and remove default WorkManagerInitializer
parent 4685ab6d
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -6,10 +6,12 @@ package at.bitfire.davdroid

import android.util.Xml
import at.bitfire.dav4jvm.XmlUtils
import okhttp3.HttpUrl.Companion.toHttpUrl
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test

class Dav4jvmTest {
class ExternalLibrariesTest {

    @Test
    fun test_Dav4jvm_XmlUtils_NewPullParser_RelaxedParsing() {
@@ -17,4 +19,12 @@ class Dav4jvmTest {
        assertTrue(parser.getFeature(Xml.FEATURE_RELAXED))
    }

    @Test
    fun testOkhttpHttpUrl_PublicSuffixList() {
        // HttpUrl.topPrivateDomain() requires okhttp's internal PublicSuffixList.
        // In Android, loading the PublicSuffixList is done over AndroidX startup.
        // This test verifies that everything is working.
        assertEquals("example.com", "http://example.com".toHttpUrl().topPrivateDomain())
    }

}
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -53,11 +53,19 @@
        tools:ignore="UnusedAttribute"
        android:supportsRtl="true">

        <!-- required for Hilt/WorkManager integration -->
        <!-- Required for Hilt/WorkManager integration. See
        - https://developer.android.com/develop/background-work/background-tasks/persistent/configuration/custom-configuration#remove-default
        - https://developer.android.com/training/dependency-injection/hilt-jetpack#workmanager
        However, we must not disable AndroidX startup completely, as it's needed by other libraries like okhttp. -->
        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            tools:node="remove">
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

        <!-- Remove the node added by AppAuth (remove only from net.openid.appauth library, not from our flavor manifest files) -->