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

ci: PR检查时的自动化测试的最新API调整为34 #1310

Closed
wants to merge 1 commit into from

Conversation

shifujun
Copy link
Collaborator

本地测试通过。

@Heart-Beats
Copy link

大佬,API 33 上 PackageManager 多了一些方法,PackageManagerInvokeRedirect 中需要加上以下方法的实现,不然某些场景会报错:

    @TargetApi(Build.VERSION_CODES.TIRAMISU)
    public static PackageInfo getPackageInfo(ClassLoader classLoaderOfInvokeCode, String packageName,
                                             PackageManager.PackageInfoFlags flags) throws PackageManager.NameNotFoundException {
        return getPluginPackageManager(classLoaderOfInvokeCode).getPackageInfo(packageName, flags);
    }
    
        @TargetApi(Build.VERSION_CODES.TIRAMISU)
    public static PackageInfo getPackageInfo(ClassLoader classLoaderOfInvokeCode, VersionedPackage versionedPackage,
                                             PackageManager.PackageInfoFlags flags) throws PackageManager.NameNotFoundException {
        return getPluginPackageManager(classLoaderOfInvokeCode).getPackageInfo(versionedPackage.getPackageName(), flags);
    }

@shifujun
Copy link
Collaborator Author

大佬,API 33 上 PackageManager 多了一些方法,PackageManagerInvokeRedirect 中需要加上以下方法的实现,不然某些场景会报错:

    @TargetApi(Build.VERSION_CODES.TIRAMISU)
    public static PackageInfo getPackageInfo(ClassLoader classLoaderOfInvokeCode, String packageName,
                                             PackageManager.PackageInfoFlags flags) throws PackageManager.NameNotFoundException {
        return getPluginPackageManager(classLoaderOfInvokeCode).getPackageInfo(packageName, flags);
    }
    
        @TargetApi(Build.VERSION_CODES.TIRAMISU)
    public static PackageInfo getPackageInfo(ClassLoader classLoaderOfInvokeCode, VersionedPackage versionedPackage,
                                             PackageManager.PackageInfoFlags flags) throws PackageManager.NameNotFoundException {
        return getPluginPackageManager(classLoaderOfInvokeCode).getPackageInfo(versionedPackage.getPackageName(), flags);
    }

Shadow始终都没有实现所有该实现的方法。恐怕连API 16都没有完全支持。这是原理上造成的问题,我们应对方法就是动态化插件框架,随用随支持。所以我们的自动化测试只是测支持的方法。这个API 34看起来应该就是没有破坏我们已有的支持。所以会有这个PR。

至于你说的“某些场景会报错”,欢迎你在代码中补充自动化测试用例以表达这些场景,然后可以进一步提供支持代码。

@shifujun
Copy link
Collaborator Author

看起来34的虚拟机在CI上启动不太稳定,那就先算了。过一阵再说。

@shifujun shifujun closed this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants