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

Commit d33192c9 authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Create services to include in the service selector for media, app data and notes

parent b8e7f49a
Loading
Loading
Loading
Loading
Loading
+52 −13
Original line number Diff line number Diff line
@@ -253,6 +253,58 @@
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_tasks" />
        </service>
        <service
            android:name=".syncadapter.EeloNotesSyncAdapterService"
            android:exported="true"
            android:process=":sync"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_notes" />
        </service>
        <service
            android:name=".syncadapter.EeloEmailSyncAdapterService"
            android:exported="true"
            android:process=":sync"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_email" />
        </service>
        <service
            android:name=".syncadapter.EeloMediaSyncAdapterService"
            android:exported="true"
            android:process=":sync"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_media" />
        </service>
        <service
            android:name=".syncadapter.EeloAppDataSyncAdapterService"
            android:exported="true"
            android:process=":sync"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_app_data" />
        </service>

        <!-- account type "eelo Address book" -->
        <service
@@ -296,19 +348,6 @@
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>
        <service
            android:name=".syncadapter.EeloEmailSyncAdapterService"
            android:exported="true"
            android:process=":sync"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/eelo_sync_email" />
        </service>

        <!-- account type "Google" -->
        <service
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */
package at.bitfire.davdroid.syncadapter

import android.accounts.Account
import android.content.*
import android.os.Bundle
import at.bitfire.davdroid.settings.ISettings

class EeloAppDataSyncAdapterService : SyncAdapterService() {

    override fun syncAdapter() = CalendarsSyncAdapter(this)


    class CalendarsSyncAdapter(context: Context) : SyncAdapter(context) {

        override fun sync(settings: ISettings, account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
            // Unused
        }
    }

}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */
package at.bitfire.davdroid.syncadapter

import android.accounts.Account
import android.content.*
import android.os.Bundle
import at.bitfire.davdroid.settings.ISettings

class EeloMediaSyncAdapterService : SyncAdapterService() {

    override fun syncAdapter() = CalendarsSyncAdapter(this)


    class CalendarsSyncAdapter(context: Context) : SyncAdapter(context) {

        override fun sync(settings: ISettings, account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
            // Unused
        }
    }

}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */
package at.bitfire.davdroid.syncadapter

import android.accounts.Account
import android.content.*
import android.os.Bundle
import at.bitfire.davdroid.settings.ISettings

class EeloNotesSyncAdapterService : SyncAdapterService() {

    override fun syncAdapter() = CalendarsSyncAdapter(this)


    class CalendarsSyncAdapter(context: Context) : SyncAdapter(context) {

        override fun sync(settings: ISettings, account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
            // Unused
        }
    }

}
+3 −0
Original line number Diff line number Diff line
@@ -193,7 +193,10 @@ class AccountDetailsFragment : Fragment(), LoaderManager.LoaderCallbacks<CreateS
            accountManager.setPassword(account, config.credentials.password)
        }

        ContentResolver.setSyncAutomatically(account, getString(R.string.notes_authority), true)
        ContentResolver.setSyncAutomatically(account, getString(R.string.email_authority), true)
        ContentResolver.setSyncAutomatically(account, getString(R.string.media_authority), true)
        ContentResolver.setSyncAutomatically(account, getString(R.string.app_data_authority), true)

        // add entries for account to service DB
        Logger.log.log(Level.INFO, "Writing account configuration to database", config)
Loading