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

    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_MMS" />
    <uses-permission android:name="android.provider.Telephony.SMS_RECEIVED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />

    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="28" />

    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission
        android:name="android.permission.USE_BIOMETRIC"
        tools:node="remove" />

    <queries>
        <package android:name="org.fossify.contacts.debug" />
        <package android:name="org.fossify.contacts" />
    </queries>

    <uses-feature android:name="android.hardware.telephony" />

    <application
        android:name=".App"
        android:allowBackup="true"
        android:appCategory="productivity"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_launcher_name"
        android:localeConfig="@xml/locale_config"
        android:roundIcon="@mipmap/ic_launcher"
        android:theme="@style/AppTheme">

        <activity
            android:name=".activities.SplashActivity"
            android:exported="false"
            android:theme="@style/SplashTheme" />

        <activity
            android:name=".activities.MainActivity"
            android:configChanges="orientation"
            android:exported="true" />

        <activity
            android:name=".activities.RecycleBinConversationsActivity"
            android:configChanges="orientation"
            android:exported="true"
            android:label="@string/recycle_bin"
            android:parentActivityName=".activities.MainActivity" />

        <activity
            android:name=".activities.ArchivedConversationsActivity"
            android:configChanges="orientation"
            android:exported="true"
            android:label="@string/archived_conversations"
            android:parentActivityName=".activities.MainActivity" />

        <activity
            android:name=".activities.ThreadActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:launchMode="singleTop"
            android:parentActivityName=".activities.MainActivity"
            android:windowSoftInputMode="adjustResize" />

        <activity
            android:name=".activities.NewConversationActivity"
            android:configChanges="orientation"
            android:exported="true"
            android:parentActivityName=".activities.MainActivity">

            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="*/*" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="*/*" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activities.SettingsActivity"
            android:configChanges="orientation"
            android:exported="true"
            android:label="@string/settings"
            android:parentActivityName=".activities.MainActivity">

            <intent-filter>
                <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name="org.fossify.commons.activities.AboutActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/about"
            android:parentActivityName=".activities.MainActivity" />

        <activity
            android:name="org.fossify.commons.activities.CustomizationActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/customize_colors"
            android:parentActivityName=".activities.SettingsActivity" />

        <activity
            android:name="org.fossify.commons.activities.ManageBlockedNumbersActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/blocked_numbers"
            android:parentActivityName=".activities.SettingsActivity"
            tools:replace="android:label" />

        <activity
            android:name=".activities.ManageBlockedKeywordsActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/blocked_keywords"
            android:parentActivityName=".activities.SettingsActivity" />

        <activity
            android:name=".activities.VCardViewerActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/contact_details"
            android:parentActivityName=".activities.ThreadActivity" />

        <activity
            android:name=".activities.ConversationDetailsActivity"
            android:configChanges="orientation"
            android:exported="false"
            android:label="@string/conversation_details"
            android:parentActivityName=".activities.ThreadActivity" />

        <service
            android:name=".services.HeadlessSmsSendService"
            android:exported="true"
            android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE">
            <intent-filter>
                <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
        </service>

        <service android:name="com.android.mms.transaction.TransactionService" />

        <receiver android:name=".receivers.SmsStatusSentReceiver" />

        <receiver android:name=".receivers.SmsStatusDeliveredReceiver" />

        <receiver
            android:name=".receivers.SmsReceiver"
            android:exported="true"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_DELIVER" />
            </intent-filter>
        </receiver>

        <receiver
            android:name="com.android.mms.transaction.PushReceiver"
            android:exported="true"
            android:permission="android.permission.BROADCAST_WAP_PUSH">
            <intent-filter>
                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />

                <data android:mimeType="application/vnd.wap.mms-message" />
                <data android:mimeType="application/vnd.wap.sic" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".receivers.MmsSentReceiver"
            android:exported="true"
            android:taskAffinity="com.klinker.android.messaging.MMS_SENT" />

        <receiver
            android:name=".receivers.MmsReceiver"
            android:exported="true"
            android:taskAffinity="com.klinker.android.messaging.MMS_RECEIVED" />

        <receiver
            android:name=".receivers.MarkAsReadReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="org.fossify.messages.action.mark_as_read" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".receivers.DirectReplyReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="org.fossify.messages.action.reply" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".receivers.DeleteSmsReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="org.fossify.messages.action.delete" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".receivers.ScheduledMessageReceiver"
            android:exported="false" />

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

        <activity-alias
            android:name=".activities.SplashActivity.Red"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_red"
            android:roundIcon="@mipmap/ic_launcher_red"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Pink"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_pink"
            android:roundIcon="@mipmap/ic_launcher_pink"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Purple"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_purple"
            android:roundIcon="@mipmap/ic_launcher_purple"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Deep_purple"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_deep_purple"
            android:roundIcon="@mipmap/ic_launcher_deep_purple"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Indigo"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_indigo"
            android:roundIcon="@mipmap/ic_launcher_indigo"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Blue"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_blue"
            android:roundIcon="@mipmap/ic_launcher_blue"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Light_blue"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_light_blue"
            android:roundIcon="@mipmap/ic_launcher_light_blue"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Cyan"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_cyan"
            android:roundIcon="@mipmap/ic_launcher_cyan"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Teal"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_teal"
            android:roundIcon="@mipmap/ic_launcher_teal"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Green"
            android:enabled="true"
            android:exported="true"
            android:icon="@mipmap/ic_launcher"
            android:roundIcon="@mipmap/ic_launcher"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Light_green"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_light_green"
            android:roundIcon="@mipmap/ic_launcher_light_green"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Lime"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_lime"
            android:roundIcon="@mipmap/ic_launcher_lime"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Yellow"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_yellow"
            android:roundIcon="@mipmap/ic_launcher_yellow"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Amber"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_amber"
            android:roundIcon="@mipmap/ic_launcher_amber"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Orange"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_orange"
            android:roundIcon="@mipmap/ic_launcher_orange"
            android:targetActivity=".activities.SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Deep_orange"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_deep_orange"
            android:roundIcon="@mipmap/ic_launcher_deep_orange"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Brown"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_brown"
            android:roundIcon="@mipmap/ic_launcher_brown"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Blue_grey"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_blue_grey"
            android:roundIcon="@mipmap/ic_launcher_blue_grey"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name=".activities.SplashActivity.Grey_black"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_grey_black"
            android:roundIcon="@mipmap/ic_launcher_grey_black"
            android:targetActivity=".activities.SplashActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>
    </application>
</manifest>
