Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev] 模仿qa的修改dpi功能,写了一小段java代码放到自己制作的模块里,但激活后不起作用 #1200

Open
2 tasks done
huajiworld opened this issue Sep 19, 2024 · 1 comment
Labels
dev development issues

Comments

@huajiworld
Copy link

描述 / Description

代码片段:

@Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {

        Class<?> CompatibilityInfo = XposedHelpers.findClass("android.content.res.CompatibilityInfo", XposedBridge.BOOTCLASSLOADER);
        Class<?> ActivityThread = XposedHelpers.findClass("android.app.ActivityThread", XposedBridge.BOOTCLASSLOADER);
        if (Build.VERSION.SDK_INT <= 31) {
            XposedHelpers.findAndHookMethod(
                    ActivityThread,
                    "handleConfigurationChanged",
                    Configuration.class,
                    CompatibilityInfo,
                    new XC_MethodHook(XCallback.PRIORITY_HIGHEST) {
                        @Override
                        protected void beforeHookedMethod(MethodHookParam p) throws Throwable {
                            Configuration config = (Configuration) p.args[0];
                            if (config != null) {
                                config.densityDpi=240;
                            }
                            
                        }
                    });
        } else {
            Class<?> ConfigurationController = XposedHelpers.findClass("android.app.ConfigurationController", XposedBridge.BOOTCLASSLOADER);
            XposedHelpers.findAndHookMethod(
                    ConfigurationController,
                    "handleConfigurationChanged",
                    Configuration.class,
                    CompatibilityInfo,
                    new XC_MethodHook(XCallback.PRIORITY_HIGHEST) {
                        @Override
                        protected void beforeHookedMethod(MethodHookParam p) throws Throwable {
                            Configuration config = (Configuration) p.args[0];
                            if (config != null) {
                                config.densityDpi = 240;
                            }
                            
                        }
                    });
        }
    }

LSP 日志里没有任何报错信息,模块正常加载,hook 的软件是自己写的 hello world,但是激活后不起作用,想请教一下这个 dpi 修改功能是怎么起作用的

其他要求 / Other Requirements

  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题。重复问题会被关闭。
  • 我知晓此 Issue 模板仅限开发者使用,普通用户请使用问题反馈或功能请求模板。 / I know this issue template is for developers only. Regular users should use the bug report or feature request template.
@huajiworld huajiworld added the dev development issues label Sep 19, 2024
@cinit
Copy link
Owner

cinit commented Sep 19, 2024

打 log 看一下修改前的 dpi 呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev development issues
Projects
None yet
Development

No branches or pull requests

2 participants