6.7.0 - Alpha6 - 修复 APK 文件类型信息对话框可能无法获取应用名称及 SDK 信息的问题
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
"部分设备无法正常初始化 MLKit Google OCR 的问题 (试修) _[`issue #8`](http://issues.autojs6.com/8#issuecomment-3117061768)_",
|
"部分设备无法正常初始化 MLKit Google OCR 的问题 (试修) _[`issue #8`](http://issues.autojs6.com/8#issuecomment-3117061768)_",
|
||||||
"ErrorDialogActivity 可能无法正常启动的问题 _[`issue #414`](http://issues.autojs6.com/414)_ _[`issue #340`](http://issues.autojs6.com/340#issuecomment-2973485826)_",
|
"ErrorDialogActivity 可能无法正常启动的问题 _[`issue #414`](http://issues.autojs6.com/414)_ _[`issue #340`](http://issues.autojs6.com/340#issuecomment-2973485826)_",
|
||||||
"崩溃报告页面复制详细信息功能失效的问题",
|
"崩溃报告页面复制详细信息功能失效的问题",
|
||||||
|
"APK 文件类型信息对话框可能无法获取应用名称及 SDK 信息的问题",
|
||||||
"构建工具启用 isCleanup[Paddle/Rapid]Ocr 配置选项时无法正常完成 Rebuild Project 任务的问题"
|
"构建工具启用 isCleanup[Paddle/Rapid]Ocr 配置选项时无法正常完成 Rebuild Project 任务的问题"
|
||||||
],
|
],
|
||||||
"improvement": [
|
"improvement": [
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ object MaterialDialogExtensions {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun MaterialDialog.makeTextCopyable(textView: TextView?, textValue: String? = textView?.text?.toString()) {
|
fun MaterialDialog.makeTextCopyable(textView: TextView?, textValue: String? = textView?.text?.toString()) {
|
||||||
if (textValue != null) {
|
if (!textValue.isNullOrBlank()) {
|
||||||
val context = this.context
|
val context = this.context
|
||||||
textView?.setOnClickListener {
|
textView?.setOnClickListener {
|
||||||
ClipboardUtils.setClip(context, textValue)
|
ClipboardUtils.setClip(context, textValue)
|
||||||
@@ -45,10 +45,17 @@ object MaterialDialogExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun MaterialDialog.setCopyableTextIfAbsent(textView: TextView, textValue: String?, suffix: String? = null) {
|
fun MaterialDialog.setCopyableTextIfAbsent(textView: TextView, textValue: String?, suffix: String? = null) {
|
||||||
if (textView.text == context.getString(R.string.ellipsis_six)) {
|
when {
|
||||||
textView.text = textValue.takeUnless { it.isNullOrBlank() }?.let { it + (suffix ?: "") } ?: context.getString(R.string.text_unknown)
|
textValue.isNullOrBlank() -> {
|
||||||
|
if (textView.isNullOrBlank() || textView.isEllipsisSix()) {
|
||||||
|
textView.setUnknown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textView.isNullOrBlank() || textView.isEllipsisSix() || textView.isUnknown() -> {
|
||||||
|
textView.text = textValue + (suffix ?: "")
|
||||||
|
this.makeTextCopyable(textView, textValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.makeTextCopyable(textView, textValue)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun MaterialDialog.setCopyableTextIfAbsent(textView: TextView, scope: CoroutineScope, f: () -> String?) {
|
fun MaterialDialog.setCopyableTextIfAbsent(textView: TextView, scope: CoroutineScope, f: () -> String?) {
|
||||||
@@ -65,8 +72,15 @@ object MaterialDialogExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun MaterialDialog.setCopyableText(textView: TextView, textValue: String?) {
|
fun MaterialDialog.setCopyableText(textView: TextView, textValue: String?) {
|
||||||
textView.text = textValue.takeUnless { it.isNullOrBlank() } ?: context.getString(R.string.text_unknown)
|
when {
|
||||||
this.makeTextCopyable(textView, textValue)
|
textValue.isNullOrBlank() -> {
|
||||||
|
textView.setUnknown()
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
textView.text = textValue
|
||||||
|
this.makeTextCopyable(textView, textValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -79,4 +93,9 @@ object MaterialDialogExtensions {
|
|||||||
it.widgetColor(ThemeColorHelper.getThemeColorStateList(context))
|
it.widgetColor(ThemeColorHelper.getThemeColorStateList(context))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun TextView.setUnknown() = setText(R.string.text_unknown)
|
||||||
|
private fun TextView.isUnknown() = text == context.getString(R.string.text_unknown)
|
||||||
|
private fun TextView.isEllipsisSix() = text == context.getString(R.string.ellipsis_six)
|
||||||
|
private fun TextView.isNullOrBlank() = text.isNullOrBlank()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ object ApkInfoDialogManager {
|
|||||||
scope.launch {
|
scope.launch {
|
||||||
val apkInfoDeferred = async(Dispatchers.IO) { getApkInfo(apkFile) }
|
val apkInfoDeferred = async(Dispatchers.IO) { getApkInfo(apkFile) }
|
||||||
val packageInfoDeferred = async(Dispatchers.IO) { getPackageInfo(packageManager, apkFilePath) }
|
val packageInfoDeferred = async(Dispatchers.IO) { getPackageInfo(packageManager, apkFilePath) }
|
||||||
|
val sysBasicDeferred = async(Dispatchers.IO) { getBasicInfoFromPackageArchive(context, apkFilePath) }
|
||||||
|
|
||||||
val firstPackageName: String? = select {
|
val firstPackageName: String? = select {
|
||||||
apkInfoDeferred.onAwait { it?.packageName }
|
apkInfoDeferred.onAwait { it?.packageName }
|
||||||
@@ -115,6 +116,13 @@ object ApkInfoDialogManager {
|
|||||||
dialog.setCopyableTextIfAbsent(binding.fileSizeValue, this) { PFiles.getHumanReadableSize(apkFile.length()) }
|
dialog.setCopyableTextIfAbsent(binding.fileSizeValue, this) { PFiles.getHumanReadableSize(apkFile.length()) }
|
||||||
dialog.setCopyableTextIfAbsent(binding.signatureSchemeValue, this) { getApkSignatureInfo(apkFile) }
|
dialog.setCopyableTextIfAbsent(binding.signatureSchemeValue, this) { getApkSignatureInfo(apkFile) }
|
||||||
|
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
val sys = sysBasicDeferred.await()
|
||||||
|
dialog.setCopyableTextIfAbsent(binding.labelNameValue, sys?.label)
|
||||||
|
dialog.setCopyableTextIfAbsent(binding.minSdkValue, sys?.minSdk?.toString())
|
||||||
|
dialog.setCopyableTextIfAbsent(binding.targetSdkValue, sys?.targetSdk?.toString())
|
||||||
|
}
|
||||||
|
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
val apkInfo = apkInfoDeferred.await()
|
val apkInfo = apkInfoDeferred.await()
|
||||||
|
|
||||||
@@ -255,6 +263,26 @@ object ApkInfoDialogManager {
|
|||||||
}
|
}
|
||||||
}.getOrNull()
|
}.getOrNull()
|
||||||
|
|
||||||
|
private fun getBasicInfoFromPackageArchive(context: Context, apkPath: String): SysBasicInfo? = runCatching {
|
||||||
|
val pm = context.packageManager
|
||||||
|
val pi = pm.getPackageArchiveInfo(apkPath, GET_META_DATA) ?: return@runCatching null
|
||||||
|
val ai = pi.applicationInfo?.apply {
|
||||||
|
sourceDir = apkPath
|
||||||
|
publicSourceDir = apkPath
|
||||||
|
}
|
||||||
|
SysBasicInfo(
|
||||||
|
label = ai?.loadLabel(pm)?.toString(),
|
||||||
|
minSdk = this.runCatching { ai?.minSdkVersion }.getOrNull()?.takeIf { it != 0 },
|
||||||
|
targetSdk = ai?.targetSdkVersion?.takeIf { it != 0 },
|
||||||
|
)
|
||||||
|
}.getOrNull()
|
||||||
|
|
||||||
|
private data class SysBasicInfo(
|
||||||
|
val label: String?,
|
||||||
|
val minSdk: Int?,
|
||||||
|
val targetSdk: Int?,
|
||||||
|
)
|
||||||
|
|
||||||
private data class ApkInfo(
|
private data class ApkInfo(
|
||||||
val label: String?,
|
val label: String?,
|
||||||
val packageName: String?,
|
val packageName: String?,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Thu Oct 02 12:47:18 CST 2025
|
#Thu Oct 02 17:27:13 CST 2025
|
||||||
BUILD_TIME=1759380438871
|
BUILD_TIME=1759397233140
|
||||||
COMPILE_SDK_VERSION=36
|
COMPILE_SDK_VERSION=36
|
||||||
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
||||||
IMAGE_QUANT_NDK_VERSION=26.1.10909125
|
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
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=36
|
TARGET_SDK_VERSION=36
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=3394
|
VERSION_BUILD=3395
|
||||||
VERSION_NAME=6.7.0 Alpha6
|
VERSION_NAME=6.7.0 Alpha6
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user