Skip to content

Commit

Permalink
XPosed Mods: Write logs properly to XPosed Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed May 2, 2023
1 parent 49c3653 commit d942b17
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static com.drdisagree.iconify.config.XPrefs.Xprefs;
import static com.drdisagree.iconify.xposed.HookRes.resparams;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
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 Down Expand Up @@ -362,7 +363,8 @@ public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam)
((FrameLayout.LayoutParams) status_bar_start_side_except_heads_up.getLayoutParams()).gravity = Gravity.START | Gravity.CENTER;
status_bar_start_side_except_heads_up.setGravity(Gravity.START | Gravity.CENTER);
status_bar_start_side_except_heads_up.requestLayout();
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
});
Expand Down Expand Up @@ -391,7 +393,8 @@ public void handleLayoutInflated(XC_LayoutInflated.LayoutInflatedParam liparam)
statusIconContainer.setPadding(paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom);

setStatusIconsBackgroundChip(statusIconContainer);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
}
Expand All @@ -414,7 +417,8 @@ public void handleLayoutInflated(LayoutInflatedParam liparam) {

setStatusIconsBackgroundChip(statusIconContainer);
}
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static com.drdisagree.iconify.config.XPrefs.Xprefs;
import static com.drdisagree.iconify.xposed.HookRes.resparams;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
import static de.robv.android.xposed.XposedBridge.log;
import static de.robv.android.xposed.XposedHelpers.findClass;
import static de.robv.android.xposed.XposedHelpers.getObjectField;

Expand Down Expand Up @@ -74,7 +75,8 @@ protected void afterHookedMethod(MethodHookParam param) {
mBatteryIconView.setRotation(landscapeBatteryRotation);
}
});
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
setLandscapeBatterySize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ private void loadImageOrGif(ImageView iv) {
((AnimatedImageDrawable) drawable).start();
}

} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.drdisagree.iconify.common.Const.PIXEL_LAUNCHER_PACKAGE;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
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.findClass;

Expand Down Expand Up @@ -64,7 +65,8 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
try {
callMethod(LauncherModel, "onAppIconChanged", BuildConfig.APPLICATION_ID, UserHandle.getUserHandleForUid(0));
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static com.drdisagree.iconify.common.Preferences.LSCLOCK_TOPMARGIN;
import static com.drdisagree.iconify.config.XPrefs.Xprefs;
import static com.drdisagree.iconify.xposed.HookRes.resparams;
import static de.robv.android.xposed.XposedBridge.log;

import android.annotation.SuppressLint;
import android.content.Context;
Expand All @@ -27,8 +28,8 @@
import android.widget.RelativeLayout;
import android.widget.TextClock;

import com.drdisagree.iconify.xposed.utils.SystemUtil;
import com.drdisagree.iconify.xposed.ModPack;
import com.drdisagree.iconify.xposed.utils.SystemUtil;

import java.io.File;
import java.util.Objects;
Expand Down Expand Up @@ -391,7 +392,8 @@ public void handleLayoutInflated(LayoutInflatedParam liparam) {
clockAdded = true;
}
});
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}

Expand All @@ -412,7 +414,8 @@ public void handleLayoutInflated(LayoutInflatedParam liparam) {
status_view_container.removeViewAt(0);
}
});
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}

Expand All @@ -436,7 +439,8 @@ public void handleLayoutInflated(LayoutInflatedParam liparam) {
status_view_media_container.getLayoutParams().width = 0;
}
});
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static com.drdisagree.iconify.xposed.utils.SettingsLibUtils.getColorAttrDefaultColor;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
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.findClass;
import static de.robv.android.xposed.XposedHelpers.findClassIfExists;
Expand Down Expand Up @@ -177,7 +178,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

} catch (Throwable ignored) { //QPR2&3
} catch (Throwable throwable) { //QPR2&3
//QPR3
Class<?> ShadeHeaderControllerClass = findClassIfExists("com.android.systemui.shade.ShadeHeaderController", lpparam.classLoader);
//QPR2
Expand Down Expand Up @@ -317,7 +318,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {

try {
mBehindColors = GradientColorsClass.newInstance();
} catch (Exception ignored) {
} catch (Throwable throwable) {
log(throwable);
}

hookAllMethods(ScrimControllerClass, "updateScrims", new XC_MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static com.drdisagree.iconify.config.XPrefs.Xprefs;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
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.getObjectField;
import static de.robv.android.xposed.XposedHelpers.setFloatField;
Expand Down Expand Up @@ -52,7 +53,8 @@ public void updatePrefs(String... Key) {
}

callMethod(paramThisObject, "updateScrims");
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
}
Expand All @@ -77,22 +79,26 @@ protected void afterHookedMethod(MethodHookParam param) {

try {
setFloatField(param.thisObject, "mDefaultScrimAlpha", alpha);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}

try {
setFloatField(param.thisObject, "mBehindAlpha", alpha);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}

try {
setFloatField(param.thisObject, "BUSY_SCRIM_ALPHA", alpha);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}

try {
setFloatField(param.thisObject, "mCustomScrimAlpha", alpha);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.drdisagree.iconify.xposed.HookRes.resparams;
import static de.robv.android.xposed.XposedBridge.hookAllConstructors;
import static de.robv.android.xposed.XposedBridge.hookAllMethods;
import static de.robv.android.xposed.XposedBridge.log;
import static de.robv.android.xposed.XposedHelpers.callStaticMethod;
import static de.robv.android.xposed.XposedHelpers.findClass;
import static de.robv.android.xposed.XposedHelpers.getObjectField;
Expand Down Expand Up @@ -134,7 +135,8 @@ protected void afterHookedMethod(MethodHookParam param) {
fixTileLayout(((LinearLayout) param.thisObject), mParam);

if (!isHideLabelActive) ((LinearLayout) param.thisObject).addView(newQSTile);
} catch (Throwable ignored) {
} catch (Throwable throwable) {
log(throwable);
}

if (QsTilePrimaryTextSize == null || QsTileSecondaryTextSize == null) {
Expand Down

0 comments on commit d942b17

Please sign in to comment.