<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="auto"
    package="com.fsck.k9.jmap">

    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false"/>

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"/>

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <application
        android:name="com.fsck.k9.App"
        android:allowTaskReparenting="false"
        android:usesCleartextTraffic="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.K9.Startup"
        android:resizeableActivity="true"
        android:allowBackup="false">

        <meta-data
            android:name="android.app.default_searchable"
            android:value="com.fsck.k9.activity.Search"/>

        <!-- TODO: Remove once minSdkVersion has been changed to 24+ -->
        <meta-data
            android:name="com.lge.support.SPLIT_WINDOW"
            android:value="true"/>
        <uses-library
            android:name="com.sec.android.app.multiwindow"
            android:required="false"/>
        <meta-data
            android:name="com.sec.android.support.multiwindow"
            android:value="true"/>
        <meta-data
            android:name="com.samsung.android.sdk.multiwindow.penwindow.enable"
            android:value="true"/>

        <activity
            android:name="com.fsck.k9.ui.onboarding.OnboardingActivity"
            android:label="@string/welcome_message_title" />

        <activity
            android:name="com.fsck.k9.ui.settings.account.OpenPgpAppSelectDialog"
            android:configChanges="locale"
            android:theme="@style/Theme.K9.Dialog.Translucent.DayNight"
            />

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupBasics"
            android:configChanges="locale"
            android:label="@string/account_setup_basics_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupAccountType"
            android:configChanges="locale"
            android:label="@string/account_setup_account_type_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupIncoming"
            android:configChanges="locale"
            android:label="@string/account_setup_incoming_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupComposition"
            android:configChanges="locale"
            android:label="@string/account_settings_composition_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupOutgoing"
            android:configChanges="locale"
            android:label="@string/account_setup_outgoing_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupOptions"
            android:configChanges="locale"
            android:label="@string/account_setup_options_title"/>

        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupNames"
            android:configChanges="locale"
            android:label="@string/account_setup_names_title"/>

        <activity
            android:name="com.fsck.k9.activity.ChooseAccount"
            android:configChanges="locale"
            android:label="@string/choose_account_title"
            android:noHistory="true" />

        <activity
            android:name="com.fsck.k9.ui.choosefolder.ChooseFolderActivity"
            android:configChanges="locale"
            android:label="@string/choose_folder_title"
            android:noHistory="true" />

        <activity
            android:name="com.fsck.k9.activity.ChooseIdentity"
            android:configChanges="locale"
            android:label="@string/choose_identity_title" />

        <activity
            android:name="com.fsck.k9.activity.ManageIdentities"
            android:configChanges="locale"
            android:label="@string/manage_identities_title"/>

        <activity
            android:name="com.fsck.k9.activity.EditIdentity"
            android:configChanges="locale"
            android:label="@string/edit_identity_title"/>

        <activity
            android:name="com.fsck.k9.ui.notification.DeleteConfirmationActivity"
            android:excludeFromRecents="true"
            android:launchMode="singleTop"
            android:taskAffinity=""
            android:theme="@style/Theme.K9.Dialog.Translucent.DayNight"/>

        <!-- XXX Note: this activity is hacked to ignore config changes,
             since it doesn't currently handle them correctly in code. -->
        <activity
            android:name="com.fsck.k9.activity.setup.AccountSetupCheckSettings"
            android:configChanges="keyboardHidden|orientation|locale"
            android:label="@string/account_setup_check_settings_title"/>

        <activity
            android:name="com.fsck.k9.ui.endtoend.AutocryptKeyTransferActivity"
            android:configChanges="locale"
            android:label="@string/ac_transfer_title"
            />

        <activity android:name="com.fsck.k9.activity.MessageList">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.LAUNCHER"/>

                <!-- TODO: Remove once minSdkVersion has been changed to 24+ -->
                <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
                <category android:name="android.intent.category.PENWINDOW_LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity
            android:name="com.fsck.k9.activity.MessageCompose"
            android:configChanges="locale"
            android:enabled="false"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.SENDTO"/>
                <data android:scheme="mailto"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <data android:mimeType="*/*"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE"/>
                <data android:mimeType="*/*"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <data android:scheme="mailto"/>

                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
            <intent-filter>
                <action android:name="org.autocrypt.PEER_ACTION"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>

            <meta-data
                android:name="android.service.chooser.chooser_target_service"
                android:value="com.fsck.k9.directshare.K9ChooserTargetService" />
        </activity>

        <!-- Search Activity - searchable -->
        <activity
            android:name="com.fsck.k9.activity.Search"
            android:configChanges="locale"
            android:label="@string/search_action"
            android:uiOptions="splitActionBarWhenNarrow">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable"/>
        </activity>

        <activity
            android:name="com.fsck.k9.activity.UpgradeDatabases"
            android:label="@string/upgrade_databases_title"/>

        <activity
            android:name="com.fsck.k9.ui.managefolders.ManageFoldersActivity"
            android:label="@string/folders_action" />

        <activity
            android:name="com.fsck.k9.ui.settings.SettingsActivity"
            android:label="@string/prefs_title" />

        <activity
            android:name="com.fsck.k9.ui.settings.general.GeneralSettingsActivity"
            android:label="@string/general_settings_title" />

        <activity
            android:name="com.fsck.k9.ui.settings.account.AccountSettingsActivity"
            android:label="@string/account_settings_title_fmt" />

        <activity
            android:name="com.fsck.k9.ui.addaccount.AddAccountActivity"
            android:label="@string/add_account_action" />

        <receiver
            android:name="com.fsck.k9.service.StorageReceiver"
            android:enabled="true">
            <intent-filter>
                <!--
                android.intent.action.MEDIA_MOUNTED

                     * Broadcast Action:  External media is present and mounted at its mount point.
                     * The path to the mount point for the removed media is contained in the Intent.mData field.
                     * The Intent contains an extra with name "read-only" and Boolean value to indicate if the
                     * media was mounted read only.

                 -->
                <action android:name="android.intent.action.MEDIA_MOUNTED"/>
                <!--

                MEDIA_EJECT and MEDIA_UNMOUNTED are not defined here: they have to be dynamically registered
                otherwise it would make K-9 start at the wrong time

                 -->
                <data android:scheme="file"/>
            </intent-filter>
        </receiver>

        <service
            android:name="com.fsck.k9.notification.NotificationActionService"
            android:enabled="true"/>

        <service
            android:name="com.fsck.k9.service.DatabaseUpgradeService"
            android:exported="false"/>

        <service
            android:name="com.fsck.k9.account.AccountRemoverService"
            android:permission="android.permission.BIND_JOB_SERVICE"/>

        <provider
            android:name="com.fsck.k9.provider.AttachmentProvider"
            android:authorities="${applicationId}.attachmentprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <meta-data
                android:name="de.cketti.safecontentresolver.ALLOW_INTERNAL_ACCESS"
                android:value="true" />

        </provider>

        <provider
            android:name="com.fsck.k9.provider.RawMessageProvider"
            android:authorities="${applicationId}.rawmessageprovider"
            android:exported="false">

            <meta-data
                android:name="de.cketti.safecontentresolver.ALLOW_INTERNAL_ACCESS"
                android:value="true" />

        </provider>

        <provider
            android:name="com.fsck.k9.provider.EmailProvider"
            android:authorities="${applicationId}.provider.email"
            android:exported="false"/>

        <provider
            android:name="com.fsck.k9.provider.DecryptedFileProvider"
            android:authorities="${applicationId}.decryptedfileprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/decrypted_file_provider_paths" />
        </provider>

        <provider
            android:name="com.fsck.k9.provider.AttachmentTempFileProvider"
            android:authorities="${applicationId}.tempfileprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/temp_file_provider_paths" />
        </provider>

    </application>
</manifest>
