Skip to content

Commit 21d0c85

Browse files
fix: Turn off flag that interferes with back button functionality
1 parent 4afe40f commit 21d0c85

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/Fingerprints.kt

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package app.revanced.patches.youtube.misc.fix.backtoexitgesture
33
import com.android.tools.smali.dexlib2.Opcode
44
import com.android.tools.smali.dexlib2.AccessFlags
55
import app.revanced.patcher.fingerprint
6+
import app.revanced.util.literal
67

78
internal val onBackPressedFingerprint = fingerprint {
89
returns("V")
@@ -66,3 +67,10 @@ internal val recyclerViewTopScrollingParentFingerprint = fingerprint {
6667
Opcode.NEW_INSTANCE,
6768
)
6869
}
70+
71+
internal val doubleBackToExitFeatureFlagFingerprint = fingerprint {
72+
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
73+
returns("Z")
74+
parameters()
75+
literal { 45385099L }
76+
}

patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
44
import app.revanced.patcher.patch.bytecodePatch
55
import app.revanced.util.getReference
66
import app.revanced.util.indexOfFirstInstructionOrThrow
7+
import app.revanced.util.returnLate
78
import com.android.tools.smali.dexlib2.Opcode
89
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
910

@@ -45,5 +46,9 @@ internal val fixBackToExitGesturePatch = bytecodePatch(
4546
"invoke-static { p0 }, $EXTENSION_CLASS_DESCRIPTOR->onBackPressed(Landroid/app/Activity;)V"
4647
)
4748
}
49+
50+
// Disable the stock YouTube double back to exit. If this flag is on,
51+
// then using the back button to exit a video can sometimes cause the app to close.
52+
doubleBackToExitFeatureFlagFingerprint.method.returnLate(true)
4853
}
4954
}

0 commit comments

Comments
 (0)