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

    <!-- 前台服务权限 -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>

    <!-- 系统事件权限 -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    <!-- 通知权限 -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

    <!-- 应用统计与查询权限 -->
    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>
    <uses-permission
        android:name="android.permission.ACCESS_PACKAGE_USAGE_STATS"
        tools:ignore="ProtectedPermissions"/>
    <uses-permission
        android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission"/>

    <!-- 电池与存储统计权限 -->
    <uses-permission android:name="android.permission.BATTERY_STATS"/>
    <uses-permission android:name="android.permission.GET_PACKAGE_SIZE"/>
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

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

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

    <!-- 硬件特性声明 -->
    <uses-feature
        android:name="android.hardware.camera"
        android:required="false"/>
    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false"/>

    <!-- 应用查询 -->
    <queries>
        <package android:name="com.miui.securitycenter"/>
    </queries>

    <application
        android:name=".App"
		android:process=":main"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme_Default"
        android:persistent="true"
        android:resizeableActivity="true"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true"
        tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">

        <!-- 主活动（主进程） -->
        <activity
            android:process=":main"
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:exported="true"
            android:launchMode="singleTask"/>

        <!-- 活动别名（启动器，主进程） -->
        <activity-alias
            android:name=".MainActivityEN1"
            android:targetActivity=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:icon="@drawable/ic_launcher"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcutsmainen1"/>
        </activity-alias>

        <activity-alias
            android:name=".MainActivityCN1"
            android:targetActivity=".MainActivity"
            android:exported="true"
            android:label="@string/app_name_cn1"
            android:icon="@drawable/ic_launcher"
            android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcutsmaincn1"/>
        </activity-alias>

        <activity-alias
            android:name=".MainActivityCN2"
            android:targetActivity=".MainActivity"
            android:exported="true"
            android:label="@string/app_name_cn2"
            android:icon="@drawable/ic_launcher"
            android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcutsmaincn2"/>
        </activity-alias>

        <!-- 功能活动（主进程） -->
        <activity
            android:process=":main"
            android:name=".activities.CrashActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.ClearRecordActivity"
            android:parentActivityName="cc.winboll.studio.powerbell.MainActivity"
            android:launchMode="singleTask"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.BackgroundSettingsActivity"
            android:parentActivityName="cc.winboll.studio.powerbell.MainActivity"
            android:exported="true"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="image/jpeg"/>
                <data android:mimeType="image/jpg"/>
                <data android:mimeType="image/png"/>
                <data android:mimeType="image/webp"/>
                <data android:mimeType="image/*"/>
            </intent-filter>
        </activity>

        <activity
            android:process=":main"
            android:name=".activities.BatteryReporterActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.PixelPickerActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.BatteryReportActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".unittest.MainUnitTestActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.ShortcutActionActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name=".activities.SettingsActivity"
            android:exported="false"/>

        <activity
            android:process=":main"
            android:name="cc.winboll.studio.powerbell.unittest.MainUnitTest2Activity"
            android:exported="false"/>

        <!-- 第三方活动（主进程） -->
        <activity
            android:process=":main"
            android:name="com.yalantis.ucrop.UCropActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"
            android:exported="true"/>

        <!-- 广播接收器（主进程） -->
        <receiver
			android:process=":main"
            android:name=".receivers.MainReceiver"
            android:enabled="true"
            android:exported="true"
            android:directBootAware="true">
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <action android:name="android.intent.action.POWER_CONNECTED"/>
                <action android:name="android.intent.action.USER_PRESENT"/>
            </intent-filter>
        </receiver>

        <!-- 服务（ControlCenterService主进程，AssistantService独立进程） -->
        <service
            android:name=".services.ControlCenterService"
            android:priority="1000"
            android:enabled="true"
            android:exported="false"
            android:process=":main"
			android:stopWithTask="false"
            android:foregroundServiceType="dataSync">
            <property
                android:name="android.app.PROPERTY_SPECIAL_USE_FOREGROUND_SERVICE"
                android:value="后台核心功能运行、持续保活"/>
        </service>

        <service
            android:name=".services.AssistantService"
            android:enabled="true"
            android:exported="false"
            android:process=":assistant"
			android:stopWithTask="false"
            android:foregroundServiceType="dataSync">
            <property
                android:name="android.app.PROPERTY_SPECIAL_USE_FOREGROUND_SERVICE"
                android:value="辅助核心功能运行"/>
        </service>

        <!-- 内容提供者（主进程） -->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true"
            android:process=":main">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_provider"/>
        </provider>

        <!-- 元数据 -->
        <meta-data
            android:name="android.max_aspect"
            android:value="4.0"/>

    </application>

</manifest>

