<!--
  ~ Nextcloud Talk - Android Client
  ~
  ~ SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  ~ SPDX-FileCopyrightText: 2021-2023 Marcel Hibbe <dev@mhibbe.de>
  ~ SPDX-FileCopyrightText: 2017-2019 Mario Danic <mario@lovelyhq.com>
  ~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission
        android:name="android.permission.BLUETOOTH"
        android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission
        android:name="android.permission.GET_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />

    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />

    <uses-permission
        android:name="android.permission.USE_CREDENTIALS"
        android:maxSdkVersion="22" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="29"
        tools:ignore="ScopedStorage" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

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

    <uses-permission android:name="android.permission.USE_BIOMETRIC" />
    <!-- This permission is deprecated in Android P  -->
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />

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

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

    <permission
        android:name="${applicationId}.${broadcastPermission}"
        android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.${broadcastPermission}" />

    <application
        android:name=".application.NextcloudTalkApplication"
        android:allowBackup="true"
        android:fullBackupContent="@xml/backup_config"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/nc_app_name"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.Launcher"
        android:taskAffinity=""
        tools:ignore="UnusedAttribute"
        tools:replace="label, icon, theme, name, allowBackup">

        <meta-data
            android:name="android.max_aspect"
            android:value="10" />

        <activity
            android:name=".activities.MainActivity"
            android:exported="true"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <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" />

                <data android:mimeType="vnd.android.cursor.item/vnd.com.nextcloud.talk2.chat" />
                <data android:scheme="content" />
                <data android:scheme="file" />
            </intent-filter>
        </activity>

        <activity
            android:name=".account.ServerSelectionActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".account.WebViewLoginActivity"
            android:theme="@style/AppTheme" />

        <activity android:name=".contacts.ContactsActivityCompose"
            android:theme="@style/AppTheme"/>

        <activity android:name=".conversationcreation.ConversationCreationActivity"
            android:theme="@style/AppTheme"/>

        <activity
            android:name=".account.AccountVerificationActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".account.SwitchAccountActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".conversationlist.ConversationsListActivity"
            android:exported="true"
            android:theme="@style/AppTheme">

            <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=".chat.ChatActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".activities.CallActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:excludeFromRecents="true"
            android:launchMode="singleTask"
            android:showOnLockScreen="true"
            android:supportsPictureInPicture="true"
            android:taskAffinity=".call"
            android:theme="@style/AppTheme.CallLauncher" />

        <activity
            android:name=".callnotification.CallNotificationActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:excludeFromRecents="true"
            android:launchMode="singleTask"
            android:showOnLockScreen="true"
            android:supportsPictureInPicture="true"
            android:taskAffinity=".call"
            android:theme="@style/AppTheme.CallLauncher" />

        <activity
            android:name=".fullscreenfile.FullScreenImageActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:theme="@style/FullScreenImageTheme" />

        <activity
            android:name=".fullscreenfile.FullScreenMediaActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:theme="@style/FullScreenMediaTheme" />

        <activity
            android:name=".fullscreenfile.FullScreenTextViewerActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:theme="@style/FullScreenTextTheme" />

        <activity
            android:name=".activities.TakePhotoActivity"
            android:theme="@style/TakePhotoTheme"
            android:windowSoftInputMode="stateHidden" />

        <activity
            android:name=".shareditems.activities.SharedItemsActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".remotefilebrowser.activities.RemoteFileBrowserActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".messagesearch.MessageSearchActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".location.LocationPickerActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".location.GeocodingActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".translate.ui.TranslateActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".profile.ProfileActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".settings.SettingsActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".diagnose.DiagnoseActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".conversationinfo.ConversationInfoActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".conversationinfoedit.ConversationInfoEditActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".contacts.ContactsActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".openconversations.ListOpenConversationsActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".invitation.InvitationsActivity"
            android:theme="@style/AppTheme" />

        <activity
            android:name=".lock.LockedActivity"
            android:theme="@style/AppTheme" />

        <receiver
            android:name=".receivers.PackageReplacedReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>

        <receiver android:name=".receivers.DirectReplyReceiver" />
        <receiver android:name=".receivers.MarkAsReadReceiver" />
        <receiver android:name=".receivers.DismissRecordingAvailableReceiver" />
        <receiver android:name=".receivers.ShareRecordingToChatReceiver" />

        <service
            android:name=".utils.SyncService"
            android:exported="true">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/syncadapter" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

        <service
            android:name=".utils.AuthenticatorService"
            android:exported="false">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/auth" />
        </service>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}"
            android:exported="false"
            android:grantUriPermissions="true">

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

        </provider>

    </application>

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:mimeType="*/*" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="*/*" />
        </intent>
        <intent>
            <action android:name="android.media.action.VIDEO_CAPTURE" />
        </intent>
    </queries>

</manifest>
