6.7.0 - Alpha17 - Fine tuning
This commit is contained in:
@@ -37,6 +37,7 @@ import org.autojs.autojs.execution.ScriptExecution.AbstractScriptExecution
|
||||
import org.autojs.autojs.inrt.autojs.LoopBasedJavaScriptEngineWithDecryption
|
||||
import org.autojs.autojs.runtime.ScriptRuntime
|
||||
import org.autojs.autojs.script.ScriptSource
|
||||
import org.autojs.autojs.util.IntentUtils.startSafely
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs6.R
|
||||
import org.mozilla.javascript.ContinuationPending
|
||||
@@ -184,10 +185,10 @@ class ScriptExecuteActivity : AppCompatActivity(), OnActivityResultDelegate.Dele
|
||||
mScriptEngine.setTag(ScriptEngine.TAG_SOURCE, mScriptSource)
|
||||
mExecutionListener!!.onStart(mScriptExecution)
|
||||
|
||||
if (isInrt) {
|
||||
(mScriptEngine as LoopBasedJavaScriptEngineWithDecryption).execute(mScriptSource, executeCallback)
|
||||
} else {
|
||||
if (!isInrt) {
|
||||
(mScriptEngine as LoopBasedJavaScriptEngine).execute(mScriptSource, executeCallback)
|
||||
} else {
|
||||
(mScriptEngine as LoopBasedJavaScriptEngineWithDecryption).execute(mScriptSource, executeCallback)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,11 +305,10 @@ class ScriptExecuteActivity : AppCompatActivity(), OnActivityResultDelegate.Dele
|
||||
@JvmStatic
|
||||
fun execute(context: Context, manager: ScriptEngineManager, task: ScriptExecutionTask): ActivityScriptExecution {
|
||||
val execution = ActivityScriptExecution(manager, task)
|
||||
val i = Intent(context, ScriptExecuteActivity::class.java)
|
||||
Intent(context, ScriptExecuteActivity::class.java)
|
||||
.putExtra(EXTRA_EXECUTION_ID, execution.id)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.addFlags(task.config.intentFlags)
|
||||
context.startActivity(i)
|
||||
.startSafely(context)
|
||||
return execution
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import androidx.core.net.toUri
|
||||
import org.autojs.autojs.ui.main.drawer.PermissionItemHelper
|
||||
import org.autojs.autojs.util.IntentUtils.start
|
||||
import org.autojs.autojs.util.RomUtils
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs6.R
|
||||
@@ -46,8 +47,7 @@ class VivoBackgroundPopupPermission(
|
||||
"com.vivo.permissionmanager.activity.SoftPermissionDetailActivity",
|
||||
)
|
||||
.setAction("secure.intent.action.softPermissionDetail")
|
||||
.putExtra("packagename", pkg)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
.putExtra("packagename", pkg),
|
||||
|
||||
// Older models may use PurviewTabActivity.
|
||||
// zh-CN: 老机型可能使用 PurviewTabActivity.
|
||||
@@ -57,8 +57,7 @@ class VivoBackgroundPopupPermission(
|
||||
"com.vivo.permissionmanager.activity.PurviewTabActivity",
|
||||
)
|
||||
.putExtra("packagename", pkg)
|
||||
.putExtra("tabId", "1")
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
.putExtra("tabId", "1"),
|
||||
|
||||
// Some ROMs expose a background start manager page.
|
||||
// zh-CN: 部分 ROM 暴露了后台启动管理页.
|
||||
@@ -66,8 +65,7 @@ class VivoBackgroundPopupPermission(
|
||||
.setClassName(
|
||||
"com.vivo.permissionmanager",
|
||||
"com.vivo.permissionmanager.activity.BgStartUpManagerActivity",
|
||||
)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
),
|
||||
)
|
||||
|
||||
return tryStartActivities(intents) || openAppDetails()
|
||||
@@ -76,7 +74,6 @@ class VivoBackgroundPopupPermission(
|
||||
private fun openAppDetails(): Boolean = Intent()
|
||||
.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
|
||||
.setData("package:${context.packageName}".toUri())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.let { tryStartActivity(it) }
|
||||
|
||||
/**
|
||||
@@ -128,7 +125,7 @@ class VivoBackgroundPopupPermission(
|
||||
private fun tryStartActivity(i: Intent): Boolean = runCatching {
|
||||
val pm = context.packageManager
|
||||
i.resolveActivity(pm) ?: return@runCatching false
|
||||
context.startActivity(i)
|
||||
i.start(context)
|
||||
true
|
||||
}.onFailure {
|
||||
it.printStackTrace()
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Process
|
||||
import android.provider.Settings
|
||||
import androidx.core.net.toUri
|
||||
import org.autojs.autojs.ui.main.drawer.PermissionItemHelper
|
||||
import org.autojs.autojs.util.IntentUtils.start
|
||||
import org.autojs.autojs.util.RomUtils
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs6.R
|
||||
@@ -46,8 +47,7 @@ class XiaomiBackgroundPopupPermission(
|
||||
"com.miui.securitycenter",
|
||||
"com.miui.permcenter.permissions.PermissionsEditorActivity",
|
||||
)
|
||||
.putExtra("extra_pkgname", pkg)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
.putExtra("extra_pkgname", pkg),
|
||||
|
||||
// Some MIUI versions use AppPermissionsEditorActivity.
|
||||
// zh-CN: 部分 MIUI 版本使用 AppPermissionsEditorActivity.
|
||||
@@ -56,8 +56,7 @@ class XiaomiBackgroundPopupPermission(
|
||||
"com.miui.securitycenter",
|
||||
"com.miui.permcenter.permissions.AppPermissionsEditorActivity",
|
||||
)
|
||||
.putExtra("extra_pkgname", pkg)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
.putExtra("extra_pkgname", pkg),
|
||||
)
|
||||
|
||||
return tryStartActivities(intents) || openAppDetails()
|
||||
@@ -66,7 +65,6 @@ class XiaomiBackgroundPopupPermission(
|
||||
private fun openAppDetails(): Boolean = Intent()
|
||||
.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
|
||||
.setData("package:${context.packageName}".toUri())
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.let { tryStartActivity(it) }
|
||||
|
||||
/**
|
||||
@@ -114,7 +112,7 @@ class XiaomiBackgroundPopupPermission(
|
||||
private fun tryStartActivity(i: Intent): Boolean = runCatching {
|
||||
val pm = context.packageManager
|
||||
i.resolveActivity(pm) ?: return@runCatching false
|
||||
context.startActivity(i)
|
||||
i.start(context)
|
||||
true
|
||||
}.onFailure {
|
||||
it.printStackTrace()
|
||||
|
||||
@@ -113,6 +113,26 @@ class Dialogs(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
|
||||
|
||||
private val presetAnimations = listOf("default", "activity", "dialog", "inputMethod", "toast", "translucent")
|
||||
|
||||
private val customJsPropertiesForBuild: Set<String> = setOf(
|
||||
"preset",
|
||||
"inputHint",
|
||||
"inputPrefill",
|
||||
"items",
|
||||
"progress",
|
||||
"checkBoxPrompt",
|
||||
"checkBoxChecked",
|
||||
"customView",
|
||||
"stubborn",
|
||||
"theme",
|
||||
"linkify",
|
||||
"onBackKey",
|
||||
"onBackPressed",
|
||||
"dimAmount",
|
||||
"animation",
|
||||
"keepScreenOn",
|
||||
"inputSingleLine",
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@RhinoRuntimeFunctionInterface
|
||||
fun build(scriptRuntime: ScriptRuntime, args: Array<out Any?>): JsDialog = ensureArgumentsAtMost(args, 1) { argList ->
|
||||
@@ -460,23 +480,27 @@ class Dialogs(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
|
||||
|
||||
private fun applyDialogProperty(builder: JsDialogBuilder, name: String, value: Any?) {
|
||||
when (val propertySetter = propertySetterMap[name]) {
|
||||
CVT_DEFAULT -> invokeMethod(builder, name, arrayOf(value))
|
||||
CVT_DEFAULT -> invokeJavaMethod(builder, name, arrayOf(value))
|
||||
CVT_DEFAULT_STRICT_BOOLEAN -> {
|
||||
if (value == true) {
|
||||
invokeMethod(builder, name, emptyArray())
|
||||
invokeJavaMethod(builder, name, emptyArray())
|
||||
}
|
||||
}
|
||||
CVT_COLOR_INT -> {
|
||||
val colorInt = Colors.toIntRhino(value)
|
||||
invokeMethod(builder, name, arrayOf(colorInt))
|
||||
invokeJavaMethod(builder, name, arrayOf(colorInt))
|
||||
}
|
||||
is String -> when (propertySetter) {
|
||||
in propertySetterMap -> {
|
||||
applyDialogProperty(builder, propertySetter, value)
|
||||
}
|
||||
else -> invokeMethod(builder, propertySetter, arrayOf(value))
|
||||
else -> invokeJavaMethod(builder, propertySetter, arrayOf(value))
|
||||
}
|
||||
else -> {
|
||||
if (!customJsPropertiesForBuild.contains(name)) {
|
||||
invokeJavaMethod(builder, name, arrayOf(value))
|
||||
}
|
||||
}
|
||||
else -> invokeMethod(builder, name, arrayOf(value))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,13 +790,13 @@ class Dialogs(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun invokeMethod(builder: JsDialogBuilder, key: String, argsForMethod: Array<out Any?>) {
|
||||
private fun invokeJavaMethod(builder: JsDialogBuilder, key: String, argsForMethod: Array<out Any?>) {
|
||||
val methods = builder.javaClass.methods
|
||||
val targetMethodsForName = methods.filter {
|
||||
it.name == key
|
||||
}
|
||||
if (targetMethodsForName.isEmpty()) {
|
||||
return
|
||||
require(targetMethodsForName.isNotEmpty()) {
|
||||
"Method key \"$key\" for dialogs.build is not a valid method name"
|
||||
}
|
||||
val targetMethodsForParamCount = targetMethodsForName.filter {
|
||||
it.parameterCount == argsForMethod.size
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.autojs.autojs.runtime.api.augment.shell
|
||||
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import androidx.annotation.IntRange
|
||||
import org.autojs.autojs.annotation.RhinoRuntimeFunctionInterface
|
||||
import org.autojs.autojs.extension.AnyExtensions.isJsNullish
|
||||
import org.autojs.autojs.extension.AnyExtensions.jsBrief
|
||||
|
||||
@@ -65,7 +65,7 @@ public class RootUtils {
|
||||
private static boolean isSuPresentFast() {
|
||||
try {
|
||||
// 1. Check common su paths.
|
||||
// zh-CN: 1. 检查常见 su 路径.
|
||||
// zh-CN: 检查常见 su 路径.
|
||||
for (String path : COMMON_SU_PATHS) {
|
||||
if (isExecutableFile(path)) {
|
||||
return true;
|
||||
@@ -73,7 +73,7 @@ public class RootUtils {
|
||||
}
|
||||
|
||||
// 2. Check su in PATH environment.
|
||||
// zh-CN: 2. 检查 PATH 环境中的 su.
|
||||
// zh-CN: 检查 PATH 环境中的 su.
|
||||
String envPath = System.getenv("PATH");
|
||||
if (envPath != null && !envPath.isEmpty()) {
|
||||
String[] paths = envPath.split(":");
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import org.autojs.autojs.app.GlobalAppContext
|
||||
import org.autojs.autojs.core.pref.Pref
|
||||
import org.autojs.autojs.runtime.ScriptRuntime
|
||||
import org.autojs.autojs.theme.ThemeColorManager
|
||||
import org.autojs.autojs.util.StringUtils.key
|
||||
import org.autojs.autojs6.R
|
||||
@@ -1155,7 +1156,11 @@ object ViewUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun showSnack(view: View, stringRes: Int, isLong: Boolean) {
|
||||
try {
|
||||
Snackbar.make(view, stringRes, if (isLong) Snackbar.LENGTH_LONG else Snackbar.LENGTH_SHORT).show()
|
||||
} catch (e: IllegalStateException) {
|
||||
ScriptRuntime.popException(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -1163,14 +1168,30 @@ object ViewUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun showSnack(view: View, string: CharSequence, isLong: Boolean) {
|
||||
try {
|
||||
Snackbar.make(view, string, if (isLong) Snackbar.LENGTH_LONG else Snackbar.LENGTH_SHORT).show()
|
||||
} catch (e: IllegalStateException) {
|
||||
ScriptRuntime.popException(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showSnack(view: View, stringRes: Int, duration: Int) = Snackbar.make(view, stringRes, duration).show()
|
||||
fun showSnack(view: View, stringRes: Int, duration: Int) {
|
||||
try {
|
||||
Snackbar.make(view, stringRes, duration).show()
|
||||
} catch (e: IllegalStateException) {
|
||||
ScriptRuntime.popException(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showSnack(view: View, string: CharSequence, duration: Int) = Snackbar.make(view, string, duration).show()
|
||||
fun showSnack(view: View, string: CharSequence, duration: Int) {
|
||||
try {
|
||||
Snackbar.make(view, string, duration).show()
|
||||
} catch (e: IllegalStateException) {
|
||||
ScriptRuntime.popException(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
fun setKeepScreenOnWhenInForegroundDisabled() {
|
||||
Pref.putString(R.string.key_keep_screen_on_when_in_foreground, key(R.string.key_keep_screen_on_when_in_foreground_disabled))
|
||||
|
||||
@@ -111,8 +111,8 @@ public final class OpenCLGuard {
|
||||
// 2) Try loading (absolute path first, then loadLibrary("OpenCL")).
|
||||
// zh-CN: 2) 尝试加载 (绝对路径优先, 其次 loadLibrary("OpenCL")).
|
||||
boolean loadOk = false;
|
||||
// 2.1 Absolute path dlopen.
|
||||
// zh-CN: 2.1 绝对路径 dlopen.
|
||||
// 2.1. Absolute path dlopen.
|
||||
// zh-CN: 绝对路径 dlopen.
|
||||
if (hitPath != null) {
|
||||
try {
|
||||
System.load(hitPath);
|
||||
@@ -122,8 +122,8 @@ public final class OpenCLGuard {
|
||||
Log.i(TAG, "[OpenCL] System.load failed: " + hitPath + " -> " + t.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
// 2.2 Regular link name.
|
||||
// zh-CN: 2.2 常规链接名.
|
||||
// 2.2. Regular link name.
|
||||
// zh-CN: 常规链接名.
|
||||
if (!loadOk) {
|
||||
try {
|
||||
System.loadLibrary("OpenCL");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Wed Jan 21 22:51:23 CST 2026
|
||||
BUILD_TIME=1769007083119
|
||||
#Thu Jan 22 00:50:41 CST 2026
|
||||
BUILD_TIME=1769014241677
|
||||
COMPILE_SDK_VERSION=36
|
||||
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
||||
IMAGE_QUANT_NDK_VERSION=26.1.10909125
|
||||
@@ -27,6 +27,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||
TARGET_SDK_VERSION=36
|
||||
TARGET_SDK_VERSION_INRT=29
|
||||
VERSION_BUILD=3644
|
||||
VERSION_BUILD=3645
|
||||
VERSION_NAME=6.7.0 Alpha17
|
||||
VSCODE_EXT_REQUIRED_VERSION=1.0.13
|
||||
|
||||
Reference in New Issue
Block a user