Xposed框架Inspeckage插件crash分析

异常信息:
E/AndroidRuntime(10336): Process: mobi.acpm.inspeckage, PID: 10336
E/AndroidRuntime(10336): java.lang.RuntimeException: Package manager has died
E/AndroidRuntime(10336):        at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:111)
E/AndroidRuntime(10336):        at mobi.acpm.inspeckage.util.PackageDetail.<init>(PackageDetail.java:44)
E/AndroidRuntime(10336):        at mobi.acpm.inspeckage.ui.MainFragment.loadSelectedApp(MainFragment.java:308)
E/AndroidRuntime(10336):        at mobi.acpm.inspeckage.ui.MainFragment.access$000(MainFragment.java:44)
E/AndroidRuntime(10336):        at mobi.acpm.inspeckage.ui.MainFragment$1.onChildClick(MainFragment.java:111)
E/AndroidRuntime(10336):        at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:716)
E/AndroidRuntime(10336):        at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:655)
E/AndroidRuntime(10336):        at android.widget.AbsListView$PerformClick.run(AbsListView.java:3053)
E/AndroidRuntime(10336):        at android.widget.AbsListView$3.run(AbsListView.java:3860)
E/AndroidRuntime(10336):        at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(10336):        at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(10336):        at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(10336):        at android.app.ActivityThread.main(ActivityThread.java:5305)
E/AndroidRuntime(10336):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10336):        at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(10336):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime(10336):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/AndroidRuntime(10336):        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
E/AndroidRuntime(10336): Caused by: android.os.TransactionTooLargeException
E/AndroidRuntime(10336):        at android.os.BinderProxy.transactNative(Native Method)
E/AndroidRuntime(10336):        at android.os.BinderProxy.transact(Binder.java:496)
E/AndroidRuntime(10336):        at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:1786)
E/AndroidRuntime(10336):        at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:106)
E/AndroidRuntime(10336):        ... 17 more
出问题代码:

包名:mobi.acpm.inspeckage.Module
类名:PackageDetail

mPInfo.activities = pm.getPackageInfo(app, PackageManager.GET_ACTIVITIES).activities;
分析结论:

造成 Binder crash 抛出 RuntimeException 是因为获取应用PackageInfo中数据量太大了,超出了Binder可传递的最大容量,进而导致PackageManager崩溃。

解决方案:
  • 如果只是用来判断APP是否存在,获取信息少(大小<1m)情况下不会异常
  • 直接获取activitys(淘宝、微信)目前只能通过解析AndroidManifest.xml获取(或者期待后续Binder机制更新吧)

你可能感兴趣的:(移动安全)