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 · 9 comments
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 呢

@huajiworld
Copy link
Author

打 log 看一下修改前的 dpi 呢

----part 8 start----
[ 2024-09-20T16:41:24.333    10414: 32413: 32413 I/LSPosed-Bridge  ] Loading legacy module com.huajiworld.application2 from /data/app/~~pEkSezs78yQLciXyzr26lQ==/com.huajiworld.application2-uNI-00asBPqWftsxVlfi_g==/base.apk
[ 2024-09-20T16:41:24.336    10414: 32413: 32413 I/LSPosed-Bridge  ]   Loading class com.huajiworld.application2.HookInit
[ 2024-09-20T16:41:24.458    10414: 32413: 32413 I/LSPosed-Bridge  ] 原dpi480
[ 2024-09-20T16:41:24.468    10414: 32413: 32413 I/LSPosed-Bridge  ] 原dpi480
[ 2024-09-20T16:41:24.468    10414: 32413: 32413 I/LSPosed-Bridge  ] 目前dpi480

@huajiworld
Copy link
Author

打 log 看一下修改前的 dpi 呢

修改前和修改后没区别

@huajiworld
Copy link
Author

打 log 看一下修改前的 dpi 呢

大佬怎么不回我(

@cinit
Copy link
Owner

cinit commented Sep 23, 2024

@huajiworld 因为我也不知道哪里出问题了

@huajiworld
Copy link
Author

@huajiworld 因为我也不知道哪里出问题了

会不会是传统的 Xposed API 问题,要换个新的 API 才行?

@cinit
Copy link
Owner

cinit commented Sep 23, 2024

@huajiworld 不可能

@huajiworld
Copy link
Author

huajiworld commented Sep 24, 2024 via email

@cinit
Copy link
Owner

cinit commented Sep 24, 2024

qa 用的是什么 hook api 啊

@huajiworld Xposed API 51+ / libxposed API 100 / LSPlant

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