This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
aweme/src/main/java/com/ss/android/ugc/aweme/video/simplayer/ISimPlayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.ss.android.ugc.aweme.video.simplayer; | ||
|
||
public interface ISimPlayer { | ||
void setSpeed(float speed); | ||
} |
64 changes: 64 additions & 0 deletions
64
core/src/main/java/io/github/fplus/core/helper/SpeedPlayHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package io.github.fplus.core.helper | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import com.freegang.extension.findFieldGetValue | ||
import com.freegang.extension.findMethodInvoke | ||
import com.ss.android.ugc.aweme.video.simplayer.ISimPlayer | ||
import io.github.xpler.core.findClass | ||
import io.github.xpler.core.log.XplerLog | ||
import io.github.xpler.core.lpparam | ||
import io.github.xpler.loader.hostClassloader | ||
|
||
// 暂存 | ||
@ExperimentalStdlibApi | ||
object SpeedPlayHelper { | ||
|
||
// 30.5.0_300501 | ||
@ExperimentalStdlibApi | ||
fun setSpeed(speed: Float) { | ||
runCatching { | ||
val helperClazz = lpparam.findClass("X.0BRk") // future | ||
val helper = helperClazz.findFieldGetValue<Any> { type(helperClazz) } | ||
val simPlayer = helper?.findMethodInvoke<ISimPlayer> { returnType(ISimPlayer::class.java) } | ||
simPlayer?.setSpeed(speed) | ||
}.onFailure { | ||
XplerLog.e(it) | ||
} | ||
} | ||
|
||
// 30.5.0_300501 | ||
@ExperimentalStdlibApi | ||
fun setSpeed(context: Context, aid: String, fragmentTag: String, speed: Float) { | ||
XplerLog.i("aid: $aid", "fragmentTag: $fragmentTag", "speed: $speed") | ||
|
||
val speedViewModelClazz = lpparam.findClass("X.0BUf", hostClassloader) // future | ||
val activityUtilClazz = lpparam.findClass("com.bytedance.bdp.bdpbase.util.ActivityUtil", hostClassloader) | ||
val tripleClazz = lpparam.findClass("kotlin.Triple", hostClassloader) | ||
|
||
val activityIfNecessary = activityUtilClazz.findMethodInvoke<Activity>(context) { name("getActivityIfNecessary") } | ||
if (activityIfNecessary != null) { | ||
val viewModel = getViewModel(activityIfNecessary, speedViewModelClazz) | ||
val liveData = viewModel?.findFieldGetValue<Any> { name("LIZ") } // future | ||
|
||
val triple = tripleClazz | ||
.getConstructor(Any::class.java, Any::class.java, Any::class.java) | ||
.newInstance(aid, fragmentTag, speed) | ||
|
||
liveData?.findMethodInvoke<Any>(triple) { name("setValue") } | ||
} else { | ||
XplerLog.e("speed ViewModel not found!") | ||
} | ||
} | ||
|
||
// activity must be extends FragmentActivity | ||
private fun getViewModel(activity: Activity, vm: Class<*>): Any? { | ||
val viewModelProvidersClazz = lpparam.findClass("androidx.lifecycle.ViewModelProviders", hostClassloader) | ||
val fragmentActivityClazz = lpparam.findClass("androidx.fragment.app.FragmentActivity", hostClassloader) | ||
val viewModelProvider = viewModelProvidersClazz.findMethodInvoke<Any>(activity) { | ||
name("of") | ||
parameterTypes(listOf(fragmentActivityClazz)) | ||
} | ||
return viewModelProvider?.findMethodInvoke<Any>(vm) { name("get") } | ||
} | ||
} |
14 changes: 2 additions & 12 deletions
14
core/src/main/java/io/github/fplus/core/hook/HCrashTolerance.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters