<!--
  ~ Copyright (c) 2025 Element Creations Ltd.
  ~ Copyright 2023 New Vector Ltd.
  ~
  ~ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
  ~ Please see LICENSE files in the repository root for full details.
  -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

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

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <!-- Permissions for call foreground services -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />

    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

    <application>
        <activity
            android:name=".ui.ElementCallActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
            android:exported="true"
            android:label="@string/element_call"
            android:launchMode="singleTask"
            android:supportsPictureInPicture="true"
            android:taskAffinity="id.databisnis.android.bachot.features.call">

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

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

                <data android:scheme="https" />

                <!-- Matching asset file: https://call.element.io/.well-known/assetlinks.json -->
                <data android:host="call.element.io" />
            </intent-filter>
            <!-- Custom scheme to handle urls from other domains in the format: element://call?url=https%3A%2F%2Felement.io -->
            <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="element" />
                <data android:host="call" />
            </intent-filter>
            <!-- Custom scheme to handle urls from other domains in the format: io.element.call:/?url=https%3A%2F%2Felement.io -->
            <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="io.element.call" />
            </intent-filter>

        </activity>

        <activity
            android:name=".ui.IncomingCallActivity"
            android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
            android:excludeFromRecents="true"
            android:exported="false"
            android:launchMode="singleTask"
            android:taskAffinity="id.databisnis.android.bachot.features.call" />

        <service
            android:name=".services.CallForegroundService"
            android:enabled="true"
            android:exported="false"
            android:foregroundServiceType="microphone" />

        <receiver
            android:name=".receivers.DeclineCallBroadcastReceiver"
            android:enabled="true"
            android:exported="false" />

    </application>

</manifest>
