This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
* `修复` 代码编辑器跳转到行尾时可能跳转到下一行起始位置的问题
|
||||
* `修复` 设置页面连续快速点击对话框类型项目时可能导致应用崩溃的问题
|
||||
* `优化` 精简打包应用模板 APK 文件大小
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
* `修复` 代码编辑器跳转到行尾时可能跳转到下一行起始位置的问题
|
||||
* `修复` 设置页面连续快速点击对话框类型项目时可能导致应用崩溃的问题
|
||||
* `优化` 精简打包应用模板 APK 文件大小
|
||||
|
||||
@@ -382,10 +382,13 @@ open class ApkBuilder(apkInputStream: InputStream?, private val outApkFile: File
|
||||
value = mNoSplashThemeId
|
||||
}
|
||||
|
||||
if (name.data == "authorities" && value is StringItem) {
|
||||
(value as StringItem).data = "${mProjectConfig.packageName}.fileprovider"
|
||||
} else {
|
||||
super.onAttr(this)
|
||||
when {
|
||||
name.data == "authorities" -> (value as? StringItem)?.apply {
|
||||
// @Reference to aiselp (https://github.com/aiselp) by SuperMonster003 on Apr 12, 2025.
|
||||
// ! https://github.com/aiselp/AutoX/commit/d085ccd41aafcf74d503bdf5ac08d021567945b2#diff-97c191813b60e8f000917ca5fe93dced97e688bdd48b25d212d03152d5f1678cR432
|
||||
data = data.replace(INRT_APP_ID, mProjectConfig.packageName)
|
||||
}
|
||||
else -> super.onAttr(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,6 +439,7 @@ open class ApkBuilder(apkInputStream: InputStream?, private val outApkFile: File
|
||||
const val LIBRARY_DIR = "lib"
|
||||
|
||||
const val TEMPLATE_APK_NAME = "template.apk"
|
||||
const val INRT_APP_ID = "org.autojs.autojs6.inrt"
|
||||
|
||||
private val TAG = ApkBuilder::class.java.simpleName
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import pxb.android.axml.AxmlReader;
|
||||
import pxb.android.axml.AxmlWriter;
|
||||
import pxb.android.axml.NodeVisitor;
|
||||
|
||||
import static org.autojs.autojs.apkbuilder.ApkBuilder.INRT_APP_ID;
|
||||
|
||||
/**
|
||||
* Created by Stardust on Oct 23, 2017.
|
||||
*/
|
||||
@@ -102,7 +104,7 @@ public class ManifestEditor {
|
||||
@Override
|
||||
protected void onAttr(AxmlWriter.Attr a) {
|
||||
if ("permission".equals(this.name.data) && "name".equals(a.name.data) && a.value instanceof StringItem) {
|
||||
if ("org.autojs.autojs6.inrt.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION".equals(((StringItem) a.value).data)) {
|
||||
if ((INRT_APP_ID + ".DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION").equals(((StringItem) a.value).data)) {
|
||||
((StringItem) a.value).data = mPackageName + ".DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION";
|
||||
super.onAttr(a);
|
||||
return;
|
||||
|
||||
@@ -2,9 +2,6 @@ package org.autojs.autojs.inrt.autojs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.google.mlkit.common.MlKit
|
||||
import org.autojs.autojs.external.fileprovider.AppFileProvider
|
||||
import org.autojs.autojs.inrt.LogActivity
|
||||
import org.autojs.autojs.inrt.SettingsActivity
|
||||
import org.autojs.autojs.runtime.api.AppUtils
|
||||
@@ -15,32 +12,18 @@ import org.autojs.autojs.AutoJs as AutoJsApp
|
||||
*/
|
||||
class AutoJs(application: Application) : AutoJsApp(application) {
|
||||
|
||||
init {
|
||||
initMLKit(application)
|
||||
override fun createAppUtils(context: Context): AppUtils {
|
||||
val authorityName = "${context.packageName}.fileprovider"
|
||||
return AppUtils(context, authorityName)
|
||||
}
|
||||
|
||||
override fun createAppUtils(context: Context) = AppUtils(context, AppFileProvider.AUTHORITY)
|
||||
|
||||
override fun createRuntime() = super.createRuntime().apply {
|
||||
putProperty("class.settings", SettingsActivity::class.java)
|
||||
putProperty("class.console", LogActivity::class.java)
|
||||
}
|
||||
|
||||
private fun initMLKit(application: Application) {
|
||||
// @Hint by SuperMonster003 on Nov 26, 2023.
|
||||
// ! To avoid the exception as below (only happened on packaged apps).
|
||||
// # IllegalStateException: MlKitContext has not been initialized.
|
||||
// ! zh-CN:
|
||||
// ! 用于避免以下异常 (仅发生在打包应用中).
|
||||
// # IllegalStateException: MlKitContext 未初始化.
|
||||
MlKit.initialize(application)
|
||||
Log.d(TAG, "MLKit initialized")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "AutoJsInrt"
|
||||
|
||||
val instance
|
||||
get() = AutoJsApp.instance
|
||||
|
||||
|
||||
@@ -52,9 +52,12 @@ object WrappedShizuku {
|
||||
}
|
||||
}
|
||||
|
||||
private val mUserServiceArgs = Shizuku.UserServiceArgs(ComponentName(BuildConfig.APPLICATION_ID, UserService::class.java.name))
|
||||
.processNameSuffix("shizuku-service-for-${BuildConfig.APPLICATION_ID.substringAfterLast(".")}")
|
||||
.daemon(false)
|
||||
private val mUserServiceArgs by lazy {
|
||||
val pkg = GlobalAppContext.get().packageName
|
||||
Shizuku.UserServiceArgs(ComponentName(pkg, UserService::class.java.name))
|
||||
.processNameSuffix("shizuku-service-for-${pkg.substringAfterLast(".")}")
|
||||
.daemon(false)
|
||||
}
|
||||
|
||||
private val mBinderReceivedListener = Shizuku.OnBinderReceivedListener {
|
||||
if (Shizuku.isPreV11()) {
|
||||
|
||||
Reference in New Issue
Block a user