Skip to content

Commit

Permalink
CHANGELOG: Added in/out wifi and mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed May 2, 2024
1 parent 0df7b5f commit 4d90414
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 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.hookAllMethods;
import static de.robv.android.xposed.XposedBridge.log;
import static de.robv.android.xposed.XposedHelpers.callMethod;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
Expand All @@ -10,16 +11,20 @@

import android.content.Context;
import android.os.Build;
import android.view.View;
import android.widget.ImageView;

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;
import it.dhd.oxygencustomizer.xposed.utils.SystemUtils;

public class StatusbarIcons extends XposedMods {

private static final String TAG = "Oxygen Customizer - Statusbar Icons: ";
private final static String listenPackage = SYSTEM_UI;
private boolean hideBluetooth;
private boolean hideBluetooth, mHideWifiActivity = false, mHideMobileActivity = false;

public StatusbarIcons(Context context) {
super(context);
Expand All @@ -28,6 +33,8 @@ public StatusbarIcons(Context context) {
@Override
public void updatePrefs(String... Key) {
hideBluetooth = Xprefs.getBoolean("hide_bluetooth_when_disconnected", false);
mHideWifiActivity = Xprefs.getBoolean("hide_inout_wifi", false);
mHideMobileActivity = Xprefs.getBoolean("hide_inout_mobile", false);
}

@Override
Expand Down Expand Up @@ -60,7 +67,45 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});
} catch (Throwable t) {
log(this.getClass().getSimpleName() + " - Class Not Found " + t.toString());
log(TAG + "Class Not Found " + t.getMessage());
}

try {
Class<?> OplusStatusBarSignalPolicyExImpl;
try {
OplusStatusBarSignalPolicyExImpl = findClass("com.oplus.systemui.statusbar.phone.signal.OplusStatusBarSignalPolicyExImpl", lpparam.classLoader);
} catch (Throwable t) {
OplusStatusBarSignalPolicyExImpl = findClass("com.oplusos.systemui.statusbar.phone.StatusBarSignalPolicyEx", lpparam.classLoader);
}

hookAllMethods(OplusStatusBarSignalPolicyExImpl, "getWifiActivityId", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (mHideWifiActivity)
param.setResult(0);
}
});

} catch (Throwable t) {
log(TAG + " getWifiActivityId " + t.getMessage());
}

try {
Class<?> OplusStatusBarMobileViewExImpl = findClass("com.oplus.systemui.statusbar.phone.signal.OplusStatusBarMobileViewExImpl", lpparam.classLoader);
hookAllMethods(OplusStatusBarMobileViewExImpl, "updateState", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!mHideMobileActivity) return;
ImageView mDataActivity = (ImageView) getObjectField(param.thisObject, "mDataActivity");
mDataActivity.setVisibility(View.GONE);
ImageView mIn = (ImageView) getObjectField(param.thisObject, "mIn");
mIn.setVisibility(View.GONE);
ImageView mOut = (ImageView) getObjectField(param.thisObject, "mOut");
mOut.setVisibility(View.GONE);
}
});
} catch (Throwable t) {
log(TAG + " - Class Not Found " + t.toString());
}

}
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/xml/statusbar_icons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,23 @@

<SwitchPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="false"
android:title="@string/statusbar_icons_bluetooth_hide"
android:summary="@string/statusbar_icons_bluetooth_hide_summary"
android:key="hide_bluetooth_when_disconnected"/>

<SwitchPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="false"
android:title="@string/statusbar_icons_inout_wifi_hide_title"
android:summary="@string/statusbar_icons_inout_wifi_hide_summary"
android:key="hide_inout_wifi"/>

<SwitchPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="false"
android:title="@string/statusbar_icons_inout_mobile_hide_title"
android:summary="@string/statusbar_icons_inout_mobile_hide_summary"
android:key="hide_inout_mobile"/>

</PreferenceScreen>

0 comments on commit 4d90414

Please sign in to comment.