Skip to content

Commit 10d606a

Browse files
add AlwaysAllowMultiInstanceSplit
Co-authored-by: programminghoch10 <[email protected]>
1 parent e6e7cbb commit 10d606a

File tree

12 files changed

+108
-0
lines changed

12 files changed

+108
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AlwaysAllowMultiInstanceSplit
2+
3+
Allow all apps to be launched twice side-by-side in a split screen.
4+
5+
Undefined behaviour ahead!
6+
7+
![1-screenshot.png](../metadata/de.binarynoise.AlwaysAllowMultiInstanceSplit/en-US/images/phoneScreenshots/1-screenshot.png)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
plugins {
2+
alias(libs.plugins.buildlogic.android.application)
3+
alias(libs.plugins.buildlogic.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "de.binarynoise.AlwaysAllowMultiInstanceSplit"
8+
9+
defaultConfig {
10+
minSdk = 35
11+
targetSdk = 35
12+
}
13+
}
14+
15+
dependencies {
16+
implementation(project(":reflection"))
17+
implementation(project(":logger"))
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
5+
<application android:label="AlwaysAllowMultiInstanceSplit">
6+
<meta-data
7+
android:name="xposedmodule"
8+
android:value="true"
9+
/>
10+
<meta-data
11+
android:name="xposeddescription"
12+
android:value="Allow all apps to be launched twice in a split screen"
13+
/>
14+
<meta-data
15+
android:name="xposedminversion"
16+
android:value="53"
17+
/>
18+
<meta-data
19+
android:name="xposedscope"
20+
android:resource="@array/scope"
21+
/>
22+
</application>
23+
24+
</manifest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
de.binarynoise.AlwaysAllowMultiInstanceSplit.Hook
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package de.binarynoise.AlwaysAllowMultiInstanceSplit
2+
3+
import android.content.pm.ActivityInfo
4+
import de.binarynoise.logger.Logger.log
5+
import de.robv.android.xposed.IXposedHookLoadPackage
6+
import de.robv.android.xposed.XC_MethodReplacement
7+
import de.robv.android.xposed.XposedBridge
8+
import de.robv.android.xposed.XposedHelpers
9+
import de.robv.android.xposed.callbacks.XC_LoadPackage
10+
import de.robv.android.xposed.XC_MethodHook as MethodHook
11+
12+
class Hook : IXposedHookLoadPackage {
13+
14+
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
15+
log("handleLoadPackage(${lpparam.packageName} in process ${lpparam.processName})")
16+
17+
when (lpparam.packageName) {
18+
"com.android.systemui" -> {
19+
try {
20+
val cls = Class.forName("com.android.wm.shell.common.MultiInstanceHelper", false, lpparam.classLoader)
21+
XposedBridge.hookAllMethods(cls, "supportsMultiInstanceSplit", XC_MethodReplacement.returnConstant(true))
22+
log("Hooked com.android.wm.shell.common.MultiInstanceHelper::supportsMultiInstanceSplit")
23+
} catch (e: Throwable) {
24+
log("Failed to hook com.android.wm.shell.common.MultiInstanceHelper::supportsMultiInstanceSplit", e)
25+
}
26+
}
27+
"android" -> {
28+
try {
29+
val cls = Class.forName("com.android.server.wm.ActivityStarter", false, lpparam.classLoader)
30+
XposedBridge.hookAllMethods(cls, "executeRequest", object : MethodHook() {
31+
override fun beforeHookedMethod(param: MethodHookParam) {
32+
val request = param.args[0]
33+
val aInfo = XposedHelpers.getObjectField(request, "activityInfo") as ActivityInfo
34+
aInfo.launchMode = ActivityInfo.LAUNCH_MULTIPLE
35+
}
36+
})
37+
log("Hooked com.android.server.wm.ActivityStarter::executeRequest")
38+
} catch (e: Throwable) {
39+
log("Failed to hook com.android.server.wm.ActivityStarter::executeRequest", e)
40+
}
41+
}
42+
}
43+
}
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string-array name="scope">
4+
<item>android</item>
5+
<item>com.android.systemui</item>
6+
</string-array>
7+
</resources>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A collection of small Xposed Modules.
55
<!--@formatter:off-->
66
| Module | Author | Description | Releases |
77
|-|-|-|-|
8+
| [AlwaysAllowMultiInstanceSplit](AlwaysAllowMultiInstanceSplit) | [@binarynoise](https://github.com/binarynoise) & [@programminghoch10](https://github.com/programminghoch10) | Allow all apps to be launched twice in a split screen | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) |
89
| [AnimationScaleMod](AnimationScaleMod) | [@programminghoch10](https://github.com/programminghoch10) | Add more animation scale multipliers | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AnimationScaleMod) |
910
| [AntiBrightnessChange](AntiBrightnessChange) | [@programminghoch10](https://github.com/programminghoch10) | Prevent apps from changing display brightness | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AntiBrightnessChange) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/com.programminghoch10.AntiBrightnessChange) |
1011
| [AutomaticAdvancedSettingsExpander](AutomaticAdvancedSettingsExpander) | [@binarynoise](https://github.com/binarynoise) | Automatically expands the advanced settings in the Settings app | [GitHub](https://github.com/binarynoise/XposedModulets/releases?q=AutomaticAdvancedSettingsExpander) [IzzyOnDroid](https://apt.izzysoft.de/fdroid/index/apk/de.binarynoise.AutomaticAdvancedSettingsExpander) |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Allow all apps to be launched twice side-by-side in a split screen.
2+
3+
Undefined behaviour ahead!
91.6 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow all apps to be launched twice in a split screen

0 commit comments

Comments
 (0)