You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.
To demonstrate this issue, suppose instead of an adaptive icon, I use VectorDrawable for API 24:
android:icon="@drawable/ic_launcher_foreground"
Doing so, I can see that it thinks it's an AdaptiveIcon, even though it's not, and thus I can't get its data, and of course it doesn't have foreground and background, and will crash if you try to use "path" or "isFile":
val cachePath = externalCacheDir?.absolutePath ?: cacheDir.absolutePath
val cacheDir =File(cachePath, "apks")
val packageInfo = packageManager.getPackageInfo(packageName, 0)
val originalApkFile =File(packageInfo.applicationInfo.publicSourceDir)
val target =File(cacheDir, originalApkFile.name)
target.delete()
originalApkFile.copyTo(target)
val apkFile =ApkFile(target.absolutePath)
apkFile.preferredLocale =Locale.getDefault()
val apkMeta = apkFile.apkMeta
val allIcons = apkFile.allIcons
for (icon in allIcons) {
when (icon) {
isAdaptiveIcon-> {
Log.d("AppLog", "AdaptiveIcon: $icon")
}
isColorIcon-> {
Log.d("AppLog", "ColorIcon: $icon")
}
is net.dongliu.apk.parser.bean.Icon-> {
Log.d("AppLog", "Icon: $icon")
}
}
}
To demonstrate this issue, suppose instead of an adaptive icon, I use VectorDrawable for API 24:
Doing so, I can see that it thinks it's an AdaptiveIcon, even though it's not, and thus I can't get its data, and of course it doesn't have foreground and background, and will crash if you try to use "path" or "isFile":
Attached sample.
My Application.zip
The text was updated successfully, but these errors were encountered: