Skip to content

Commit

Permalink
Update MainHook
Browse files Browse the repository at this point in the history
  • Loading branch information
keta1 committed Apr 20, 2021
1 parent c55d47e commit f52c5c7
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/src/main/java/com/ketal/bcrfullscreen/MainHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@ public class MainHook implements IXposedHookLoadPackage {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals(lpparam.processName))
return;
String packageName = lpparam.packageName;
if (packageName.equals("com.bilibili.priconne")) {
XC_MethodHook hook = new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Activity act = (Activity) param.thisObject;
WindowManager.LayoutParams attributes = act.getWindow().getAttributes();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
act.getWindow().setAttributes(attributes);
}
if (!lpparam.packageName.equals("com.bilibili.priconne"))
return;
Class<?> actClass = lpparam.classLoader.loadClass("com.bilibili.priconne.MainActivity");
XposedBridge.hookMethod(actClass.getDeclaredMethod("onResume"), new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
Activity act = (Activity) param.thisObject;
WindowManager.LayoutParams attributes = act.getWindow().getAttributes();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
attributes.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
act.getWindow().setAttributes(attributes);
}
};
Class<?> actClass = lpparam.classLoader.loadClass("com.bilibili.priconne.MainActivity");
XposedBridge.hookMethod(actClass.getDeclaredMethod("onResume"), hook);
}
}
});
}
}

0 comments on commit f52c5c7

Please sign in to comment.