Merge remote-tracking branch 'upstream/dev' into feat/patcher_instruction_filters
# Conflicts: # patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt
This commit is contained in:
commit
db5b79ddbb
2 changed files with 34 additions and 19 deletions
|
|
@ -5,6 +5,7 @@ import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -72,6 +73,17 @@ public class CustomBrandingPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injection point.
|
||||||
|
*/
|
||||||
|
public static View getLottieViewOrNull(View lottieStartupView) {
|
||||||
|
if (BaseSettings.CUSTOM_BRANDING_ICON.get() == BrandingTheme.ORIGINAL) {
|
||||||
|
return lottieStartupView;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point.
|
* Injection point.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,24 @@
|
||||||
package app.revanced.patches.music.layout.branding
|
package app.revanced.patches.music.layout.branding
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
|
||||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_MAIN_ACTIVITY_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_MAIN_ACTIVITY_NAME
|
||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint
|
import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint
|
||||||
import app.revanced.patches.music.misc.settings.PreferenceScreen
|
import app.revanced.patches.music.misc.settings.PreferenceScreen
|
||||||
|
import app.revanced.patches.shared.layout.branding.EXTENSION_CLASS_DESCRIPTOR
|
||||||
import app.revanced.patches.shared.layout.branding.baseCustomBrandingPatch
|
import app.revanced.patches.shared.layout.branding.baseCustomBrandingPatch
|
||||||
|
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||||
|
import app.revanced.patches.shared.misc.mapping.getResourceId
|
||||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstInstructionReversed
|
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
||||||
|
|
||||||
private val disableSplashAnimationPatch = bytecodePatch {
|
private val disableSplashAnimationPatch = bytecodePatch {
|
||||||
|
|
||||||
|
|
@ -30,22 +33,22 @@ private val disableSplashAnimationPatch = bytecodePatch {
|
||||||
// but the animation is not always the same size as the launch screen and it's still
|
// but the animation is not always the same size as the launch screen and it's still
|
||||||
// barely shown. Instead turn off the animation entirely (app will also launch a little faster).
|
// barely shown. Instead turn off the animation entirely (app will also launch a little faster).
|
||||||
cairoSplashAnimationConfigFingerprint.method.apply {
|
cairoSplashAnimationConfigFingerprint.method.apply {
|
||||||
val insertIndex = indexOfFirstInstructionReversed(
|
val literalIndex = indexOfFirstLiteralInstructionOrThrow(
|
||||||
cairoSplashAnimationConfigFingerprint.instructionMatches.first().index
|
getResourceId(ResourceType.LAYOUT, "main_activity_launch_animation")
|
||||||
) {
|
)
|
||||||
this.opcode == Opcode.INVOKE_VIRTUAL &&
|
val checkCastIndex = indexOfFirstInstructionOrThrow(literalIndex) {
|
||||||
getReference<MethodReference>()?.name == "setContentView"
|
opcode == Opcode.CHECK_CAST &&
|
||||||
} + 1
|
getReference<TypeReference>()?.type == "Lcom/airbnb/lottie/LottieAnimationView;"
|
||||||
|
}
|
||||||
|
val register = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||||
|
|
||||||
val jumpIndex = indexOfFirstInstructionOrThrow(insertIndex) {
|
// If using a custom icon then set the lottie animation view to null to bypasses the startup animation.
|
||||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
addInstructions(
|
||||||
getReference<MethodReference>()?.parameterTypes?.firstOrNull() == "Ljava/lang/Runnable;"
|
checkCastIndex,
|
||||||
} + 1
|
"""
|
||||||
|
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getLottieViewOrNull(Landroid/view/View;)Landroid/view/View;
|
||||||
addInstructionsWithLabels(
|
move-result-object v$register
|
||||||
insertIndex,
|
"""
|
||||||
"goto :skip_animation",
|
|
||||||
ExternalLabel("skip_animation", getInstruction(jumpIndex))
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue