<?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:theme="@style/Theme.PDFReaderPro"
    tools:ignore="DiscouragedApi,LockedOrientationActivity,RedundantLabel">

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

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

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

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <!-- Android 13+ 媒体权限 -->
    <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" />

    <!-- 读取所有文件权限（Android 11+ 需要特殊处理） -->
    <uses-permission
        android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
        tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <application
        android:name=".PRApp"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/net"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.PDFReaderPro">
        <!--正式ID ca-app-pub-5717753826607607~1850604454 -->
        <!--google测试ID ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-5717753826607607~1850604454" />
        <meta-data
            android:name="android.max_aspect"
            android:value="2.4" />
        <!--适配华为（huawei）刘海屏-->
        <meta-data
            android:name="android.notch_support"
            android:value="true" />
        <!--适配小米（xiaomi）刘海屏-->
        <meta-data
            android:name="notch.config"
            android:value="portrait|landscape" />

        <activity
            android:name=".ui.act.SplashActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.PDFReaderPro">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.act.MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.PDFReaderPro" />

        <activity
            android:name=".ui.act.PdfViewActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.PDFReaderPro">
            <!-- 处理PDF文件打开 -->
            <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/pdf" />
                <data android:scheme="file" />
                <data android:scheme="content" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.act.SplitPdfActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.PdfResultActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.SearchActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.PdfPickerActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.MergePdfActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.PdfToImageActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.FAQActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.PrivacyPolicyActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <activity
            android:name=".ui.act.PictureSelectorActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
    </application>
    <queries package="${applicationId}">
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE">

            </action>
        </intent>
        <intent>
            <action android:name="android.media.action.ACTION_VIDEO_CAPTURE">

            </action>
        </intent>
    </queries>
</manifest>