Skip to content

Commit e831abb

Browse files
programminghoch10binarynoise
authored andcommitted
add RotationControl
1 parent be020e8 commit e831abb

10 files changed

Lines changed: 94 additions & 1 deletion

File tree

RotationControl/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# RotationControl
2+
3+
This will force full sensor rotation on selected packages.

RotationControl/build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id("com.android.application")
3+
}
4+
5+
android {
6+
val packageName = "com.programminghoch10.RotationControl"
7+
namespace = packageName
8+
9+
defaultConfig {
10+
applicationId = packageName
11+
minSdk = 24
12+
targetSdk = 33
13+
}
14+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
>
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@android:drawable/ic_menu_rotate"
9+
android:label="RotationControl"
10+
>
11+
<meta-data
12+
android:name="xposedmodule"
13+
android:value="true"
14+
/>
15+
<meta-data
16+
android:name="xposeddescription"
17+
android:value="Force rotation for selected packages."
18+
/>
19+
<meta-data
20+
android:name="xposedminversion"
21+
android:value="82"
22+
/>
23+
<meta-data
24+
android:name="xposedscope"
25+
android:resource="@array/scope"
26+
/>
27+
</application>
28+
</manifest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.programminghoch10.RotationControl.XposedHook
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.programminghoch10.RotationControl;
2+
3+
import android.app.Activity;
4+
import android.content.pm.ActivityInfo;
5+
import android.view.Window;
6+
7+
import de.robv.android.xposed.IXposedHookLoadPackage;
8+
import de.robv.android.xposed.XC_MethodHook;
9+
import de.robv.android.xposed.XposedHelpers;
10+
import de.robv.android.xposed.callbacks.XC_LoadPackage;
11+
12+
public class XposedHook implements IXposedHookLoadPackage {
13+
@Override
14+
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
15+
XposedHelpers.findAndHookMethod(Activity.class,
16+
"setRequestedOrientation", int.class, new XC_MethodHook() {
17+
@Override
18+
protected void beforeHookedMethod(MethodHookParam param) {
19+
param.args[0] = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
20+
}
21+
}
22+
);
23+
XposedHelpers.findAndHookMethod("com.android.internal.policy.PhoneWindow", lpparam.classLoader,
24+
"generateLayout", "com.android.internal.policy.DecorView", new XC_MethodHook() {
25+
@Override
26+
protected void beforeHookedMethod(MethodHookParam param) {
27+
((Activity) ((Window) param.thisObject).getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
28+
}
29+
}
30+
);
31+
}
32+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string-array name="scope">
4+
<item>com.android.gallery3d</item>
5+
<item>com.google.android.apps.photos</item>
6+
<item>com.google.android.youtube</item>
7+
<item>com.netflix.mediaclient</item>
8+
<item>com.simplemobiletools.gallery.pro</item>
9+
<item>com.simplemobiletools.gallery</item>
10+
<item>org.jellyfin.mobile</item>
11+
</string-array>
12+
</resources>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This will force full sensor rotation on selected packages.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This will force full sensor rotation on selected packages.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RotationControl

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include(":FreeNotifications")
2727
include(":MotionEventMod")
2828
include(":MuteSlf4jWarnings")
2929
include(":ResetAllNotificationChannels")
30-
30+
include(":RotationControl")
3131
include(":reflection")
3232
include(":logger")
3333

0 commit comments

Comments
 (0)