-
Notifications
You must be signed in to change notification settings - Fork 2
/
LukeAide_v1.0.txt
1 lines (1 loc) · 46.7 KB
/
LukeAide_v1.0.txt
1
[{"name": "LukeAide","description": "打开开关后,请按一下返回键,并且应用没有显示安装完成之前,请勿退出Thanox。卢克助手:自动GPS开关,自动蓝牙开关,某枪战游戏高帧率,智能性能与帧率,手电筒防误触,强制横屏","priority": 1,"condition": "String version = \"v1.0\";String appName = \"LukeAide\";String author = \"LuckyLuke\";String appEnglishName = \"LukeAide\";String downloadPath = \"/storage/emulated/0/Download/luke\";String rootThanox = \"thanox/profile/\";String projectLuke = \"/storage/emulated/0/Android/luke/\";String pkgThanox = \"thanox/profile/luke/\" + appEnglishName + \"/\";String msgPath = pkgThanox + \"/message/\";String orderPath = pkgThanox + \"/order/\";String moduleLuke = \"/storage/emulated/0/Android/luke/\" + appEnglishName + \"/\";String pkgLuke = moduleLuke + \"/app/\";String dataPath = pkgLuke + \"/data/\";String excutePath = pkgLuke + \"/excute/\";String servicePath = pkgLuke + \"/service/\";long currentTimeSec = System.currentTimeMillis() / 1000;long readActivate = 0;long readFirstCode = 0;int autoLet = 0;io.write(msgPath + \"/creat.ini\", 0);io.write(orderPath + \"/creat.ini\", 0);if (io.read(msgPath + \"/firstUserTime.ini\") == null) {io.write(msgPath + \"/firstUserTime.ini\", System.currentTimeMillis() / 1000);}if (!thanos.ProfileManager.isShellSuSupportInstalled()) {thanos.ProfileManager.setShellSuSupportInstalled(true);ui.showShortToast(\"请勿退出thanox,正在开启root权限...\");ui.showShortToast(\"若发现应用无法使用,请重启手机...\");thanos.getProfileManager().disableRuleByName(appName);Thread.sleep(3000);thanos.getProfileManager().enableRuleByName(appName);log.log(\"打开su开关\");}if (notificationAdded && notificationTitle.equals(\"卢克助手更新\")) {log.log(\"进入卢克助手更新\");ui.cancelNotification(\"卢克助手更新\");long nowTime = System.currentTimeMillis() / 1000;String updateShCoolingTimeIni = io.read(msgPath + \"/updateShCoolingTime.ini\");if (updateShCoolingTimeIni == null) {io.write(msgPath + \"/updateShCoolingTime.ini\", \"0\");}if (nowTime - Long.parseLong(io.read(msgPath + \"/updateShCoolingTime.ini\")) > 60 * 5) {log.log(\"经过冷却时间后进入版本更新\");io.write(msgPath + \"/updateShCoolingTime.ini\", System.currentTimeMillis() / 1000);String updataJsonVersion = io.read(msgPath + \"installResults.ini\");log.log(\"获取updataJsonVersion\" + updataJsonVersion);String pathStr = \"thanox/profile/\" + appName + \"_\" + updataJsonVersion + \".txt\";log.log(\"获取json名字\" + pathStr);su.exe(\"sh \" + servicePath + \"/cpJson.sh\");su.exe(\"sh \" + servicePath + \"/isRightThanox.sh\");if (io.read(msgPath + \"/isRightThanox.ini\").equals(\"true\")) {log.log(\"是正确的thanox版本\");io.write(msgPath + \"/byname.ini\", thanos.getProfileManager().getRuleByName(appName));Thread.sleep(1500);su.exe(\"sh \" + servicePath + \"/json.sh\");Thread.sleep(200);int nameJsonId = Integer.parseInt(io.read(msgPath + \"/nameId.ini\"));log.log(\"获取更新json的id:\" + nameJsonId);thanos.getProfileManager().disableRuleByName(appName);ui.showShortToast(\"情景模式应用: < \" + appName + \" > 正在更新\");thanos.getProfileManager().updateRule(nameJsonId, io.read(pathStr), 0);ui.showShortToast(\"更新成功,正在重新打开\");ui.cancelNotification(\"卢克助手更新\");Thread.sleep(4000);activity.launchMainActivityForPackage(\"github.tornaco.android.thanos\");thanos.getProfileManager().enableRuleByName(appName);log.log(\"更新json完成\");} else {Thread.sleep(1000 * 60);log.log(\"等待thanox下载完成\");su.exe(\"sh \" + servicePath + \"/isRightThanox.sh\");if (!io.read(msgPath + \"/isRightThanox.ini\").equals(\"true\")) {log.log(\"错误的thanox版本\");ui.showShortToast(io.read(msgPath + \"/isRightThanox.ini\"));ui.showNotification(\"卢克助手安装\", \"卢克助手需要手动安装\", \"您的thanox版本暂时不支持自动更新卢克助手,您需要在情景模式点击右上方三个点,然后找到'选择文件导入',找到'/sdcard/Download/luke/\" + appName + \"_\" + updataJsonVersion + \".txt',然后选择导入\", false);}}}log.log(\"卢克助手更新运行结束\");}if (frontPkgChanged && from == \"github.tornaco.android.thanos\") {log.log(\"thanox合适版本的升级和安装\");String read = io.read(msgPath + \"/activation.txt\");String updateShCoolingTimeIni = io.read(msgPath + \"/updateShCoolingTime.ini\");if (updateShCoolingTimeIni == null) {io.write(msgPath + \"/updateShCoolingTime.ini\", \"0\");}long nowTime = System.currentTimeMillis() / 1000;if (nowTime - Long.parseLong(io.read(msgPath + \"/updateShCoolingTime.ini\")) > 60 * 60 * 24) {if (read.equals(\"true\")) {ui.showShortToast(\"正在更新到合适版本的thanox\");su.exe(\"sh \" + servicePath + \"/isRightThanox.sh\");log.log(\"合适版本thanox正在下载和安装\");}}log.log(\"thanox合适版本的升级和安装运行结束\");}if (activityResumed && pkgName == \"github.tornaco.android.thanos\") {log.log(\"初始化应用\");if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"卢克激活秘钥\")) {thanos.profileManager.addGlobalRuleVar(\"卢克激活秘钥\", new String[]{\"把我删了,然后输入秘钥\"});io.write(msgPath + \"/activation.txt\", \"false\");log.log(\"卢克助手激活密钥变量创建\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"卢克助手序列号\")) {String serial = su.exe(\"getprop ro.serialno\");int leftIndex = serial.indexOf(\"[\");int rightIndex = serial.indexOf(\"]\");serial = serial.substring(leftIndex + 1, rightIndex - 4);thanos.profileManager.addGlobalRuleVar(\"卢克助手序列号\", new String[]{\"您的卢克助手序列号是:\" + serial, \"请编辑邮箱主题:卢克助手\" + serial + \",并将含有转账单号或者商品编号的付款截图发于邮箱[email protected]获取激活码,获取激活码之后,把激活码填入全局变量'卢克激活秘钥'里面,然后重新打开卢克助手即可激活使用\"});log.log(\"卢克助手序列号提示\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"性能优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"性能优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"性能优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"均衡优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"均衡优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"均衡优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"省电优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"省电优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"省电优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"高帧率优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"高帧率优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"高帧率优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"低帧率优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"低帧率优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"低帧率优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"中等帧率优先应用\")) {thanos.profileManager.addGlobalRuleVar(\"中等帧率优先应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"中等帧率优先应用\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"beforeCpuFps\")) {thanos.profileManager.addGlobalRuleVar(\"beforeCpuFps\", new String[]{\"-1\", \"-1\"});log.log(\"beforeCpuFps,新建-1-1\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"需要后台开启GPS的应用\")) {thanos.profileManager.addGlobalRuleVar(\"需要后台开启GPS的应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"需要后台开启GPS的应用,不为空\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"和平精英设置\")) {String[] gameFps = new String[5];gameFps[0] = \"恢复游戏初始值,值设为1\";gameFps[1] = \"恢复情景模式默认值,值设为2\";gameFps[2] = \"默认最高帧率运行,值设为3\";gameFps[3] = \"手动修改配置,值设为4\";gameFps[4] = \"3\";thanos.profileManager.addGlobalRuleVar(\"和平精英设置\", gameFps);log.log(\"和平精英设置,不为空,默认启用高帧率\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"强制横屏应用\")) {thanos.profileManager.addGlobalRuleVar(\"强制横屏应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"强制横屏应用,不为空\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"卢克助手设置\")) {thanos.profileManager.addGlobalRuleVar(\"卢克助手设置\", new String[]{\"小米手机手电筒防误触开始时间:6:20\", \"小米手机手电筒防误触结束时间:18:10\", \"gps组件快捷添加:否\"});log.log(\"卢克助手设置,不为空\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"蓝牙应用\")) {thanos.profileManager.addGlobalRuleVar(\"蓝牙应用\", new String[]{\"点击右上角三个点可以添加应用\"});log.log(\"添加蓝牙应用变量,不为空\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"耳机状态\")) {String[] btStates = new String[3];btStates[0] = String.valueOf(System.currentTimeMillis());btStates[1] = \"false\";btStates[2] = \"out\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);log.log(\"没有检测到耳机状态,正在添加\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"Wifi状态\")) {hw.disableWifi();Thread.sleep(200);hw.enableWifi();log.log(\"没有检测到wifi状态变量,重新启动wifi\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"卢克开关\")) {String[] initRuleVarArr = new String[10];initRuleVarArr[0] = appName;initRuleVarArr[1] = \"init\";initRuleVarArr[2] = \"是否开启游戏帧率控制:是\";initRuleVarArr[3] = \"是否开启自动gps:是\";initRuleVarArr[4] = \"是否开启自动蓝牙:是\";initRuleVarArr[5] = \"是否开启自动性能与帧率:是\";initRuleVarArr[6] = \"是否开启小米手机手电筒实体按键防误触:是\";initRuleVarArr[7] = \"是否开启强制横屏设置:是\";initRuleVarArr[8] = \"是否需要激活PRO:是\";initRuleVarArr[9] = \"支付宝\";thanos.profileManager.addGlobalRuleVar(\"卢克开关\", initRuleVarArr);log.log(\"创建卢克开关,不为空,版本号未写入\");ui.showShortToast(\"正在安装所需插件....\");}String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (!lukeOnOff[1].equals(\"版本:\" + version)) {activity.launchMainActivityForPackage(\"github.tornaco.android.thanos\");lukeOnOff[1] = \"版本:\" + version;int le = 0;long runTime = 0;long bgTime = 0;input.injectKey(83);le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"首次安装在没有提示'卢克助手安装成功'之前,请勿退出thanox,按音量键确定安装\", true);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {ui.cancelNotification(\"卢克助手初始化\");le = 1;}}le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"是否开启和平精英高帧率?(音量键-是,音量+否)\", false);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[2] = \"是否开启游戏帧率控制:否\";} else if (input.getLastKey() == 25) {lukeOnOff[2] = \"是否开启游戏帧率控制:是\";le = 1;}ui.cancelNotification(\"卢克助手初始化\");}}le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"是否开启自动GPS功能?(音量键-是,音量+否)\", false);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[3] = \"是否开启自动gps:否\";} else if (input.getLastKey() == 25) {lukeOnOff[3] = \"是否开启自动gps:是\";le = 1;}ui.cancelNotification(\"卢克助手初始化\");}}le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"是否开启自动蓝牙?(音量键-是,音量+否)\", false);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[4] = \"是否开启自动蓝牙:否\";} else if (input.getLastKey() == 25) {lukeOnOff[4] = \"是否开启自动蓝牙:是\";le = 1;}ui.cancelNotification(\"卢克助手初始化\");}}le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"是否开启自动性能与帧率?(音量键-是,音量+否)\", false);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[5] = \"是否开启自动性能与帧率:否\";} else if (input.getLastKey() == 25) {lukeOnOff[5] = \"是否开启自动性能与帧率:是\";le = 1;}ui.cancelNotification(\"卢克助手初始化\");}}le = 0;Thread.sleep(650);ui.showNotification(\"卢克助手初始化\", \"卢克助手设置\", \"是否开启小米手机手电筒实体按键防误触?(音量键-是,音量+否)\", false);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[6] = \"是否开启小米手机手电筒实体按键防误触:否\";} else if (input.getLastKey() == 25) {lukeOnOff[6] = \"是否开启小米手机手电筒实体按键防误触:是\";le = 1;}ui.cancelNotification(\"卢克助手初始化\");input.injectKey(83);ui.showShortToast(\"请勿退出thanox\");}}thanos.profileManager.addGlobalRuleVar(\"卢克开关\", lukeOnOff);log.log(\"卢克开关经过用户选择后,更改了全局变量\");}String shVersion = \"/version.sh\";su.exe(\"mkdir -p \" + moduleLuke);String versionsUrl = \"https://download.s21i.faiusr.com/24252024/0/0/ABUIABBEGAAgmpnHoAYoy9mswgQ.txt?f=\" + System.currentTimeMillis();String networkTxt = io.read(\"thanox/profile/network.txt\");if (networkTxt == null) {io.write(\"thanox/profile/network.txt\", \"false\");}if (io.read(\"thanox/profile/network.txt\").equals(\"true\")) {versionsUrl = \"http://116.204.83.81:8080/LuckyLukeAide/downloadServlet?filename=version.sh\";log.log(\"获取测试版的version.sh下载链接\");}if (io.read(msgPath + \"/versionTime.ini\") == null) {io.write(msgPath + \"/versionTime.ini\", \"0\");}long nowTime = System.currentTimeMillis() / 1000;long readTime = Long.parseLong(io.read(msgPath + \"/versionTime.ini\"));if (nowTime - readTime > 60 * 60) {su.exe(\"curl -L -o\" + moduleLuke + shVersion + \" --no-buffer -H 'Cache-Control:no-cache' \" + versionsUrl);io.write(msgPath + \"/versionTime.ini\", nowTime);log.log(\"下载version.sh,并把当前下载时间写入versionTime.ini\");}if (io.read(\"thanox/profile/network.txt\").equals(\"true\")) {su.exe(\"curl -L -o\" + moduleLuke + shVersion + \" --no-buffer -H 'Cache-Control:no-cache' \" + versionsUrl);log.log(\"下载version.sh,测试版每次都下载\");}su.exe(\"sh \" + moduleLuke + \"/version.sh\");String newVersion = io.read(msgPath + \"/version.ini\");log.log(\"读取最新版本newVersion为\" + newVersion);String installUrl = \"https://download.s21i.faiusr.com/24252024/0/0/ABUIABBEGAAgpMbJoAYoj9zMDg.txt?f=\" + System.currentTimeMillis();if (io.read(\"thanox/profile/network.txt\").equals(\"true\")) {installUrl = \"http://116.204.83.81:8080/LuckyLukeAide/downloadServlet?filename=install.sh&f=\" + System.currentTimeMillis();log.log(\"获取测试版的install.sh下载链接\");;}String nowShVersion = io.read(msgPath + \"/installResults.ini\");if (io.read(msgPath + \"/installResults.ini\") == null) {io.write(msgPath + \"/installResults.ini\", \"\");}if (!newVersion.equals(nowShVersion)) {su.exe(\"curl -L -o\" + moduleLuke + \"/install.sh\" + \" --no-buffer -H 'Cache-Control:no-cache' \" + installUrl);Thread.sleep(2000);su.exe(\"sh \" + moduleLuke + \"/install.sh\");log.log(\"安装shell文件,sh将把installResults.ini改成最新版本\");}nowShVersion = io.read(msgPath + \"installResults.ini\");if (!version.equals(nowShVersion)) {ui.showNotification(\"卢克助手更新\", \"卢克助手更新\", \"\", false);log.log(\"发现版本不一致,启用更新\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"卢克性能与帧率配置\")) {log.log(\"自动性能与帧率初始化\");su.exe(\"sh \" + servicePath + \"/isMagisk.sh\");if (io.read(msgPath + \"/isMagisk.ini\") == null) {io.write(msgPath + \"/isMagisk.ini\", \"\");}String[] mag = io.read(msgPath + \"/isMagisk.ini\").split(\"\n\");log.log(\"检测到的magisk的安装状态是:\" + mag[0] + \",\" + mag[1] + \",\" + mag[2]);if (!mag[0].equals(\"magisk\")) {ui.showNotification(\"fpsCpu提示\", \"您的手机未安装magisk,请安装magisk再使用,或该应用初始化未完成,需要重启手机\", \"这会导致自动性能和帧率不可用和其他问题\", true);lukeOnOff[5] = \"是否开启自动性能与帧率:否\";} else {boolean isInstallModoule = false;if (!mag[2].equals(\"uperf\") || !mag[1].equals(\"dfps\")) {int le = 0;long runTime = 0;long bgTime = 0;Thread.sleep(650);ui.showNotification(\"fpsCpu提示\", \"将在手机上安装uperf和dfps模块\", \"按音量-安装,按音量+不安装(勿离开thanox,否则安装会失败)\", true);while (le != 1 || !activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {Thread.sleep(100);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 500) {if (input.getLastKey() == 24) {lukeOnOff[5] = \"是否开启自动性能与帧率:否\";log.log(\"退出安装...\");} else if (input.getLastKey() == 25) {lukeOnOff[5] = \"是否开启自动性能与帧率:是\";su.exe(\"sh \" + servicePath + \"/installUperf.sh\");su.exe(\"sh \" + servicePath + \"/installDfps.sh\");ui.showShortToast(\"安装模块中,稍后请重启手机...\");log.log(\"安装模块中...\");isInstallModoule = true;le = 1;}ui.cancelNotification(\"fpsCpu提示\");}}}if (isInstallModoule) {ui.showNotification(\"重启手机\", \"重启手机\", \"请手动重启手机已完成模块的安装,否则自动性能与帧率会无法运行\", true);}if (mag[1].equals(\"dfps\") && mag[2].equals(\"uperf\")) {String[] gameConfig = new String[11];gameConfig[0] = \"是否显示通知:是\";gameConfig[1] = \"您手机支持的最高帧率:120\";gameConfig[2] = \"通勤时间(小时):1.5\";gameConfig[3] = \"电量权重:33\";gameConfig[4] = \"亮度权重:33\";gameConfig[5] = \"wifi权重:34\";gameConfig[6] = \"CPU线性(次方):2.7\";gameConfig[7] = \"帧率线性(次方):1.5\";gameConfig[8] = \"不能使用的帧率:0\";gameConfig[9] = \"强制最高帧率运行:否\";gameConfig[10] = \"强制最低帧率运行:否\";log.log(\"安装模块成功,新建:卢克性能与帧率配置,不为空\");ui.showShortToast(\"卢克助手:请勿关闭thanox,保持网络畅通,否则会出现错误\");thanos.profileManager.addGlobalRuleVar(\"卢克性能与帧率配置\", gameConfig);}}thanos.profileManager.addGlobalRuleVar(\"卢克开关\", lukeOnOff);log.log(\"将模块安装状态决定的是否开启自动性能与帧率写入变量卢克开关\");}if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"需要前台开启GPS的活动\")) {su.exe(\"sh \" + servicePath + \"GpsActDownload.sh\");String read = io.read(msgPath + \"/GpsAct.ini\");if (read == null) {io.write(msgPath + \"/GpsAct.ini\", \"此变量可以添加组件名,而不是应用名\");}String[] act = read.split(\"\n\");log.log(\"需要前台开启GPS的活动,从网络中下载组件数量:\" + String.valueOf(act.length));log.log(\"导入的gps前台组件为:\" + act.toString());thanos.profileManager.addGlobalRuleVar(\"需要前台开启GPS的活动\", act);ui.showShortToast(\"卢克助手安装成功\");}log.log(\"初始化应用运行结束\");}if ((activityResumed && pkgName == \"github.tornaco.android.thanos\") || screenOff || screenOn) {log.log(\"进入秘钥查询模块\");su.exe(\"sh \" + servicePath + \"/isActivateFile.sh\");log.log(\"正在判断是否有activate.ac,如果没有将会创建,并写入首次安装时间\");currentTimeSec = System.currentTimeMillis() / 1000;log.log(\"currentTimeSec:\" + currentTimeSec);readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));log.log(\"首次查询激活时间\" + readActivate);log.log(\"首次获取激活时间差:\" + String.valueOf(currentTimeSec - readActivate));if (currentTimeSec - readActivate > 259200) {log.log(\"已经首次确认没有激活\");boolean play = false;String inKey = thanos.profileManager.getGlobalRuleVarByName(\"卢克激活秘钥\")[0];su.exe(\"sh \" + excutePath + \"/findKey.sh \" + inKey);log.log(\"inkey:\" + inKey);readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (io.read(msgPath + \"/firstUserTime.ini\") == null) {io.write(msgPath + \"/firstUserTime.ini\", System.currentTimeMillis() / 1000);}readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));log.log(\"首次读取安装时间\" + readFirstCode);log.log(\"再次获取激活时间之差:\" + (currentTimeSec - readActivate));if (currentTimeSec - readActivate > 259200) {log.log(\"已经输入秘钥,但依然没有激活\");log.log(\"获取lukeonoff[8]的值:\" + lukeOnOff[8]);log.log(\"当前时间与首次创建的时间差为:\" + (currentTimeSec - readFirstCode));if (lukeOnOff[8].equals(\"是否需要激活PRO:是\") && currentTimeSec - readFirstCode <= 3600) {log.log(\"读取到 是否需要激活PRO:是\");ui.showNotification(\"卢克助手激活\", \"8元请我喝杯茶\", \"个人开发掉头发,还要租服务器.按音量键-支付,音量+试用一会\", false);ringtone.dingdingding(1);ringtone.wengwengweng(1);int le = 0;long nowTime = 0;long bgTime = 0;long initTime = System.currentTimeMillis();while (le != 1) {Thread.sleep(100);nowTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (nowTime - bgTime <= 500) {if (input.getLastKey() == 25) {input.injectKey(83);play = true;lukeOnOff[8] = \"是否需要激活PRO:已申请\";thanos.profileManager.addGlobalRuleVar(\"卢克开关\", lukeOnOff);log.log(\"读取到用户自己选择激活,设置支付变量,并设置已申请全局变量\");} else {lukeOnOff[8] = \"是否需要激活PRO:否\";thanos.profileManager.addGlobalRuleVar(\"卢克开关\", lukeOnOff);}le = 1;ui.cancelNotification(\"卢克助手激活\");}if (nowTime - initTime > 1 * 60 * 1000) {le = 1;ui.cancelNotification(\"卢克助手激活\");log.log(\"是否需要激活PRO:是,但是按键超时\");}}} else if (currentTimeSec - readFirstCode > 3600) {log.log(\"读取到用户已经过了试用期,从而跳转到激活页面\");ui.showNotification(\"卢克助手激活\", \"8元请我喝杯茶\", \"试用期已过,个人开发掉头发,还要租服务器,按音量键-支付,音量+关闭.如您要在全局变量中输入激活码,请勿划掉当前通知.\", false);ringtone.dingdingding(1);ringtone.wengwengweng(1);int le = 0;long nowTime = 0;long bgTime = 0;long initTime = System.currentTimeMillis();while (le != 1) {Thread.sleep(100);nowTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (nowTime - bgTime <= 500) {if (input.getLastKey() == 25) {le = 1;ui.cancelNotification(\"卢克助手激活\");input.injectKey(83);play = true;log.log(\"读取到用户已经过了试用期,选择了支付,将自动设置支付向量\");} else if (input.getLastKey() == 24) {le = 1;ui.cancelNotification(\"卢克助手激活\");log.log(\"读取到用户已经过了试用期,选择了不支付,将关闭卢克助手\");thanos.getProfileManager().disableRuleByName(appName);ui.showShortToast(\"卢克助手已经关闭\");}}if (nowTime - initTime > 1 * 60 * 1000) {le = 1;ui.showShortToast(\"卢克助手已经关闭\");thanos.getProfileManager().disableRuleByName(appName);log.log(\"读取到用户已经过了试用期,并没有做任何选择,超时自动关闭\");}}}if (play == true) {log.log(\"通过激活验证进入支付\");ui.showShortToast(\"请稍候几秒钟,正加载支付模块,如未能加载成功,请回到桌面后重新进入thanox...\");String title = thanos.profileManager.getGlobalRuleVarByName(\"卢克助手序列号\")[0];String msg = thanos.profileManager.getGlobalRuleVarByName(\"卢克助手序列号\")[1];ui.showNotification(\"卢克助手激活指南\", title, msg, true);su.exe(\"sh \" + servicePath + \"pay.sh\");log.log(\"正在跳转到支付宝\");Thread.sleep(6000);int le = 0;while (le == 0) {Thread.sleep(1000);if (!activity.getFrontAppPackage().equals(\"com.eg.android.AlipayGphone\")) {su.exe(\"sh \" + servicePath + \"webPay.sh\");le = 1;log.log(\"离开支付页面,跳转到网页说明\");}}lukeOnOff[8] = \"是否需要激活PRO:已申请\";ui.showShortToast(\"卢克助手已经暂时关闭,在变量'卢克激活秘钥'输入激活秘钥后重新打开\");log.log(\"是否需要激活PRO:已申请,卢克助手已经暂时关闭\");}} else {lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");ui.showShortToast(\"卢克助手已经激活\");lukeOnOff[8] = \"是否需要激活PRO:已激活\";thanos.profileManager.addGlobalRuleVar(\"卢克开关\", lukeOnOff);io.write(msgPath + \"/activation.txt\", \"true\");log.log(\"卢克助手已经激活\");}}log.log(\"秘钥查询运行结束\");}if (wifiStateChanged) {log.log(\"wifi状态发生改变\");long nowTime = System.currentTimeMillis();String[] wifiArr = new String[4];wifiArr[0] = String.valueOf(nowTime);wifiArr[1] = wifiState.enabled;wifiArr[2] = wifiState.statusLabel;wifiArr[3] = wifiState.ssid;log.log(\"尝试获取wifi状态值\");log.log(\"获取到wifi状态值\" + wifiArr.toString());if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"Wifi状态\")) {thanos.profileManager.addGlobalRuleVar(\"Wifi状态\", wifiArr);log.log(\"wifi状态不存在,创建中\");}thanos.profileManager.addGlobalRuleVar(\"Wifi状态\", wifiArr);log.log(\"更改wifi状态运行结束\");}if (frontPkgChanged) {log.log(\"已经进入自动帧率和性能\");currentTimeSec = System.currentTimeMillis() / 1000;String activateAC = io.read(msgPath + \"/activate.ac\");if (activateAC == null) {io.write(msgPath + \"/activate.ac\", \"0\");log.log(\"sh并没有创建activate.ac,程序出错\");}String firstUserTimeIni = io.read(msgPath + \"/firstUserTime.ini\");if (firstUserTimeIni == null) {io.write(msgPath + \"/firstUserTime.ini\", \"0\");log.log(\"sh并没有创建firstUserTime.ini,程序出错\");}readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (lukeOnOff[5].equals(\"是否开启自动性能与帧率:是\")) {if (currentTimeSec - readActivate <= 259200 || currentTimeSec - readFirstCode < 3600) {double wifiSource = 100;long nowTime = System.currentTimeMillis();String[] cpuFpsConfig = thanos.profileManager.getGlobalRuleVarByName(\"卢克性能与帧率配置\");String[] wifiStates = thanos.profileManager.getGlobalRuleVarByName(\"Wifi状态\");if (wifiStates[2] == null && wifiStates[3] == null) {long DValue = nowTime - Long.parseLong(wifiStates[0]);wifiSource = 100 * (1 - DValue / (Double.parseDouble(cpuFpsConfig[2].split(\":\")[1]) * 60 * 60 * 1000));log.log(\"检测到没有wifi网络,开始计算断开时间来确定wifiSource的值:\" + wifiSource);if (wifiSource < 0) {wifiSource = 0;}if (hw.isWifiEnabled()) {log.log(\"检测到wifi没有联网,关闭wifi,\");hw.disableWifi();}}wifiSource = wifiSource * Double.parseDouble(cpuFpsConfig[5].split(\":\")[1]) / 100;log.log(\"根据wifi权重得到wifiSource的值为:\" + wifiSource);double luminanceSource = 100;luminanceSource = 100 * (1 - power.getBrightness() / 2048);if (luminanceSource < 0) {log.log(\"检测到luminanceSource的值<0\");luminanceSource = 0;}luminanceSource = luminanceSource * Double.parseDouble(cpuFpsConfig[4].split(\":\")[1]) / 100;log.log(\"经过亮度权重之后的luminanceSource值:\" + luminanceSource);double batterySource = 100;batterySource = battery.getBatteryState.batteryLevel;if (battery.getBatteryState.isCharging) {log.log(\"充电batterySource=100\");batterySource = 100;}batterySource = batterySource * Double.parseDouble(cpuFpsConfig[3].split(\":\")[1]) / 100;log.log(\"经过电量权重之后的batterySource值:\" + batterySource);double sourcePer = wifiSource + batterySource + luminanceSource;log.log(\"初始sourcePer得分:\" + sourcePer);if (globalVarOf$性能优先应用.contains(to)) {sourcePer = sourcePer * 1;} else if (globalVarOf$均衡优先应用.contains(to)) {sourcePer = sourcePer * 2 / 3;} else if (globalVarOf$省电优先应用.contains(to)) {sourcePer = sourcePer * 1 / 3;}log.log(\"经过cpu应用调度之后的sourcePer得分:\" + sourcePer);double sourceFps = wifiSource + batterySource + luminanceSource;log.log(\"初始sourceFps得分:\" + sourceFps);if (globalVarOf$高帧率优先应用.contains(to)) {sourceFps = sourceFps * 1;} else if (globalVarOf$中等帧率优先应用.contains(to)) {sourceFps = sourceFps * 2 / 3;} else if (globalVarOf$低帧率优先应用.contains(to)) {sourceFps = sourceFps * 1 / 3;}log.log(\"经过帧率应用调度之后的sourceFps得分:\" + sourceFps);Double powerPer = Double.valueOf(cpuFpsConfig[6].split(\":\")[1]);sourcePer = Math.pow(sourcePer, powerPer) / (Math.pow(100, powerPer - 1));log.log(\"经过n次方之后的sourcePer得分:\" + sourcePer);Double powerFps = Double.valueOf(cpuFpsConfig[7].split(\":\")[1]);sourceFps = Math.pow(sourceFps, powerFps) / (Math.pow(100, powerFps - 1));log.log(\"经过n次方之后的sourceFps得分:\" + sourceFps);int cpuOut = 0;if (sourcePer <= 25) {cpuOut = 0;} else if (sourcePer > 25 && sourcePer <= 50) {cpuOut = 1;} else if (sourcePer > 50 && sourcePer <= 75) {cpuOut = 2;} else if (sourcePer > 75 && sourcePer <= 100) {cpuOut = 3;}log.log(\"cpuOut:\" + cpuOut);int fpsOut = 60;double fpsNum = Double.parseDouble(cpuFpsConfig[1].split(\":\")[1]) / 100 * sourceFps;if (fpsNum <= 60) {fpsOut = 60;} else if (fpsNum > 60 && fpsNum <= 90) {fpsOut = 90;} else if (fpsNum > 90 && fpsNum <= 120) {fpsOut = 120;} else if (fpsNum > 120 && fpsNum <= 144) {fpsOut = 144;} else if (fpsNum > 144 && fpsNum <= 160) {fpsOut = 160;}if (cpuFpsConfig[9].equals(\"强制最高帧率运行:是\")) {log.log(\"强制最高帧率运行开\");fpsOut = Integer.parseInt((cpuFpsConfig[1].split(\":\")[1]));cpuFpsConfig[10] = \"强制最低帧率运行:否\";thanos.profileManager.addGlobalRuleVar(\"卢克性能与帧率配置\", cpuFpsConfig);}if (cpuFpsConfig[10].equals(\"强制最低帧率运行:是\")) {log.log(\"强制最低帧率运行开\");fpsOut = 60;cpuFpsConfig[9] = \"强制最高帧率运行:否\";thanos.profileManager.addGlobalRuleVar(\"卢克性能与帧率配置\", cpuFpsConfig);}int s = Integer.parseInt(cpuFpsConfig[8].split(\":\")[1]);if (s == fpsOut) {fpsOut = 60;log.log(\"不能使用的帧率\" + s);}log.log(\"fpsOut:\" + fpsOut);String s0 = \"echo powersave > /storage/emulated/0/Android/yc/uperf/cur_powermode.txt\";String s1 = \"echo balance > /storage/emulated/0/Android/yc/uperf/cur_powermode.txt\";String s2 = \"echo performance > /storage/emulated/0/Android/yc/uperf/cur_powermode.txt\";String s3 = \"echo fast > /storage/emulated/0/Android/yc/uperf/cur_powermode.txt\";String shpath60 = \"echo -e '- -1 -1\n* 60 60' > storage/emulated/0/Android/yc/dfps/dfps.txt\";String shpath90 = \"echo -e '- -1 -1\n* 90 90' > storage/emulated/0/Android/yc/dfps/dfps.txt\";String shpath120 = \"echo -e '- -1 -1\n* 120 120' > storage/emulated/0/Android/yc/dfps/dfps.txt\";String shpath144 = \"echo -e '- -1 -1\n* 144 144 ' > storage/emulated/0/Android/yc/dfps/dfps.txt\";String shpath160 = \"echo -e '- -1 -1\n* 160 160 ' > storage/emulated/0/Android/yc/dfps/dfps.txt\";String[] beforeCpuFps = thanos.getProfileManager().getGlobalRuleVarByName(\"beforeCpuFps\");log.log(\"上次cpu和帧率配置状态为:\" + beforeCpuFps[0] + \",\" + beforeCpuFps[1]);int show = 0;if (!beforeCpuFps[0].equals(String.valueOf(cpuOut))) {log.log(\"检测到与上次cpu状态不一样\");if (cpuOut == 0) {su.exe(s0);} else if (cpuOut == 1) {su.exe(s1);} else if (cpuOut == 2) {su.exe(s2);} else if (cpuOut == 3) {su.exe(s3);}beforeCpuFps[0] = String.valueOf(cpuOut);thanos.profileManager.addGlobalRuleVar(\"beforeCpuFps\", beforeCpuFps);show++;}if (!beforeCpuFps[1].equals(String.valueOf(fpsOut))) {log.log(\"检测到与上次帧率状态不一样\");if (fpsOut == 60) {su.exe(shpath60);} else if (fpsOut == 90) {su.exe(shpath90);} else if (fpsOut == 120) {su.exe(shpath120);} else if (fpsOut == 144) {su.exe(shpath144);} else if (fpsOut == 160) {su.exe(shpath160);}beforeCpuFps[1] = String.valueOf(fpsOut);thanos.profileManager.addGlobalRuleVar(\"beforeCpuFps\", beforeCpuFps);show++;}if (cpuFpsConfig[0].equals(\"是否显示通知:是\") && show > 0) {log.log(\"显示自动性能与帧率通知\");ui.showNotification(\"cpuFps显示\", \"自动性能与帧率\", \"cpu评估分数:\" + sourcePer + \",cpu配置:\" + cpuOut + \",帧率评估分数\" + sourceFps + \",帧率:\" + fpsOut, false);}}}log.log(\"自动帧率和性能运行结束\");}if (screenOn) {log.log(\"cpu与帧率同步\");thanos.profileManager.addGlobalRuleVar(\"beforeCpuFps\", new String[]{\"-1\", \"-1\"});log.log(\"屏幕打开,重置cpu和帧率状态值\");log.log(\"cpu与帧率同步运行结束\");}if (frontPkgChanged && from == \"github.tornaco.android.thanos\") {log.log(\"进入和平精英高帧率\");currentTimeSec = System.currentTimeMillis() / 1000;String activateAC = io.read(msgPath + \"/activate.ac\");if (activateAC == null) {io.write(msgPath + \"/activate.ac\", \"0\");log.log(\"sh并没有创建activate.ac,程序出错\");}String firstUserTimeIni = io.read(msgPath + \"/firstUserTime.ini\");if (firstUserTimeIni == null) {io.write(msgPath + \"/firstUserTime.ini\", \"0\");log.log(\"sh并没有创建firstUserTime.ini,程序出错\");}readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");log.log(\"进入激活验证\");if (lukeOnOff[2].equals(\"是否开启游戏帧率控制:是\")) {if (currentTimeSec - readActivate <= 259200 || currentTimeSec - readFirstCode < 3600) {log.log(\"和平精英高帧率运行中\");String[] games = thanos.profileManager.getGlobalRuleVarByName(\"和平精英设置\");su.exe(\"sh \" + servicePath + \"startGameFps.sh \" + games[4]);if (!thanos.profileManager.isGlobalRuleVarByNameExists(\"手动配置和平精英\")) {ui.showShortToast(\"正在导入和平精英配置文件\");if (io.read(msgPath + \"/pubgmhd.ini\") == null) {io.write(msgPath + \"/pubgmhd.ini\", \"读取配置出错,请删除本变量,回到桌面再进入,看能否正常配置,如若不能证明您的和平精英高帧率功能受限\");}String[] strings = io.read(msgPath + \"/pubgmhd.ini\").split(\"\n\");thanos.profileManager.addGlobalRuleVar(\"手动配置和平精英\", strings);log.log(\"和平精英配置文件导入\");}if (games[4].equals(\"4\")) {String[] gameConfig2txt = thanos.profileManager.getGlobalRuleVarByName(\"手动配置和平精英\");io.write(msgPath + \"/pubgmhd.ini\", \"\");for (String inputConfig : gameConfig2txt) {io.writeAppend(msgPath + \"/pubgmhd.ini\", inputConfig + \"\n\");}log.log(\"和平精英手动模式输出\");}}}log.log(\"和平精英高帧率运行结束\");}if (btStateOff) {log.log(\"进入蓝牙关闭时提示\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");btStates[0] = \"0\";btStates[1] = \"false\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);ui.showShortToast(\"蓝牙关闭\");log.log(\"蓝牙关闭时提示运行结束\");}if (btStateOn) {log.log(\"进入蓝牙打开时提示\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");btStates[0] = String.valueOf(System.currentTimeMillis());btStates[1] = \"false\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);ui.showShortToast(\"蓝牙打开\");log.log(\"蓝牙打开时提示运行结束\");}if (notificationAdded && notificationTitle.equals(\"正在通过USB声卡输出声音\")) {log.log(\"进入小米手机判断耳机是否插入,并把状态写入BtState[2]\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");hw.disableBT();btStates[2] = \"in\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);log.log(\"耳机插入检测运行结束\");}if (notificationRemoved && notificationTitle.equals(\"正在通过USB声卡输出声音\")) {log.log(\"进入小米手机判断耳机是否拔出,并把状态写入BtState[2]\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");ui.showShortToast(\"拔出耳机\");btStates[2] = \"out\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);log.log(\"耳机拔出检测运行结束\");}if (activityResumed) {log.log(\"进入自动蓝牙\");currentTimeSec = System.currentTimeMillis() / 1000;String activateAC = io.read(msgPath + \"/activate.ac\");if (activateAC == null) {io.write(msgPath + \"/activate.ac\", \"0\");log.log(\"sh并没有创建activate.ac,程序出错\");}String firstUserTimeIni = io.read(msgPath + \"/firstUserTime.ini\");if (firstUserTimeIni == null) {io.write(msgPath + \"/firstUserTime.ini\", \"0\");log.log(\"sh并没有创建firstUserTime.ini,程序出错\");}readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (lukeOnOff[4].equals(\"是否开启自动蓝牙:是\")) {if (currentTimeSec - readActivate <= 259200 || currentTimeSec - readFirstCode < 3600) {log.log(\"自动蓝牙运行中\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");int btState = 1;String seRes = su.exe(\"getprop ro.product.brand\");int leftBracketIndex = seRes.indexOf(\"[\");int rightBracketIndex = seRes.indexOf(\"]\");seRes = seRes.substring(leftBracketIndex + 1, rightBracketIndex);log.log(\"当前手机品牌是:\" + seRes);if (seRes.equals(\"Xiaomi\")) {if (btStates[2].equals(\"in\")) {btState = 0;}}int i = 0;if (globalVarOf$蓝牙应用.contains(pkgName)) {i++;}if (i > 0 && btState == 1) {hw.enableBT();}}}log.log(\"蓝牙打开方法运行结束\");}if (btConnectionStateConnected) {log.log(\"蓝牙连上了处理\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");btStates[0] = \"0\";btStates[1] = \"true\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);log.log(\"蓝牙连上了处理运行结束\");}if (btConnectionStateDisconnected) {log.log(\"蓝牙断开了处理\");String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");btStates[0] = String.valueOf(System.currentTimeMillis());btStates[1] = \"false\";thanos.profileManager.addGlobalRuleVar(\"耳机状态\", btStates);log.log(\"蓝牙断开了处理运行结束\");}if (activityResumed || screenOff || screenOn || batteryChanged) {log.log(\"进入蓝牙关闭方法\");String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (lukeOnOff[4].equals(\"是否开启自动蓝牙:是\")) {String[] btStates = thanos.profileManager.getGlobalRuleVarByName(\"耳机状态\");log.log(\"读取耳机状态btStates[0]\" + btStates[0]);long poor = System.currentTimeMillis() - Long.parseLong(btStates[0]);if (poor > 1000 * 4 * 60 && btStates[1].equals(\"false\") && !btStates[0].equals(\"0\")) {hw.disableBT();}}log.log(\"蓝牙关闭方法运行结束\");}if (frontPkgChanged && from == \"github.tornaco.android.thanos\") {log.log(\"gps手动添加组件\");String[] systemArr = thanos.profileManager.getGlobalRuleVarByName(\"卢克助手设置\");if (systemArr[2].equals(\"gps组件快捷添加:是\")) {int le = 0;Thread.sleep(650);long runTime = 0;long bgTime = 0;ui.showNotification(\"卢克助手设置\", \"GPS前台组件添加\", \"找到需要添加为<前台开启GPS的活动>的页面,按音量键-添加,按音量+退出添加)\", false);while (le != 1) {Thread.sleep(400);runTime = System.currentTimeMillis();bgTime = input.getLastKeyTime();if (runTime - bgTime <= 300) {if (input.getLastKey() == 25) {String actName = activity.getFrontAppPackageComponent();int start = actName.indexOf(\"{\") + 1;int end = actName.indexOf(\"}\");actName = actName.substring(start, end);String[] systemArr2 = thanos.profileManager.getGlobalRuleVarByName(\"需要前台开启GPS的活动\");int index = 0;for (String str : systemArr2) {if (actName.equals(str)) {index++;}}if (index == 0) {thanos.profileManager.appendGlobalRuleVar(\"需要前台开启GPS的活动\", new String[]{actName});ui.showShortToast(\"添加成功\");} else {ui.showShortToast(\"已经添加过了\");}} else if (input.getLastKey() == 24 || activity.getFrontAppPackage().equals(\"github.tornaco.android.thanos\")) {le = 1;ui.cancelNotification(\"卢克助手设置\");systemArr[2] = \"gps组件快捷添加:否\";thanos.profileManager.addGlobalRuleVar(\"卢克助手设置\", systemArr);ui.cancelNotification(\"卢克助手设置\");}}}}log.log(\"gps手动添加组件运行结束\");}if (activityResumed || screenOff || screenOn || batteryChanged) {log.log(\"进入自动gps\");currentTimeSec = System.currentTimeMillis() / 1000;String activateAC = io.read(msgPath + \"/activate.ac\");if (activateAC == null) {io.write(msgPath + \"/activate.ac\", \"0\");log.log(\"sh并没有创建activate.ac,程序出错\");}String firstUserTimeIni = io.read(msgPath + \"/firstUserTime.ini\");if (firstUserTimeIni == null) {io.write(msgPath + \"/firstUserTime.ini\", \"0\");log.log(\"sh并没有创建firstUserTime.ini,程序出错\");}readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (lukeOnOff[3].equals(\"是否开启自动gps:是\")) {if (currentTimeSec - readActivate <= 259200 || currentTimeSec - readFirstCode < 3600) {String actName = activity.getFrontAppPackageComponent();int start = actName.indexOf(\"{\") + 1;int end = actName.indexOf(\"}\");componentNameAsString = actName.substring(start, end);pkgName = activity.getFrontAppPackage();if (io.read(msgPath + \"gpsIsOn.ini\") == null) {io.write(msgPath + \"gpsIsOn.ini\", String.valueOf(hw.isLocationEnabled()));}if (io.read(msgPath + \"gpsOffTime.ini\") == null) {io.write(msgPath + \"gpsOffTime.ini\", System.currentTimeMillis());}if (globalVarOf$需要前台开启GPS的活动.contains(componentNameAsString) || globalVarOf$需要后台开启GPS的应用.contains(pkgName)) {hw.enableLocation();io.write(msgPath + \"gpsOffTime.ini\", System.currentTimeMillis());if (io.read(msgPath + \"gpsIsOn.ini\").equals(\"false\")) {ui.showShortToast(\"位置信息打开\");}io.write(msgPath + \"gpsIsOn.ini\", String.valueOf(hw.isLocationEnabled()));} else {int flag = 0;if (context.getSystemService(\"appops\").isOperationActive(2, thanox.pkgManager.getUidForPkgName(pkgName), pkgName)) {flag++;}for (String GpsAppName : globalVarOf$需要后台开启GPS的应用) {if (context.getSystemService(\"appops\").isOperationActive(2, thanox.pkgManager.getUidForPkgName(GpsAppName), GpsAppName)) {flag++;}}if (flag > 0) {io.write(msgPath + \"gpsOffTime.ini\", System.currentTimeMillis());}long runGpsTime = Long.parseLong(io.read(msgPath + \"gpsOffTime.ini\"));if (System.currentTimeMillis() - runGpsTime >= 1000 * 60) {hw.disableLocation();if (io.read(msgPath + \"gpsIsOn.ini\").equals(\"true\")) {ui.showShortToast(\"位置信息关闭\");}io.write(msgPath + \"gpsIsOn.ini\", String.valueOf(hw.isLocationEnabled()));}}}}log.log(\"自动gps运行结束\");}if (activityResumed) {log.log(\"强制横屏应用\");currentTimeSec = System.currentTimeMillis() / 1000;String activateAC = io.read(msgPath + \"/activate.ac\");if (activateAC == null) {io.write(msgPath + \"/activate.ac\", \"0\");log.log(\"sh并没有创建activate.ac,程序出错\");}String firstUserTimeIni = io.read(msgPath + \"/firstUserTime.ini\");if (firstUserTimeIni == null) {io.write(msgPath + \"/firstUserTime.ini\", \"0\");log.log(\"sh并没有创建firstUserTime.ini,程序出错\");}readActivate = Long.parseLong(io.read(msgPath + \"/activate.ac\"));readFirstCode = Long.parseLong(io.read(msgPath + \"/firstUserTime.ini\"));String[] lukeOnOff = thanos.profileManager.getGlobalRuleVarByName(\"卢克开关\");if (lukeOnOff[7].equals(\"是否开启强制横屏设置:是\")) {if (currentTimeSec - readActivate <= 259200 || currentTimeSec - readFirstCode < 3600) {String[] horizontals = thanos.profileManager.getGlobalRuleVarByName(\"强制横屏应用\");int index = 0;for (String pkgHorizontal :horizontals) {if (pkgName.equals(pkgHorizontal)) {index++;}}if (index > 0) {Thread.sleep(250);su.exe(\"sh \" + servicePath + \"/hp.sh\");ui.showNotification(\"横屏设置\", \"强制横屏只支持部分手机部分应用\", \"点击旋转屏幕回到原始状态\", false);}}}log.log(\"强制横屏运行结束\");}if (screenOn) {log.log(\"进入手电筒防误触\");String[] lukeSystem = thanos.profileManager.getGlobalRuleVarByName(\"卢克助手设置\");int minHours = Integer.parseInt(lukeSystem[0].split(\":\")[1]);int minMinute = Integer.parseInt(lukeSystem[0].split(\":\")[2]);int maxHours = Integer.parseInt(lukeSystem[1].split(\":\")[1]);int maxMinute = Integer.parseInt(lukeSystem[1].split(\":\")[2]);int nowHours = new java.util.Date().getHours();int nowMinute = new java.util.Date().getMinutes();log.log(minHours + \":\" + minMinute + \"--\" + maxHours + \":\" + maxMinute);int flagMin = -1;if (nowHours > minHours) {flagMin = 1;} else if (nowHours == minHours) {if (nowMinute > minMinute) {flagMin = 1;} else if (nowMinute == minMinute) {flagMin = 0;} else if (nowMinute < minMinute) {flagMin = -1;}} else if (nowHours < minHours) {flagMin = -1;}int flagMax = -1;if (nowHours > maxHours) {flagMax = 1;} else if (nowHours == maxHours) {if (nowMinute > maxMinute) {flagMax = 1;} else if (nowMinute == maxMinute) {flagMax = 0;} else if (nowMinute < maxMinute) {flagMax = -1;}} else if (nowHours < maxHours) {flagMax = -1;}if (flagMin == 1 && flagMax == -1) {hw.disableFlashlight();log.log(\"关闭了闪光灯\");}log.log(\"手电筒防误触运行结束\");}","actions": [""]}]