Skip to content

Commit

Permalink
2.1.8 - 修复配置工具对话框/主页监控引起关屏 完善内存信息工具
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperMonster003 committed Aug 13, 2021
1 parent 9f24bce commit 09e656e
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 207 deletions.
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@

[comment]: <> (Version history only shows last 3 versions)

# v2.1.8
###### 2021/08/13
* `修复` 配置工具对话框监听器this指针绑定失效的问题 _[`issue #513`](https://github.com/SuperMonster003/Ant-Forest/issues/513)_ _[`#511`](https://github.com/SuperMonster003/Ant-Forest/issues/511#issuecomment-896448713)_
* `修复` 森林主页监控成熟能量球时可能引起设备关屏的问题 (试修) _[`issue #508`](https://github.com/SuperMonster003/Ant-Forest/issues/508)_
* `优化` 完善内存信息工具内的提示信息
* `优化` 去除控制台消息在简略模式下的部分无关内容

# v2.1.7
###### 2021/08/08
* `新增` 内存信息工具 (简易) (/tools/auto.js-memory-info-tool.js)
Expand All @@ -141,21 +148,6 @@
* `优化` 逛一逛方案获取倒计时排行榜页面滚动速度
* `优化` 排行榜页面底部监测线程的内部检测逻辑

# v2.1.5
###### 2021/07/01
* `修复` 部分机型SettingNotFoundException异常并尝试自动修复 (试修) _[`issue #487`](https://github.com/SuperMonster003/Ant-Forest/issues/487)_ _[`#483`](https://github.com/SuperMonster003/Ant-Forest/issues/483)_
* `修复` imagesx.capt()可能返回falsy值的问题 (试修) _[`issue #488`](https://github.com/SuperMonster003/Ant-Forest/issues/488)_
* `修复` 前置应用横屏状态启动项目时屏幕数据异常的问题 _[`issue #489`](https://github.com/SuperMonster003/Ant-Forest/issues/489)_
* `修复` 部分Pro版本无法在锁屏页面获取布局信息的问题 _[`issue #486`](https://github.com/SuperMonster003/Ant-Forest/issues/486)_
* `修复` 部分Pro版本无法支持Floaty布局中fontFamily属性的问题
* `修复` 部分Pro版本进入排行榜后准备条件判断随机失效的问题
* `修复` $$sel.pickup()获取控件集合数量可能不准确的问题
* `修复` storagesx扩展模块remove方法功能失效的问题
* `优化` 解锁模块增加拨号盘阵列PIN解锁方案 (试验性)
* `优化` 重构$$sel.pickup()并摒除低概率功能及参数变量
* `优化` 静默脚本强制中止时"方法链"方法产生的错误日志
* `优化` 静默部分Pro版本对控制台日志文件模式参数产生的报警日志

##### 更多版本历史可参阅

* [CHANGELOG-2.md](https://github.com/SuperMonster003/Ant-Forest/blob/master/documents/CHANGELOG-2.md) ( 2.x 版本 )
Expand Down
190 changes: 118 additions & 72 deletions ant-forest-launcher.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ant-forest-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3497,7 +3497,7 @@ let $$init = {
};
Object.keys(_props).forEach(k => _par[k] || delete _props[k]);
return _props;
})());
}).call(this));
};

return this;
Expand Down
7 changes: 7 additions & 0 deletions documents/CHANGELOG-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
### 版本历史 - 2.x
******

