Skip to content

Commit

Permalink
Youtube Music:
Browse files Browse the repository at this point in the history
- HideMusicVideoAds
- MinimizedPlayback
- RemoveUpgradeButton
- HideGetPremium
  • Loading branch information
chsbuffer committed Jun 16, 2024
0 parents commit 5bcc3c5
Show file tree
Hide file tree
Showing 23 changed files with 1,005 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.idea
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
55 changes: 55 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
}

android {
namespace = "io.github.chsbuffer.revancedxposed"
compileSdk = 34

defaultConfig {
applicationId = "io.github.chsbuffer.revancedxposed"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
ndk {
abiFilters.add("arm64-v8a")
}
}

packagingOptions.resources {
excludes.addAll(
arrayOf(
"META-INF/**", "kotlin/**", "**.bin"
)
)
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("debug")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
compileOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"
)
}
}
}

dependencies {
implementation(libs.dexkit)
compileOnly(libs.xposed)
}
24 changes: 24 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

-optimizations
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

-keep class io.github.chsbuffer.revancedxposed.MainHook

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
26 changes: 26 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/MainTheme"
tools:targetApi="31">

<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="@string/app_description" />
<meta-data
android:name="xposedminversion"
android:value="93" />
<meta-data
android:name="xposedscope"
android:resource="@array/scope" />

</application>
</manifest>
1 change: 1 addition & 0 deletions app/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.github.chsbuffer.revancedxposed.MainHook
34 changes: 34 additions & 0 deletions app/src/main/java/io/github/chsbuffer/revancedxposed/MainHook.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.github.chsbuffer.revancedxposed

import android.app.Application
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
import kotlin.system.measureTimeMillis

class MainHook : IXposedHookLoadPackage {
override fun handleLoadPackage(lpparam: LoadPackageParam) {
when (lpparam.packageName) {
"com.google.android.apps.youtube.music" -> {
inContext(lpparam) { app ->
val t = measureTimeMillis {
MusicHook(app, lpparam).Hook()
}
XposedBridge.log("Youtube Music handleLoadPackage: ${t}ms")
}
}
}
}
}

fun inContext(lpparam: LoadPackageParam, f: (Application) -> Unit) {
val appClazz = XposedHelpers.findClass(lpparam.appInfo.className, lpparam.classLoader)
XposedBridge.hookMethod(appClazz.getMethod("onCreate"), object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
val app = param.thisObject as Application
f(app)
}
})
}
Loading

1 comment on commit 5bcc3c5

@chsbuffer
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.