Skip to content

Commit

Permalink
feat: fake_non_multiwindow (yujincheng08#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
duzhaokun123 authored Dec 27, 2023
1 parent 3999e61 commit 81827e2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/me/iacn/biliroaming/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
startHook(PublishToFollowingHook(lpparam.classLoader))
startHook(UposReplaceHook(lpparam.classLoader))
startHook(SpeedHook(lpparam.classLoader))
startHook(MultiWindowHook(lpparam.classLoader))
}

lpparam.processName.endsWith(":web") -> {
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/me/iacn/biliroaming/hook/MultiWindowHook.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.iacn.biliroaming.hook

import android.app.Activity
import me.iacn.biliroaming.utils.Log
import me.iacn.biliroaming.utils.hookBeforeAllMethods
import me.iacn.biliroaming.utils.replaceMethod
import me.iacn.biliroaming.utils.sPrefs

class MultiWindowHook(mClassLoader: ClassLoader) : BaseHook(mClassLoader) {
override fun startHook() {
if (sPrefs.getBoolean("fake_non_multiwindow", false).not()) return
Log.d("startHook: MultiWindowHook")
Activity::class.java
.getDeclaredMethod("isInMultiWindowMode")
.replaceMethod { false }
Activity::class.java
.hookBeforeAllMethods("onMultiWindowModeChanged") { param ->
param.args[0] = false
}
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,6 @@
<string name="target_comment_author_level_title">屏蔽指定等级以下用户评论</string>
<string name="pegasus_cover_ratio_title">推荐封面比例</string>
<string name="pegasus_cover_ratio_summary">自定义首页推荐小卡(双列显示的)封面比例</string>
<string name="fake_non_multiwindow_title">伪装处于非多窗口模式</string>
<string name="fake_non_multiwindow_summary">比如视频多窗口模式下全屏</string>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/xml/prefs_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@
android:summary="@string/pegasus_cover_ratio_summary"
android:title="@string/pegasus_cover_ratio_title" />

<SwitchPreference
android:defaultValue="false"
android:key="fake_non_multiwindow"
android:title="@string/fake_non_multiwindow_title"
android:summary="@string/fake_non_multiwindow_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_backup">
<Preference
Expand Down

0 comments on commit 81827e2

Please sign in to comment.