6.6.0 - 内置模块重写; 新增部分模块及方法; 修复高版本安卓系统兼容问题; 优化文件管理器及打包功能体验
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Shizuku | AutoJs6 文档 - 6.5.0</title>
|
||||
<title>Shizuku | AutoJs6 文档 - 6.6.0</title>
|
||||
<link rel="stylesheet" href="assets/fonts.css">
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
<link rel="stylesheet" href="assets/sh.css">
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
<div id="column1" data-id="shizuku" class="interior">
|
||||
<header>
|
||||
<h1>AutoJs6 文档 - 6.5.0</h1>
|
||||
<h1>AutoJs6 文档 - 6.6.0</h1>
|
||||
<div id="gtoc">
|
||||
<p class="index">
|
||||
<a href="index.html" name="toc">索引</a> |
|
||||
@@ -191,8 +191,24 @@
|
||||
<h1>Shizuku<span><a class="mark" href="#shizuku_shizuku" id="shizuku_shizuku">#</a></span></h1>
|
||||
<hr>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">此章节待补充或完善...</p>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">Marked by SuperMonster003 on Oct 30, 2023.</p>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">Marked by SuperMonster003 on Nov 14, 2024.</p>
|
||||
|
||||
<hr>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">TypeScript Declarations (v6.6.0+)</p>
|
||||
|
||||
<pre><code class="lang-typescript">interface Shizuku extends org.autojs.autojs.runtime.api.WrappedShizuku {
|
||||
|
||||
(command: string | string[]): AbstractShell.Result;
|
||||
(command: string | string[], commandArgument: object | string): AbstractShell.Result;
|
||||
|
||||
execCommand(command: string | string[]): AbstractShell.Result;
|
||||
execCommand(command: string | string[], commandArgument: object | string): AbstractShell.Result;
|
||||
|
||||
getCommand(command: string | string[]): string;
|
||||
getCommand(command: string | string[], commandArgument: object | string): string;
|
||||
|
||||
}
|
||||
</code></pre>
|
||||
<hr>
|
||||
<p>通过 <a href="https://shizuku.rikka.app/introduction/">Shizuku</a> 可以获得 ADB 特权并使用系统 API.</p>
|
||||
<p>使用 Shizuku 需满足以下全部条件</p>
|
||||
@@ -226,7 +242,7 @@ shizuku('input keyevent 26');
|
||||
shizuku(`input keyevent ${KeyEvent.KEYCODE_POWER}`); /* 同上. */
|
||||
|
||||
/* 点击屏幕坐标 (100, 120). */
|
||||
shizuku("input tap 100 120");
|
||||
shizuku('input tap 100 120');
|
||||
|
||||
/* 授予 AutoJs6 "修改安全设置" 权限. */
|
||||
shizuku('pm grant org.autojs.autojs6 android.permission.WRITE_SECURE_SETTINGS');
|
||||
@@ -234,12 +250,34 @@ shizuku('pm grant org.autojs.autojs6 android.permission.WRITE_SECURE_SETTING
|
||||
/* 授予 AutoJs6 "投影媒体" 权限. */
|
||||
shizuku('appops set org.autojs.autojs6 PROJECT_MEDIA allow');
|
||||
|
||||
/* 启用 AutoJs6 "无障碍服务". */
|
||||
shizuku('settings put secure enabled_accessibility_services org.autojs.autojs6/org.autojs.autojs.core.accessibility.AccessibilityServiceUsher');
|
||||
|
||||
/* 获取当前时间. */
|
||||
console.log(shizuku('date').result.trim());
|
||||
</code></pre>
|
||||
<p>使用 shizuku 启用 AutoJs6 无障碍服务 (共计 4 步):</p>
|
||||
<pre><code class="lang-js">
|
||||
/* [ 1. 获取无障碍服务列表, 列表是一个字符串, 不同无障碍服务之间以 ":" 分隔. ] */
|
||||
let services = shizuku('settings get secure enabled_accessibility_services').result.trim(); /* 结尾 "\n" 可通过 trim() 方法去除. */
|
||||
|
||||
/* [ 2. 确保无障碍服务列表中不存在 AutoJs6. ] */
|
||||
let servicesWithoutAutoJs6 = services
|
||||
.split(':') /* 通过 ":" 分割, 获取无障碍服务数组. */
|
||||
.filter(it => !it.startsWith(`${autojs.packageName}/`)) /* 过滤可能的 AutoJs6 无障碍服务, 避免重复. */
|
||||
.join(':'); /* 重新组合过滤后的无障碍服务, 生成列表. */
|
||||
|
||||
/* [ 3. 无障碍服务列表中加入 AutoJs6. ] */
|
||||
let servicesWithAutoJs6 = (() => {
|
||||
/* 无障碍服务格式: "包名/服务类名" */
|
||||
let serviceAutoJs6 = `${autojs.packageName}/${org.autojs.autojs.core.accessibility.AccessibilityServiceUsher.class.getName()}`;
|
||||
return servicesWithoutAutoJs6.length > 0 ? `${servicesWithoutAutoJs6}:${serviceAutoJs6}` : serviceAutoJs6;
|
||||
})();
|
||||
|
||||
/* [ 4. 通过覆盖系统的无障碍物服列表, 使 AutoJs6 无障碍服务生效. ] */
|
||||
shizuku(`settings put secure enabled_accessibility_services ${servicesWithAutoJs6}`);
|
||||
|
||||
/* 需特别留意, 如果只执行 shizuku(`settings put secure enabled_accessibility_services ${AutoJs6 包名}/${AutoJs6 服务类名}`), 系统将只启用 AutoJs6 无障碍服务, 其他应用的无障碍服务将全部关闭. */
|
||||
|
||||
/* 另, 禁用 AutoJs6 无障碍服务, 只需执行上述示例的 [ 1, 2, 4 ] 步骤即可. */
|
||||
</code></pre>
|
||||
<h3>shizuku(cmdList)<span><a class="mark" href="#shizuku_shizuku_cmdlist" id="shizuku_shizuku_cmdlist">#</a></span></h3>
|
||||
<p><strong><code>6.4.0</code></strong> <strong><code>Overload 2/2</code></strong></p>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user