fix(Patching): multi-install detection
Add attributes to patched manifests for identifying Aliucord installations.
This commit is contained in:
parent
ae9a9c7bad
commit
7737d2aaa5
2 changed files with 11 additions and 1 deletions
|
|
@ -101,6 +101,7 @@ object ManifestPatcher {
|
||||||
private var addLegacyStorage = true
|
private var addLegacyStorage = true
|
||||||
private var addUseEmbeddedDex = true
|
private var addUseEmbeddedDex = true
|
||||||
private var addExtractNativeLibs = true
|
private var addExtractNativeLibs = true
|
||||||
|
private var addMetadata = true
|
||||||
|
|
||||||
override fun attr(ns: String?, name: String, resourceId: Int, type: Int, value: Any?) {
|
override fun attr(ns: String?, name: String, resourceId: Int, type: Int, value: Any?) {
|
||||||
if (name == NETWORK_SECURITY_CONFIG) return
|
if (name == NETWORK_SECURITY_CONFIG) return
|
||||||
|
|
@ -114,6 +115,15 @@ object ManifestPatcher {
|
||||||
override fun child(ns: String?, name: String): NodeVisitor {
|
override fun child(ns: String?, name: String): NodeVisitor {
|
||||||
val visitor = super.child(ns, name)
|
val visitor = super.child(ns, name)
|
||||||
|
|
||||||
|
// Adds a <meta-data> tag to make multi-install detection by HomeScreen work
|
||||||
|
if (addMetadata) {
|
||||||
|
addMetadata = false
|
||||||
|
super.child(ANDROID_NAMESPACE, "meta-data").apply {
|
||||||
|
attr(ANDROID_NAMESPACE, "name", android.R.attr.name, TYPE_STRING, "isAliucord")
|
||||||
|
attr(ANDROID_NAMESPACE, "value", android.R.attr.value, TYPE_INT_BOOLEAN, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return when (name) {
|
return when (name) {
|
||||||
"activity" -> ReplaceAttrsVisitor(visitor, mapOf("label" to appName))
|
"activity" -> ReplaceAttrsVisitor(visitor, mapOf("label" to appName))
|
||||||
"provider" -> object : NodeVisitor(visitor) {
|
"provider" -> object : NodeVisitor(visitor) {
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class HomeModel(
|
||||||
val aliucordPackages = installedPackages
|
val aliucordPackages = installedPackages
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.filter {
|
.filter {
|
||||||
val isAliucordPkg = it.packageName == "com.aliucord"
|
val isAliucordPkg = it.packageName == "com.aliucord" // Legacy installer builds do not have isAliucord metadata marker
|
||||||
val hasAliucordMeta = it.applicationInfo?.metaData?.containsKey("isAliucord") == true
|
val hasAliucordMeta = it.applicationInfo?.metaData?.containsKey("isAliucord") == true
|
||||||
isAliucordPkg || hasAliucordMeta
|
isAliucordPkg || hasAliucordMeta
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue