Skip to content

Commit

Permalink
Misc fixes for OOS13
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 25, 2024
1 parent 786cb58 commit f594aa6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.dhd.oxygencustomizer.xposed.hooks.systemui.statusbar;

import static de.robv.android.xposed.XposedBridge.log;
import static de.robv.android.xposed.XposedHelpers.callMethod;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.findClass;
Expand All @@ -11,6 +12,7 @@

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import it.dhd.oxygencustomizer.BuildConfig;
import it.dhd.oxygencustomizer.xposed.XposedMods;

public class StatusbarIcons extends XposedMods {
Expand All @@ -29,27 +31,31 @@ public void updatePrefs(String... Key) {

@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
Class<?> OplusPhoneStatusBarPolicyExImpl = findClass("com.oplus.systemui.statusbar.phone.OplusPhoneStatusBarPolicyExImpl", lpparam.classLoader);

// private final void updateBluetoothIcon(int i, int i2, CharSequence charSequence, boolean z) {
findAndHookMethod(OplusPhoneStatusBarPolicyExImpl, "updateBluetoothIcon",
int.class,
int.class,
CharSequence.class,
boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
boolean enabled = (boolean) param.args[3];

if (!enabled || !hideBluetooth) return;

Object bluetoothController = getObjectField(param.thisObject, "bluetoothController");
boolean connected = (boolean) callMethod(bluetoothController, "isBluetoothConnected");

if (!connected)
param.setResult(connected);
}
});
try {
Class<?> OplusPhoneStatusBarPolicyExImpl = findClass("com.oplus.systemui.statusbar.phone.OplusPhoneStatusBarPolicyExImpl", lpparam.classLoader);

// private final void updateBluetoothIcon(int i, int i2, CharSequence charSequence, boolean z) {
findAndHookMethod(OplusPhoneStatusBarPolicyExImpl, "updateBluetoothIcon",
int.class,
int.class,
CharSequence.class,
boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
boolean enabled = (boolean) param.args[3];

if (!enabled || !hideBluetooth) return;

Object bluetoothController = getObjectField(param.thisObject, "bluetoothController");
boolean connected = (boolean) callMethod(bluetoothController, "isBluetoothConnected");

if (!connected)
param.setResult(connected);
}
});
} catch (Throwable t) {
log(this.getClass().getSimpleName() + " - Class Not Found " + t.toString());
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
try {
SystemPromptController = findClass("com.oplus.systemui.statusbar.controller.SystemPromptController", lpparam.classLoader);
} catch (Throwable t) {
SystemPromptController = findClass("com.oplusos.systemui.controller.SystemPromptController", lpparam.classLoader); // OOS 13
SystemPromptController = findClass("com.oplusos.systemui.statusbar.policy.SystemPromptController", lpparam.classLoader); // OOS 13
}
findAndHookMethod(SystemPromptController, "updateDeveloperMode", new XC_MethodHook() {
@Override
Expand Down

0 comments on commit f594aa6

Please sign in to comment.