<?xml version="1.0" encoding="utf-8"?>
<!-- 清单文件合并指引：https://developer.android.google.cn/studio/build/manifest-merge?hl=zh-cn -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.hjq.demo">

    <!-- 网络相关 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <!-- 发送通知权限（Android 13.0 新增的权限）-->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

    <!-- 读取外部存储权限 -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
    <!-- 写入外部存储权限（注意：这个权限在 targetSdk >= Android 11 并且 Android 11 及以上的设备上面不起作用，请适配分区存储特性代替权限申请）-->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="31" tools:ignore="ScopedStorage" />

    <!-- 拍照权限 -->
    <uses-permission android:name="android.permission.CAMERA" />

    <!-- 麦克风权限 -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <!-- 安装权限 -->
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

    <!-- 定位权限（用于 WebView 定位）-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <!-- Application 节点详解：https://developer.android.google.cn/guide/topics/manifest/application-element -->
    <!-- Activity 节点详解：https://developer.android.google.cn/guide/topics/manifest/activity-element -->
    <application
        android:name=".app.AppApplication"
        android:allowBackup="false"
        android:icon="@mipmap/launcher_ic"
        android:label="${app_name}"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:resizeableActivity="true"
        android:roundIcon="@mipmap/launcher_ic"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:ignore="AllowBackup,LockedOrientationActivity"
        tools:replace="android:allowBackup,android:supportsRtl"
        tools:targetApi="n">

        <!-- 表示当前已经适配了分区存储 -->
        <meta-data
            android:name="ScopedStorage"
            android:value="true" />

        <!-- 适配 Android 7.0 文件意图 -->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">

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

        <!-- 闪屏页 -->
        <activity
            android:name=".ui.activity.SplashActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:theme="@style/SplashTheme">

            <!-- 程序入口 -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.VIEW" />

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

        </activity>

        <!-- 引导页 -->
        <activity
            android:name=".ui.activity.GuideActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 首页 -->
        <activity
            android:name=".ui.activity.HomeActivity"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan" />

        <!-- 登录页 -->
        <activity
            android:name=".ui.activity.account.LoginActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

        <!-- 注册页 -->
        <activity
            android:name=".ui.activity.account.RegisterActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

        <!-- 崩溃展示（必须在独立进程） -->
        <activity
            android:name=".ui.activity.common.CrashActivity"
            android:launchMode="singleTop"
            android:process=":crash"
            android:screenOrientation="landscape" />

        <!-- 重启应用（必须在独立进程） -->
        <activity
            android:name=".ui.activity.common.RestartActivity"
            android:launchMode="singleTop"
            android:process=":restart" />

        <!-- 设置页 -->
        <activity
            android:name=".ui.activity.SettingActivity"
            android:label="@string/setting_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 忘记密码 -->
        <activity
            android:name=".ui.activity.account.PasswordForgetActivity"
            android:label="@string/password_forget_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

        <!-- 重置密码 -->
        <activity
            android:name=".ui.activity.account.PasswordResetActivity"
            android:label="@string/password_reset_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

        <!-- 更换手机 -->
        <activity
            android:name=".ui.activity.account.PhoneResetActivity"
            android:label="@string/phone_reset_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

        <!-- 关于我们 -->
        <activity
            android:name=".ui.activity.AboutActivity"
            android:label="@string/about_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 个人资料 -->
        <activity
            android:name=".ui.activity.account.PersonalDataActivity"
            android:label="@string/personal_data_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 网页浏览 -->
        <activity
            android:name=".ui.activity.common.BrowserActivity"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:label="@string/web_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 拍照选择 -->
        <activity
            android:name=".ui.activity.common.CameraActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 图片选择 -->
        <activity
            android:name=".ui.activity.common.ImageSelectActivity"
            android:label="@string/image_select_title"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 查看大图 -->
        <activity
            android:name=".ui.activity.common.ImagePreviewActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 播放视频（自适应方向） -->
        <activity
            android:name=".ui.activity.common.VideoPlayActivity"
            android:launchMode="singleTop"
            android:theme="@style/FullScreenTheme" />

        <!-- 播放视频（竖屏方向） -->
        <activity
            android:name=".ui.activity.common.VideoPlayActivity$Portrait"
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:theme="@style/FullScreenTheme" />

        <!-- 播放视频（横屏方向） -->
        <activity
            android:name=".ui.activity.common.VideoPlayActivity$Landscape"
            android:launchMode="singleTop"
            android:screenOrientation="landscape"
            android:theme="@style/FullScreenTheme" />

        <!-- 选择视频 -->
        <activity
            android:name=".ui.activity.common.VideoSelectActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 对话框案例 -->
        <activity
            android:name=".ui.activity.DialogActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

        <!-- 状态案例 -->
        <activity
            android:name=".ui.activity.StatusActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" />

    </application>

    <!-- Android 11 软件包可见性适配：https://www.jianshu.com/p/d1ccd425c4ce -->
    <queries>
        <!-- 拍照意图：MediaStore.ACTION_IMAGE_CAPTURE -->
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>

        <!-- 拍摄意图：MediaStore.ACTION_VIDEO_CAPTURE -->
        <intent>
            <action android:name="android.media.action.VIDEO_CAPTURE" />
        </intent>

        <!-- 图片裁剪意图 -->
        <intent>
            <action android:name="com.android.camera.action.CROP" />
        </intent>

        <!-- 打电话意图：Intent.ACTION_DIAL -->
        <intent>
            <action android:name="android.intent.action.DIAL" />
        </intent>

        <!-- 调起分享意图：Intent.ACTION_SEND -->
        <intent>
            <action android:name="android.intent.action.SEND" />
        </intent>

        <!-- 调起其他页面意图：Intent.ACTION_VIEW -->
        <intent>
            <action android:name="android.intent.action.VIEW" />
        </intent>

        <!-- 调起系统文件选择器：Intent.ACTION_GET_CONTENT -->
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
        </intent>
    </queries>

</manifest>