初始提交:浩瑞(HaoRui)头条自动化工程
- app/:Kotlin 全部源码、AndroidManifest 与资源 - docs/:技术文档、UI 原型、回归清单 - img/:文档引用的对照规格截图 - scripts/:环境加载与回归统计脚本 - 构建配置:Gradle 入口脚本与属性 - 新增 .gitignore:排除工具链、构建缓存、临时产物与本机配置 Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
浩瑞(HaoRui)· 应用清单
|
||||
对照原产品:com.ss.android.article.news 18.3.0(锁定)
|
||||
权限随阶段推进逐步声明,本阶段仅建骨架
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!--
|
||||
Android 11+ (API 30) 包可见性过滤:
|
||||
不声明 queries 则 getPackageInfo() 抛 NameNotFoundException,
|
||||
导致版本门控恒为 false。原产品的 Manifest 同样有此声明。
|
||||
-->
|
||||
<queries>
|
||||
<package android:name="com.ss.android.article.news" />
|
||||
<package android:name="com.baidu.searchbox" />
|
||||
<package android:name="com.android.gallery3d" />
|
||||
</queries>
|
||||
|
||||
<!--
|
||||
前台服务保活(2026-10-29 根因修复):
|
||||
真机实测浩瑞切后台后被 Android Cached App Freezer 冻结整个进程
|
||||
(cgroup freezer:/frozen),车道/心跳/日志全部停止。
|
||||
用前台服务把进程拉到 FOREGROUND 优先级即可豁免冻结。
|
||||
对照原产品 TaskService 的同款做法(startForeground(7, notif, 1))。
|
||||
|
||||
⚠️ 类型必须双声明:
|
||||
- dataSync 从 API 29 起有效,vivo/Android 12 等旧机型认它(原产品用的就是这个)
|
||||
- specialUse 从 API 34 才引入,且无 6 小时时长限制(Android 15 对 dataSync 有 6h 上限)
|
||||
运行时按 SDK 选,见 KeepAliveService。
|
||||
-->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<!-- Android 13+ 通知运行时权限(仅影响通知可见性,不影响前台化生效) -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.HaoRui">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 无障碍自动化服务(阶段 2) -->
|
||||
<service
|
||||
android:name=".automation.HaoRuiAccessibilityService"
|
||||
android:exported="true"
|
||||
android:label="@string/a11y_label"
|
||||
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>
|
||||
|
||||
<!--
|
||||
进程保活前台服务(2026-10-29 根因修复)。
|
||||
双类型声明:
|
||||
dataSync —— API 29+ 有效,旧机型(含本测试机 vivo/Android 12)认它
|
||||
specialUse —— API 34+ 才引入,但无 6 小时时长限制(Android 15 对 dataSync 有 6h 上限)
|
||||
运行时按 Build.VERSION.SDK_INT 二选一,见 KeepAliveService。
|
||||
-->
|
||||
<service
|
||||
android:name=".automation.KeepAliveService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync|specialUse">
|
||||
<property
|
||||
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Accessibility automation keep-alive: prevents the process from being frozen by Android Cached App Freezer while driving the target app in background." />
|
||||
</service>
|
||||
|
||||
<!--
|
||||
FileProvider:把下载的视频(file://)转成 content:// URI,
|
||||
供 ACTION_SEND 分享给头条发布器(对照原产品 ToutiaoAccessibilityService.p2())。
|
||||
⚠️ Android 7+ 禁止跨应用传 file:// URI,必须走 FileProvider。
|
||||
-->
|
||||
<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>
|
||||
|
||||
</manifest>
|
||||
Reference in New Issue
Block a user