# v2.1.8
###### 2021/08/13
* `修复` 配置工具对话框监听器this指针绑定失效的问题 _[`issue #513`](https://github.com/SuperMonster003/Ant-Forest/issues/513)_ _[`#511`](https://github.com/SuperMonster003/Ant-Forest/issues/511#issuecomment-896448713)_
* `修复` 森林主页监控成熟能量球时可能引起设备关屏的问题 (试修) _[`issue #508`](https://github.com/SuperMonster003/Ant-Forest/issues/508)_
* `优化` 完善内存信息工具内的提示信息
* `优化` 去除控制台消息在简略模式下的部分无关内容

# v2.1.7
###### 2021/08/08
* `新增` 内存信息工具 (简易) (/tools/auto.js-memory-info-tool.js)
Expand Down
10 changes: 5 additions & 5 deletions modules/ext-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ let ext = {
return this.isAcPlugged() || this.isUsbPlugged() || this.isWirelessPlugged();
},
isPluggedAndStayingOn() {
let _state = ext.stay_on_while_plugged_in.get(true); // 0-7
let _state = ext.stay_on_while_plugged_in.get(); // 0-7
let _isOn = x => (x & _state) === x;
return this.isAcPlugged() && _isOn(BatteryManager.BATTERY_PLUGGED_AC)
|| this.isUsbPlugged() && _isOn(BatteryManager.BATTERY_PLUGGED_USB)
Expand Down Expand Up @@ -1373,13 +1373,13 @@ function StateManager(provider, key, data_type, state_set) {
this.state_set = state_set;

let _ctx_reso = context.getContentResolver();
this.get = function (no_debug_info) {
this.get = function (is_debug_info) {
let _val = _parseGetFnAndCall(_ctx_reso, Provider[key]);
no_debug_info || debugInfo(key + ' -> ' + _val);
debugInfo(key + ' -> ' + _val, 0, is_debug_info);
return _val;
};
this.put = function (value, no_debug_info) {
no_debug_info || debugInfo(key + ' <- ' + value);
this.put = function (value, is_debug_info) {
debugInfo(key + ' <- ' + value, 0, is_debug_info);
return _parsePutFnAndCall(_ctx_reso, Provider[key], value);
};
this.verify = function (value) {
Expand Down
2 changes: 1 addition & 1 deletion modules/ext-engines.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ let ext = {
* <br>
* -- *DEFAULT* - old engine task <br>
* -- new file - like 'hello.js', '../hello.js' or 'hello'
* @param {boolean|string} [options.is_debug_info=undefined]
* @param {boolean} [options.is_debug_info=undefined]
* @param {number} [options.max_restart_e_times=1] - max restart times for avoiding infinite recursion
* @param {boolean} [options.instant_run_flag] - whether to perform an instant run or not
* @example
Expand Down
103 changes: 41 additions & 62 deletions modules/ext-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,20 +376,17 @@ let ext = {
* @param {ScreenCapturerOrientation} [options.screen_capturer_orientation='PORTRAIT']
* @param {Object} [options.restart_e_params={}]
* @param {number} [options.restart_e_params.max_restart_e_times=3]
* @param {boolean} [options.no_debug_info=false]
* @param {boolean} [options.is_debug_info=undefined]
* @returns {boolean}
*/
permit(options) {
if (this._has_scr_capt_permission.get() > 0) {
return true;
}
let _opt = options || {};
let _no_dbg = _opt.no_debug_info;
let _debugInfo = function () {
_no_dbg || debugInfo.apply(null, arguments);
};
let debugInfo$ = (m, lv) => debugInfo(m, lv, _opt.is_debug_info);

_debugInfo('开始申请截图权限');
debugInfo$('开始申请截图权限');

if (typeof _opt.restart_e_flag === 'undefined') {
_opt.restart_e_flag = true;
Expand All @@ -404,7 +401,7 @@ let ext = {
_opt.restart_e_params.max_restart_e_times = 3;
}

_debugInfo('已开启弹窗监测线程');
debugInfo$('已开启弹窗监测线程');

let _thread_prompt = threads.start(function () {
require('./ext-a11y').load();
Expand All @@ -415,18 +412,18 @@ let ext = {

if (waitForAction(_sel_sure, 4.8e3)) {
if (waitForAction(_sel_rem, 600)) {
_debugInfo('勾选"不再提示"复选框');
debugInfo$('勾选"不再提示"复选框');
clickAction(_sel_rem(), 'w');
}
if (waitForAction(_sel_sure, 2.4e3)) {
let _w = _sel_sure();
let _act_msg = '点击' + _sel_sure('txt').surround('"') + '按钮';

_debugInfo(_act_msg);
debugInfo$(_act_msg);
clickAction(_w, 'w');

if (!waitForAction(() => !_sel_sure(), 1e3)) {
_debugInfo('尝试click()方法再次' + _act_msg);
debugInfo$('尝试click()方法再次' + _act_msg);
clickAction(_w, 'click');
}
}
Expand All @@ -436,25 +433,26 @@ let ext = {
let _thread_monitor = threads.start(function () {
if (waitForAction(() => !!_req_result, 4.8e3, 80)) {
_thread_prompt.interrupt();
return _debugInfo('截图权限申请结果: 成功');
return debugInfo$('截图权限申请结果: 成功');
}
if (typeof $$flag !== 'undefined') {
if (!$$flag.debug_info_avail) {
$$flag.debug_info_avail = true;
_no_dbg = false;
_debugInfo('开发者测试模式已自动开启', 3);
}
_opt.is_debug_info = true;
if (typeof $$flag !== 'object') {
global.$$flag = {};
}
if (!$$flag.debug_info_avail) {
$$flag.debug_info_avail = true;
debugInfo$('开发者测试模式已自动开启', 3);
}
if (_opt.restart_e_flag) {
_debugInfo('截图权限申请结果: 失败', 3);
debugInfo$('截图权限申请结果: 失败', 3);
try {
let _m = Build.MANUFACTURER.toLowerCase();
if (_m.match(/xiaomi/)) {
_debugInfo('__split_line__dash__');
_debugInfo('检测到当前设备制造商为小米', 3);
_debugInfo('可能需要给Auto.js以下权限:', 3);
_debugInfo('"后台弹出界面"', 3);
_debugInfo('__split_line__dash__');
debugInfo$('__split_line__dash__');
debugInfo$('检测到当前设备制造商为小米', 3);
debugInfo$('可能需要给Auto.js以下权限:', 3);
debugInfo$('"后台弹出界面"', 3);
debugInfo$('__split_line__dash__');
}
} catch (e) {
// nothing to do here
Expand Down Expand Up @@ -650,7 +648,7 @@ let ext = {
},
/**
* @param {{
* no_debug_info?: boolean,
* is_debug_info?: boolean,
* pool?: object,
* duration?: boolean,
* region?: number[],
Expand All @@ -663,29 +661,25 @@ let ext = {
*/
findAFBallsByHough(options) {
require('./ext-device').getDisplay(true, {is_debug_info: false});

timeRecorder('hough_beginning');
/** @type {{fill_up_pool: number, img_samples_processing: number}} */
let _du = {};

let _opt = options || {};
let debugInfo$ = (m, lv) => debugInfo(m, lv, _opt.is_debug_info);

let _opt_cfg = _opt.config || {};
let _cfg = Object.assign(_def(), global.$$cfg, {
forest_image_pool_limit: _opt_cfg.forest_image_pool_limit,
forest_image_pool_itv: _opt_cfg.forest_image_pool_itv,
});
let _no_dbg = _opt.no_debug_info;
let _dbg_bak;
let _this = this;
let $_flag = global.$$flag = global.$$flag || {};

_dbgBackup();

let _src_img_stg = _cfg.hough_src_img_strategy;
let _results_stg = _cfg.hough_results_strategy;
let _min_dist = cX(_cfg.min_balls_distance);
let _region = _opt.region || _cfg.eballs_recognition_region
.map((v, i) => i % 2 ? cYx(v, true) : cX(v, true));

/** @type {{fill_up_pool: number, img_samples_processing: number}} */
let _du = {};
/** @type {EnergyBallsInfo[]} */
let _balls_data = [];
/**
Expand All @@ -697,16 +691,14 @@ let ext = {
*/
/** @type {EnergyBallsInfoClassified} */
let _balls_data_o = {ripe: [], naught: [], water: []};
let _pool = _opt.pool || new _this.ForestImagePool({
let _pool = _opt.pool || new this.ForestImagePool({
limit: _cfg.forest_image_pool_limit,
interval: _cfg.forest_image_pool_itv,
});
_setWballExtFunction();
_fillUpForestImgPool();
_analyseEnergyBalls();

_dbgRestore();

/** @typedef {{
* duration?: {
* _map: string[][],
Expand All @@ -730,14 +722,14 @@ let ext = {
],
total: Number(timeRecorder('hough_beginning', 'L')),
showDebugInfo() {
debugInfo('__split_line__dash__');
debugInfo('图像填池: ' + this.fill_up_pool + 'ms ' + [
debugInfo$('__split_line__dash__');
debugInfo$('图像填池: ' + this.fill_up_pool + 'ms ' + [
_pool.interval, _pool.limit,
].join(', ').surround('[ '));
this._map.filter(a => this[a[0]]).forEach((a) => {
debugInfo(a[1] + ': ' + this[a[0]] + 'ms');
debugInfo$(a[1] + ': ' + this[a[0]] + 'ms');
});
debugInfo('__split_line__dash__');
debugInfo$('__split_line__dash__');
},
}, _du),
} : {};
Expand All @@ -764,19 +756,6 @@ let ext = {

// tool function(s) //

function _dbgBackup() {
if (_no_dbg) {
_dbg_bak = $_flag.debug_info_avail;
$_flag.debug_info_avail = false;
}
}

function _dbgRestore() {
if (_no_dbg) {
$_flag.debug_info_avail = _dbg_bak;
}
}

function _setWballExtFunction() {
if (!ext.inTreeArea) {
ext.inTreeArea = (o) => {
Expand All @@ -798,7 +777,7 @@ let ext = {
if (_cty > cYx(386)) {
return false;
}
let _capt = capt || _this.capt();
let _capt = capt || ext.capt();
let _hue_max = _cfg.homepage_wball_max_hue_no_blue;
let _offset_x = o.r * Math.sin(30 * Math.PI / 180);
let _offset_y = o.r * Math.cos(30 * Math.PI / 180);
Expand Down Expand Up @@ -841,7 +820,7 @@ let ext = {
if (ext.inTreeArea(o)) {
return;
}
let _capt = capt || _this.capt();
let _capt = capt || ext.capt();
let _offset = o.r * Math.SQRT1_2;
let _d = _offset * 2;
let _color = _cfg.ripe_ball_detect_color_val;
Expand Down Expand Up @@ -877,17 +856,17 @@ let ext = {
}

function _analyseEnergyBalls() {
debugInfo('分析森林页面样本中的能量球');
debugInfo$('分析森林页面样本中的能量球');
_pool.data.forEach(_parse);
debugInfo('森林页面样本能量球分析完毕');
debugInfo('解析的能量球数量: ' + _balls_data.length);
debugInfo$('森林页面样本能量球分析完毕');
debugInfo$('解析的能量球数量: ' + _balls_data.length);
_balls_data.forEach(o => _balls_data_o[o.type].push(o));
_opt.pool || _pool.reclaimAll();

// tool function(s) //

function _parse(capt) {
if (!capt || _this.isRecycled(capt)) {
if (!capt || ext.isRecycled(capt)) {
return;
}
let [_l, _t, _r, _b] = _region;
Expand All @@ -906,7 +885,7 @@ let ext = {
return images.blur(_gray, 9, [-1, -1], 'REPLICATE');
});
let _blt_fltr = _getImg('blt_fltr', _src_img_stg.blt_fltr, () => {
return _this.bilateralFilter(_gray, 9, 20, 20, 'REPLICATE');
return ext.bilateralFilter(_gray, 9, 20, 20, 'REPLICATE');
});

let _proc_key = 'img_samples_processing';
Expand Down Expand Up @@ -1187,7 +1166,7 @@ let ext = {
let _r = Number(o.radius.toFixed(2));
let _d = _r * 2;
let _clip = images.clip(capt, _x - _r, _y - _r, _d, _d);
let _mean = _this.getMean(_clip);
let _mean = ext.getMean(_clip);
_clip.recycle();
_clip = null;
return {x: _x, y: _y, r: _r, mean: _mean};
Expand All @@ -1202,7 +1181,7 @@ let ext = {
})
.sort(_sortX);
if (is_recycle_img) {
_this.reclaim(img);
ext.reclaim(img);
}
return _img;
}
Expand Down
Loading

0 comments on commit 09e656e

Please sign in to comment.