Skip to content

Commit

Permalink
chore: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Sep 28, 2024
1 parent 4558869 commit 0642d18
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ object CairoSplashAnimationPatch : BytecodePatch(
reference?.name == "findViewById" &&
reference.definingClass != "Landroid/view/View;"
}
val freeRegister = getInstruction<FiveRegisterInstruction>(viewStubFindViewByIdIndex).registerD
val jumpIndex = indexOfFirstInstructionReversedOrThrow(viewStubFindViewByIdIndex, Opcode.IGET_OBJECT)
val freeRegister =
getInstruction<FiveRegisterInstruction>(viewStubFindViewByIdIndex).registerD
val jumpIndex = indexOfFirstInstructionReversedOrThrow(
viewStubFindViewByIdIndex,
Opcode.IGET_OBJECT
)

addInstructionsWithLabels(
insertIndex, """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ object BottomSheetHookPatch : BytecodePatch(

override fun execute(context: BytecodeContext) {

// region patch for set player type

val bottomSheetClass =
BottomSheetBehaviorFingerprint.resultOrThrow().mutableMethod.definingClass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ abstract class MultiMethodFingerprint(
* @param context The [BytecodeContext] to host proxies.
* @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
if (fingerprint.resolved) continue
for (classDef in classes) // search through all classes for the fingerprint
Expand Down Expand Up @@ -75,10 +78,17 @@ abstract class MultiMethodFingerprint(
* @param context The [BytecodeContext] to host proxies.
* @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

if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType))
if (methodFingerprint.returnType != null && !method.returnType.startsWith(
methodFingerprint.returnType
)
)
return false

if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags)
Expand All @@ -102,7 +112,11 @@ abstract class MultiMethodFingerprint(
) return false

@Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method, forClass))
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(
method,
forClass
)
)
return false

val stringsScanResult = if (methodFingerprint.strings != null) {
Expand All @@ -118,7 +132,8 @@ abstract class MultiMethodFingerprint(
instruction.opcode != Opcode.CONST_STRING_JUMBO
) 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)
if (index == -1) return@forEachIndexed

Expand Down

0 comments on commit 0642d18

Please sign in to comment.