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

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

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="*" />
        </intent>
    </queries>

    <application
        android:name=".App"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/full_backup_content"
        android:icon="@mipmap/ic_launcher"
        android:resizeableActivity="false"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.App"
        android:enableOnBackInvokedCallback="true"
        android:memtagMode="async"
        tools:ignore="UnusedAttribute">

        <activity
            android:name=".ui.activities.AboutLemenzoCamera"
            android:exported="false"
            android:theme="@style/Theme.App" />

        <!-- The main activity of the app (supports all modes) -->
        <activity
            android:name=".ui.activities.MainActivity"
            android:taskAffinity=".ui.activities.MainActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:exported="true"
            android:theme="@style/Theme.Camera"
            tools:ignore="DiscouragedApi">

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

        </activity>

        <!-- Helps in supporting double-tap power button (in non-secure/unlocked phone state) -->
        <activity-alias
            android:name=".ui.activities.CameraLauncher"
            android:label="@string/app_name"
            android:targetActivity=".ui.activities.MainActivity"
            android:exported="true">

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

        </activity-alias>

        <!-- The main activity of the app (supports all modes) -->
        <activity
            android:name=".ui.activities.SecureMainActivity"
            android:taskAffinity=".ui.activities.SecureMainActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:showWhenLocked="true"
            android:excludeFromRecents="true"
            android:exported="true"
            android:theme="@style/Theme.Camera"
            tools:ignore="DiscouragedApi">

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

        </activity>

        <!-- An extension of the MainActivity that completely enforces video mode
        https://developer.android.com/reference/android/provider/MediaStore#INTENT_ACTION_VIDEO_CAMERA
        -->
        <activity
            android:name=".ui.activities.VideoOnlyActivity"
            android:taskAffinity=".ui.activities.VideoOnlyActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:exported="true"
            tools:ignore="DiscouragedApi">

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

        </activity>


        <!-- Capture image that shall be sent to another app
        https://developer.android.com/reference/android/provider/MediaStore#ACTION_IMAGE_CAPTURE
        -->
        <activity
            android:name=".ui.activities.CaptureActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:visibleToInstantApps="true"
            android:exported="true"
            tools:ignore="DiscouragedApi">

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

        </activity>

        <!-- Capture image to be sent to another app (when the phone is in secure/locked state)
         https://developer.android.com/reference/android/provider/MediaStore#ACTION_IMAGE_CAPTURE_SECURE
         -->
        <activity
            android:name=".ui.activities.SecureCaptureActivity"
            android:taskAffinity=".ui.activities.SecureCaptureActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:showWhenLocked="true"
            android:excludeFromRecents="true"
            android:exported="true"
            tools:ignore="DiscouragedApi">

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

        </activity>

        <!-- Deals with VideoCapture intent; To record a video to be sent to another app
        https://developer.android.com/reference/android/provider/MediaStore#ACTION_VIDEO_CAPTURE
             (No secure video capture intent is present/defined in Android)-->
        <activity
            android:name=".ui.activities.VideoCaptureActivity"
            android:taskAffinity=".ui.activities.VideoCaptureActivity"
            android:label="@string/video_capture_label"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
            android:screenOrientation="nosensor"
            android:visibleToInstantApps="true"
            android:exported="true"
            tools:ignore="DiscouragedApi">

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

        </activity>

        <activity
            android:name=".ui.activities.VideoPlayer"
            android:theme="@style/Theme.Viewer"
            android:taskAffinity=".ui.activities.VideoPlayer"
            android:excludeFromRecents="true"
            android:exported="false"/>

        <activity
            android:name=".ui.activities.InAppGallery"
            android:theme="@style/Theme.Viewer"
            android:taskAffinity=".ui.activities.InAppGallery"
            android:excludeFromRecents="true"
            android:exported="false"/>

        <activity
            android:name=".ui.activities.MoreSettings"
            android:theme="@style/Theme.App"
            android:taskAffinity=".ui.activities.InAppGallery"
            android:excludeFromRecents="true"
            android:windowSoftInputMode="adjustResize"
            android:exported="false"/>

        <activity
            android:name=".ui.activities.MoreSettingsSecure"
            android:theme="@style/Theme.App"
            android:taskAffinity=".ui.activities.InAppGallery"
            android:excludeFromRecents="true"
            android:showWhenLocked="true"
            android:exported="false"/>

        <activity
            android:name=".ui.activities.QrTile"
            android:exported="true"
            android:showWhenLocked="true"
            android:screenOrientation="nosensor"
            android:excludeFromRecents="true"
            tools:ignore="DiscouragedApi" />

    </application>

</manifest>
