|
|
°²×¿½Å±¾app·½·¨¼òµ¥Ê¾Àý
- /**
- * AIWROK app·½·¨¼òµ¥Ê¾Àý
- * ÑÝʾ³£ÓõÄÓ¦ÓùÜÀí¹¦ÄÜ
- * ½»Á÷QQȺ: 711841924 (Ⱥһ) / 528816639 (Æ»¹û½Å±¾ÄÚ²âȺ)
- */
- printl("=== AIWROK app·½·¨¼òµ¥Ê¾Àý ===");
- printl("");
- sleep.second(2);
- // 1. »ñÈ¡µ±Ç°ActivityÐÅÏ¢
- printl("¡¾1¡¿»ñÈ¡µ±Ç°Activity:");
- var currentActivity = app.getCurrentActivity();
- printl("µ±Ç°Activity: " + currentActivity);
- printl("");
- sleep.second(2);
- // 2. »ñÈ¡¶¥¶ËÓ¦ÓðüÃû
- printl("¡¾2¡¿»ñÈ¡¶¥¶ËÓ¦ÓðüÃû:");
- var topPackName = app.getTopPackName();
- printl("¶¥¶ËÓ¦ÓðüÃû: " + topPackName);
- printl("");
- sleep.second(2);
- // 3. »ñȡӦÓÃÃû³ÆºÍ°æ±¾ÐÅÏ¢
- printl("¡¾3¡¿»ñȡӦÓÃÐÅÏ¢:");
- if (topPackName) {
- var appName = app.getAppName(topPackName);
- var verName = app.getVerName(topPackName);
- var versionCode = app.getVersionCode(topPackName);
-
- printl("Ó¦ÓÃÃû³Æ: " + appName);
- printl("°æ±¾Ãû³Æ: " + verName);
- printl("°æ±¾ºÅ: " + versionCode);
- }
- printl("");
- sleep.second(2);
- // 4. »ñÈ¡ÄÚ´æÐÅÏ¢
- printl("¡¾4¡¿»ñÈ¡ÄÚ´æÐÅÏ¢:");
- var memoryInfo = app.getMemory();
- if (memoryInfo) {
- try {
- // AIWROK·µ»ØµÄÊÇJSON×Ö·û´®£¬Ê¹ÓÃÕýÔò±í´ïʽÌáȡֵ
- var totalMatch = memoryInfo.match(/"Total":(\d+)/);
- var availableMatch = memoryInfo.match(/"Available":(\d+)/);
- var usedMatch = memoryInfo.match(/"Used":(\d+)/);
- var appMatch = memoryInfo.match(/"app":(\d+)/);
-
- if (totalMatch && availableMatch && usedMatch && appMatch) {
- printl("×ÜÄÚ´æ: " + totalMatch[1] + " MB");
- printl("¿ÉÓÃÄÚ´æ: " + availableMatch[1] + " MB");
- printl("ÒÑÓÃÄÚ´æ: " + usedMatch[1] + " MB");
- printl("Ó¦ÓÃÕ¼ÓÃ: " + appMatch[1] + " MB");
- } else {
- printl("ÎÞ·¨½âÎöÄÚ´æÊý¾Ý");
- }
- } catch (e) {
- printl("ÄÚ´æÐÅÏ¢´¦Àíʧ°Ü: " + e.message);
- }
- } else {
- printl("ÎÞ·¨»ñÈ¡ÄÚ´æÐÅÏ¢£¨¿ÉÄÜÐèÒªAIWORK´ò°üµÄAPK£©");
- }
- printl("");
- sleep.second(2);
- // 5. »ñÈ¡ÄÚ´æÊ¹ÓðٷֱÈ
- printl("¡¾5¡¿ÄÚ´æÊ¹ÓðٷֱÈ:");
- var memoryPercent = app.getMemoryPercent();
- printl("ÄÚ´æÊ¹ÓÃÂÊ: " + memoryPercent + "%");
- printl("");
- sleep.second(2);
- // 6. »ñÈ¡ËùÓÐÓ¦ÓÃÁÐ±í£¨Ö»ÏÔʾǰ5¸ö£©
- printl("¡¾6¡¿Ó¦ÓÃÁÐ±í£¨Ç°5¸ö£©:");
- var allApps = app.getAllApp();
- if (allApps) {
- try {
- printl("Êý¾ÝÀàÐÍ: " + typeof allApps);
-
- // AIWROK¿ÉÄÜ·µ»Ø×Ö·û´®»ò¶ÔÏó
- if (typeof allApps === 'string') {
- // Èç¹ûÊÇ×Ö·û´®£¬Ê¹ÓÃÕýÔò±í´ïʽƥÅä
- var appPattern = /\{"package":"([^"]+)","appName":"([^"]+)"\}/g;
- var match;
- var count = 0;
-
- while ((match = appPattern.exec(allApps)) !== null && count < 5) {
- count++;
- printl(" " + count + ". " + match[2] + " (" + match[1] + ")");
- }
-
- // ͳ¼Æ×ÜÊý
- var allMatches = allApps.match(appPattern);
- if (allMatches && allMatches.length > 5) {
- printl(" ... ¹² " + allMatches.length + " ¸öÓ¦ÓÃ");
- }
- } else if (Array.isArray(allApps)) {
- // Èç¹ûÖ±½ÓÊÇÊý×é
- var showCount = Math.min(5, allApps.length);
- for (var i = 0; i < showCount; i++) {
- var appItem = allApps[i];
- if (typeof appItem === 'object') {
- printl(" " + (i + 1) + ". " + appItem.appName + " (" + appItem.package + ")");
- } else {
- printl(" " + (i + 1) + ". " + appItem);
- }
- }
- if (allApps.length > 5) {
- printl(" ... ¹² " + allApps.length + " ¸öÓ¦ÓÃ");
- }
- } else {
- // ³¢ÊÔת»»Îª×Ö·û´®ÔÙ´¦Àí
- var appsStr = String(allApps);
- printl("ת»»ºó: " + appsStr.substring(0, 200));
-
- var appPattern = /\{"package":"([^"]+)","appName":"([^"]+)"\}/g;
- var match;
- var count = 0;
-
- while ((match = appPattern.exec(appsStr)) !== null && count < 5) {
- count++;
- printl(" " + count + ". " + match[2] + " (" + match[1] + ")");
- }
- }
- } catch (e) {
- printl("Ó¦ÓÃÁÐ±í´¦Àíʧ°Ü: " + e.message);
- }
- } else {
- printl("δ»ñÈ¡µ½Ó¦ÓÃÁбí");
- }
- printl("");
- sleep.second(2);
- // 7. »ñÈ¡ÔËÐнø³ÌÐÅÏ¢
- printl("¡¾7¡¿ÔËÐнø³ÌÐÅÏ¢:");
- var processes = app.logRunningProcesses();
- if (processes) {
- try {
- printl("Êý¾ÝÀàÐÍ: " + typeof processes);
-
- // AIWROK¿ÉÄÜ·µ»Ø×Ö·û´®»ò¶ÔÏó
- if (typeof processes === 'string') {
- // Èç¹ûÊÇ×Ö·û´®£¬Ê¹ÓÃÕýÔò±í´ïʽÌáÈ¡
- var procPattern = /\{"pid":(\d+),"processName":"([^"]+)"/g;
- var match;
- var procList = [];
-
- while ((match = procPattern.exec(processes)) !== null) {
- procList.push({pid: match[1], name: match[2]});
- }
-
- if (procList.length > 0) {
- printl("ÔËÐÐÖеĽø³ÌÊý: " + procList.length);
- var showCount = Math.min(5, procList.length);
- for (var i = 0; i < showCount; i++) {
- printl(" " + (i + 1) + ". PID: " + procList[i].pid + " | " + procList[i].name);
- }
- if (procList.length > 5) {
- printl(" ... »¹ÓÐ " + (procList.length - 5) + " ¸ö½ø³Ì");
- }
- } else {
- printl("δÕÒµ½½ø³ÌÐÅÏ¢");
- }
- } else {
- // ³¢ÊÔת»»Îª×Ö·û´®ÔÙ´¦Àí
- var procStr = String(processes);
- printl("ת»»ºó: " + procStr.substring(0, 200));
-
- var procPattern = /\{"pid":(\d+),"processName":"([^"]+)"/g;
- var match;
- var procList = [];
-
- while ((match = procPattern.exec(procStr)) !== null) {
- procList.push({pid: match[1], name: match[2]});
- }
-
- if (procList.length > 0) {
- printl("ÔËÐÐÖеĽø³ÌÊý: " + procList.length);
- var showCount = Math.min(5, procList.length);
- for (var i = 0; i < showCount; i++) {
- printl(" " + (i + 1) + ". PID: " + procList[i].pid + " | " + procList[i].name);
- }
- if (procList.length > 5) {
- printl(" ... »¹ÓÐ " + (procList.length - 5) + " ¸ö½ø³Ì");
- }
- } else {
- printl("δÕÒµ½½ø³ÌÐÅÏ¢");
- }
- }
- } catch (e) {
- printl("½ø³ÌÐÅÏ¢´¦Àíʧ°Ü: " + e.message);
- }
- } else {
- printl("δ»ñÈ¡µ½½ø³ÌÐÅÏ¢");
- }
- printl("");
- sleep.second(2);
- printl("=== ʾÀýÖ´ÐÐÍê³É ===");
¸´ÖÆ´úÂë
|
|