chore: lint code

This commit is contained in:
inotia00 2024-09-28 22:57:23 +09:00
parent 455886930c
commit 0642d18a89
3 changed files with 26 additions and 9 deletions

View File

@ -72,8 +72,12 @@ object CairoSplashAnimationPatch : BytecodePatch(
reference?.name == "findViewById" && reference?.name == "findViewById" &&
reference.definingClass != "Landroid/view/View;" reference.definingClass != "Landroid/view/View;"
} }
val freeRegister = getInstruction<FiveRegisterInstruction>(viewStubFindViewByIdIndex).registerD val freeRegister =
val jumpIndex = indexOfFirstInstructionReversedOrThrow(viewStubFindViewByIdIndex, Opcode.IGET_OBJECT) getInstruction<FiveRegisterInstruction>(viewStubFindViewByIdIndex).registerD
val jumpIndex = indexOfFirstInstructionReversedOrThrow(
viewStubFindViewByIdIndex,
Opcode.IGET_OBJECT
)
addInstructionsWithLabels( addInstructionsWithLabels(
insertIndex, """ insertIndex, """

View File

@ -19,8 +19,6 @@ object BottomSheetHookPatch : BytecodePatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// region patch for set player type
val bottomSheetClass = val bottomSheetClass =
BottomSheetBehaviorFingerprint.resultOrThrow().mutableMethod.definingClass BottomSheetBehaviorFingerprint.resultOrThrow().mutableMethod.definingClass

View File

@ -44,7 +44,10 @@ abstract class MultiMethodFingerprint(
* @param context The [BytecodeContext] to host proxies. * @param context The [BytecodeContext] to host proxies.
* @return True if the resolution was successful, false otherwise. * @return True if the resolution was successful, false otherwise.
*/ */
fun Iterable<MultiMethodFingerprint>.resolve(context: BytecodeContext, classes: Iterable<ClassDef>) { fun Iterable<MultiMethodFingerprint>.resolve(
context: BytecodeContext,
classes: Iterable<ClassDef>
) {
for (fingerprint in this) { // For each fingerprint for (fingerprint in this) { // For each fingerprint
if (fingerprint.resolved) continue if (fingerprint.resolved) continue
for (classDef in classes) // search through all classes for the fingerprint for (classDef in classes) // search through all classes for the fingerprint
@ -75,10 +78,17 @@ abstract class MultiMethodFingerprint(
* @param context The [BytecodeContext] to host proxies. * @param context The [BytecodeContext] to host proxies.
* @return True if the resolution was successful or if the fingerprint is already resolved, false otherwise. * @return True if the resolution was successful or if the fingerprint is already resolved, false otherwise.
*/ */
fun MultiMethodFingerprint.resolve(context: BytecodeContext, method: Method, forClass: ClassDef): Boolean { fun MultiMethodFingerprint.resolve(
context: BytecodeContext,
method: Method,
forClass: ClassDef
): Boolean {
val methodFingerprint = this val methodFingerprint = this
if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType)) if (methodFingerprint.returnType != null && !method.returnType.startsWith(
methodFingerprint.returnType
)
)
return false return false
if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags) if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags)
@ -102,7 +112,11 @@ abstract class MultiMethodFingerprint(
) return false ) return false
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION") @Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method, forClass)) if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(
method,
forClass
)
)
return false return false
val stringsScanResult = if (methodFingerprint.strings != null) { val stringsScanResult = if (methodFingerprint.strings != null) {
@ -118,7 +132,8 @@ abstract class MultiMethodFingerprint(
instruction.opcode != Opcode.CONST_STRING_JUMBO instruction.opcode != Opcode.CONST_STRING_JUMBO
) return@forEachIndexed ) return@forEachIndexed
val string = ((instruction as ReferenceInstruction).reference as StringReference).string val string =
((instruction as ReferenceInstruction).reference as StringReference).string
val index = stringsList.indexOfFirst(string::contains) val index = stringsList.indexOfFirst(string::contains)
if (index == -1) return@forEachIndexed if (index == -1) return@forEachIndexed