diff --git a/packages/web_shell_core/test_assets/test_bridge.html b/packages/web_shell_core/test_assets/test_bridge.html
index 3137771..1abb74a 100644
--- a/packages/web_shell_core/test_assets/test_bridge.html
+++ b/packages/web_shell_core/test_assets/test_bridge.html
@@ -221,6 +221,13 @@
0. 设备与内核信息
+1. 环境检测
@@ -751,6 +758,77 @@ function handleFileInput(input, previewId) {
// ═══════════════════════════════════════
log('info', 'System', '测试页已加载,等待 AppShell 桥接注入…');
+// ═══════════════════════════════════════
+// 0. 设备与内核信息(自动填充)
+// ═══════════════════════════════════════
+(function populateDeviceInfo() {
+ const ua = navigator.userAgent;
+
+ // 解析 Chrome/WebView 版本
+ const chromeMatch = ua.match(/Chrome\/([\d.]+)/);
+ const chromeVersion = chromeMatch ? chromeMatch[1] : null;
+ const chromeMajor = chromeVersion ? chromeVersion.split('.')[0] : null;
+
+ // 解析 Android 版本
+ const androidMatch = ua.match(/Android\s+([\d.]+)/);
+ const androidVersion = androidMatch ? androidMatch[1] : null;
+
+ // 解析设备型号 (粗略: Android 后括号内的末尾部分)
+ const buildMatch = ua.match(/;\s*([^;)]+)\s+Build\//);
+ const deviceModel = buildMatch ? buildMatch[1].trim() : null;
+
+ // WebView 标识
+ const isWebView = /; wv\)/.test(ua) || /WebView/.test(ua);
+
+ const screen = window.screen;
+ const dpr = window.devicePixelRatio || 1;
+
+ const rows = [
+ ['🌐 WebView 内核', chromeVersion ? `Chrome/${chromeVersion}` : '未识别'],
+ ['📦 Chrome 主版本', chromeMajor || '—'],
+ ['🤖 Android 版本', androidVersion || '—'],
+ ['📱 设备型号', deviceModel || '—'],
+ ['🏷 WebView 标识', isWebView ? '✅ 内嵌 WebView (wv)' : '❌ 非 WebView'],
+ ['📐 屏幕分辨率', `${screen.width} × ${screen.height} (实际像素 ${Math.round(screen.width * dpr)} × ${Math.round(screen.height * dpr)})`],
+ ['🖥 Viewport', `${window.innerWidth} × ${window.innerHeight}`],
+ ['🔍 像素密度 (DPR)', dpr.toFixed(2)],
+ ['🌍 语言', navigator.language || '—'],
+ ['📡 在线状态', navigator.onLine ? '✅ 在线' : '❌ 离线'],
+ ];
+
+ // 可选: 内存信息 (仅 Chrome)
+ if (navigator.deviceMemory) {
+ rows.push(['💾 设备内存', navigator.deviceMemory + ' GB (近似值)']);
+ }
+ if (navigator.hardwareConcurrency) {
+ rows.push(['⚙️ CPU 核心', navigator.hardwareConcurrency + ' 核']);
+ }
+
+ let html = '
';
+ rows.forEach(([label, value]) => {
+ html += ``;
+ html += `| ${label} | `;
+ html += `${value} | `;
+ html += `
`;
+ });
+ html += '
';
+
+ // 可折叠的完整 UserAgent
+ html += `
📋 完整 UserAgent
`;
+ html += `${escapeHtml(ua)}
`;
+ html += ``;
+
+ document.getElementById('deviceInfoContent').innerHTML = html;
+
+ log('ok', 'DeviceInfo', {
+ chrome: chromeVersion || 'unknown',
+ android: androidVersion || 'unknown',
+ model: deviceModel || 'unknown',
+ isWebView,
+ screen: `${screen.width}x${screen.height}@${dpr}x`,
+ });
+})();
+
// 延迟检测 Bridge 状态
setTimeout(function() {
if (window.AppShell) {