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

三星note8 加载插件后,长按EditText无法弹出“复制、粘贴”等操作;其他机型正常 #365

Open
appsming opened this issue Dec 7, 2019 · 1 comment

Comments

@appsming
Copy link

appsming commented Dec 7, 2019

报错日志:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.wsecar.testvirtualapk, PID: 28893
java.lang.AbstractMethodError: abstract method "android.graphics.drawable.Drawable android.content.pm.PackageManager.loadItemIcon(android.content.pm.PackageItemInfo, android.content.pm.ApplicationInfo, boolean, int)"
at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:268)
at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:261)
at android.content.pm.ResolveInfo.loadIcon(ResolveInfo.java:274)
at android.widget.Editor$ProcessTextIntentActionsHandler.loadIcon(Editor.java:7314)
at android.widget.Editor$ProcessTextIntentActionsHandler.onInitializeMenu(Editor.java:7286)
at android.widget.Editor$TextActionModeCallback.onCreateActionMode(Editor.java:4182)
at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onCreateActionMode(DecorView.java:3040)
at com.android.internal.policy.DecorView.startActionMode(DecorView.java:1160)
at com.android.internal.policy.DecorView.startActionModeForChild(DecorView.java:1116)
at com.android.internal.policy.DecorView.startActionModeForChild(DecorView.java:1110)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:919)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:888)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:919)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:888)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:919)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:888)
at android.view.View.startActionMode(View.java:7110)
at android.widget.Editor.startSelectionActionModeInternal(Editor.java:2215)
at android.widget.SelectionActionModeHelper.startActionMode(SelectionActionModeHelper.java:163)
at android.widget.SelectionActionModeHelper.-android_widget_SelectionActionModeHelper-mthref-2(SelectionActionModeHelper.java:84)
at android.widget.-$Lambda$tTszxdFZ0V9nXhnBpPsqeBMO0fw$2.$m$0(Unknown Source:6)
at android.widget.-$Lambda$tTszxdFZ0V9nXhnBpPsqeBMO0fw$2.accept(Unknown Source:0)
at android.widget.SelectionActionModeHelper$TextClassificationAsyncTask.onPostExecute(SelectionActionModeHelper.java:375)
at android.widget.SelectionActionModeHelper$TextClassificationAsyncTask.onPostExecute(SelectionActionModeHelper.java:371)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

@ghost
Copy link

ghost commented Jul 22, 2020

LoadedPlugin的PluginPackageManager没有重写这个方法
在PluginPackageManager加上这几个方法:

    public Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo, boolean bb, int aa) {
        try {
            Method method = mHostPackageManager.getClass().getMethod("loadItemIcon", PackageItemInfo.class, ApplicationInfo.class, boolean.class, int.class);
            method.setAccessible(true);
            return (Drawable) method.invoke(mHostPackageManager, itemInfo, appInfo, bb, aa);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }


    public Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo) {
        try {
            Method method = mHostPackageManager.getClass().getMethod("loadItemIcon", PackageItemInfo.class, ApplicationInfo.class);
            method.setAccessible(true);
            return (Drawable) method.invoke(mHostPackageManager, itemInfo, appInfo);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

这个玩意确实很麻烦,PackageManager是个抽象类,而且有些abstract方法还是hide的,有些没重写到就会崩溃。。。。。

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

No branches or pull requests

1 participant