fix(Wide search bar): Fix patching 19.16.39

This commit is contained in:
LisoUseInAIKyrios 2025-04-20 13:27:55 +02:00
parent 255cb5874c
commit 433dbc3bf8
2 changed files with 11 additions and 12 deletions

View File

@ -11,8 +11,8 @@ internal val setWordmarkHeaderFingerprint = fingerprint {
returns("V")
parameters("Landroid/widget/ImageView;")
custom { methodDef, _ ->
methodDef.containsLiteralInstruction(ytWordmarkHeaderId) &&
methodDef.containsLiteralInstruction(ytPremiumWordmarkHeaderId)
methodDef.containsLiteralInstruction(ytPremiumWordmarkHeaderId) &&
methodDef.containsLiteralInstruction(ytWordmarkHeaderId)
}
}

View File

@ -17,7 +17,6 @@ import app.revanced.util.addInstructionsAtControlFlowLabel
import app.revanced.util.findInstructionIndicesReversedOrThrow
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@ -48,7 +47,7 @@ private val wideSearchbarResourcePatch = resourcePatch {
actionBarRingoId = resourceMappings[
"layout",
"action_bar_ringo_background",
"action_bar_ringo",
]
}
}
@ -111,12 +110,11 @@ val wideSearchbarPatch = bytecodePatch(
// Fix missing left padding when using wide searchbar.
wideSearchbarLayoutFingerprint.method.apply {
val layoutIndex = indexOfFirstLiteralInstructionOrThrow(actionBarRingoId)
val inflateIndex = indexOfFirstInstructionOrThrow(layoutIndex) {
findInstructionIndicesReversedOrThrow {
val reference = getReference<MethodReference>()
reference?.definingClass == "Landroid/view/LayoutInflater;"
&& reference.name == "inflate"
}
}.forEach { inflateIndex ->
val register = getInstruction<OneRegisterInstruction>(inflateIndex + 1).registerA
addInstruction(
@ -126,3 +124,4 @@ val wideSearchbarPatch = bytecodePatch(
}
}
}
}