mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
fix(YouTube/Swipe controls): swipe gesture working even after after using Lock screen
feature
This commit is contained in:
@ -14,6 +14,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.swipe.controls.fingerprints.HDRBrightnessFingerprint
|
||||
import app.revanced.patches.youtube.swipe.controls.fingerprints.SwipeControlsHostActivityFingerprint
|
||||
import app.revanced.patches.youtube.swipe.controls.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.utils.lockmodestate.LockModeStateHookPatch
|
||||
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch.contexts
|
||||
@ -27,6 +28,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
name = "Swipe controls",
|
||||
description = "Adds volume and brightness swipe controls.",
|
||||
dependencies = [
|
||||
LockModeStateHookPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
|
@ -0,0 +1,37 @@
|
||||
package app.revanced.patches.youtube.utils.lockmodestate
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patches.youtube.utils.lockmodestate.fingerprint.LockModeStateFingerprint
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
object LockModeStateHookPatch : BytecodePatch(
|
||||
setOf(LockModeStateFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LockModeStateFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex + 1, """
|
||||
invoke-static {v$insertRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setLockModeState(Ljava/lang/Enum;)V
|
||||
return-object v$insertRegister
|
||||
"""
|
||||
)
|
||||
removeInstruction(insertIndex)
|
||||
}
|
||||
} ?: throw LockModeStateFingerprint.exception
|
||||
|
||||
}
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$UTILS_PATH/LockModeStateHookPatch;"
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.patches.youtube.utils.lockmodestate.fingerprint
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object LockModeStateFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC.value,
|
||||
parameters = emptyList(),
|
||||
opcodes = listOf(Opcode.RETURN_OBJECT),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.name == "getLockModeStateEnum"
|
||||
}
|
||||
)
|
Reference in New Issue
Block a user