Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fake_non_multiwindow #1353

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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