<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.freerdp.afreerdp"
    android:installLocation="auto">

    <application
        android:name="com.freerdp.afreerdp.application.GlobalApp"
        android:icon="@drawable/icon_launcher_freerdp"
        android:label="aFreeRDP"
        android:resizeableActivity="true">

        <!-- Main activity -->
        <activity
            android:exported="true"
            android:name="com.freerdp.freerdpcore.presentation.HomeActivity"
            android:alwaysRetainTaskState="true"
            android:label="@string/app_title"
            android:theme="@style/Theme.Main"
            android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|screenLayout">

            <intent-filter android:label="@string/app_title">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:mimeType="application/rdp" />
                <data android:mimeType="application/x-rdp" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="rdp" />
                <data android:scheme="Rdp" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="file" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:scheme="content" />
                <data android:host="*" />

                <!-- Ugly hack to match all files with a dot in its name.
                Remove if a better way is found / supported.
                https://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i/8599921#8599921
                -->
                <data android:pathPattern=".*\\.rdp" />
                <data android:pathPattern=".*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.rdp" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\..*\\.rdp" />
            </intent-filter>
        </activity>

        <!-- Session request handler activity - used for search and internally to start sessions -->
        <!-- This should actually be defined in FreeRDPCore lib but Android manifest merging will -->
        <!-- append the libs manifest to the apps manifest and therefore aliasing is not possible -->
        <activity
            android:exported="true"
            android:name="com.freerdp.freerdpcore.services.SessionRequestHandlerActivity"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:theme="@android:style/Theme.NoDisplay">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

        <activity-alias
            android:exported="true"
            android:name=".services.SessionRequestHandlerActivity"
            android:targetActivity="com.freerdp.freerdpcore.services.SessionRequestHandlerActivity">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity-alias>

        <provider
            android:name="com.freerdp.freerdpcore.services.FreeRDPSuggestionProvider"
            android:authorities="com.freerdp.afreerdp.services.freerdpsuggestionprovider"></provider>

        <meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>

    </application>

</manifest>

