OutOfMemoryError crashes systemui when accessing Recent Apps only on Marshmallow

若如初见. 提交于 2019-12-13 05:25:12

问题


I'm working on an Android app that works well except when accessing the recent apps list on Android 6.0+. When I tap the recent apps button while my app is open, com.android.systemui will crash with the following stacktrace:

03-31 15:40:22.291 23442-23442/? E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
03-31 15:40:22.318 23442-23442/? E/MessageQueue-JNI: java.lang.OutOfMemoryError: Failed to allocate a 119596108 byte allocation with 16777216 free bytes and 57MB until OOM
                                                         at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                         at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                         at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                                         at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                                         at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                                         at android.content.res.Resources.loadDrawableForCookie(Resources.java:2598)
                                                         at android.content.res.Resources.loadDrawable(Resources.java:2503)
                                                         at android.content.res.Resources.getDrawable(Resources.java:806)
                                                         at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:836)
                                                         at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2069)
                                                         at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2049)
                                                         at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:155)
                                                         at android.content.pm.ComponentInfo.loadDefaultIcon(ComponentInfo.java:184)
                                                         at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2072)
                                                         at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2049)
                                                         at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:155)
                                                         at com.android.systemui.recents.misc.SystemServicesProxy.getActivityIcon(SystemServicesProxy.java:488)
                                                         at com.android.systemui.recents.model.RecentsTaskLoader.getAndUpdateActivityIcon(RecentsTaskLoader.java:407)
                                                         at com.android.systemui.recents.model.RecentsTaskLoadPlan.executePlan(RecentsTaskLoadPlan.java:238)
                                                         at com.android.systemui.recents.model.RecentsTaskLoader.loadTasks(RecentsTaskLoader.java:477)
                                                         at com.android.systemui.recents.Recents.preloadIcon(Recents.java:690)
                                                         at com.android.systemui.recents.Recents.preCacheThumbnailTransitionBitmapAsync(Recents.java:699)
                                                         at com.android.systemui.recents.Recents.preloadRecentsInternal(Recents.java:402)
                                                         at com.android.systemui.recents.Recents.preloadRecents(Recents.java:382)
                                                         at com.android.systemui.statusbar.BaseStatusBar.preloadRecents(BaseStatusBar.java:1139)
                                                         at com.android.systemui.statusbar.BaseStatusBar$7.onTouch(BaseStatusBar.java:1102)
                                                         at android.view.View.dispatchTouchEvent(View.java:9296)
                                                         at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                         at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                         at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                         at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                         at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                         at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                         at android.view.View.dispatchPointerEvent(View.java:9520)
                                                         at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4238)
                                                         at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4104)
                                                         at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                         at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
                                                         at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
                                                         at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3795)
                                                         at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
                                                         at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3852)
                                                         at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                         at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
                                                         at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
                                                         at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
                                                         at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                         at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5932)
                                                         at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5906)
                                                        at android.view.ViewRootImpl.enqueueInputEvent(Vie
03-31 15:40:22.321 23442-23442/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.android.systemui, PID: 23442
                                                   java.lang.OutOfMemoryError: Failed to allocate a 119596108 byte allocation with 16777216 free bytes and 57MB until OOM
                                                       at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                       at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                       at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                                       at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                                       at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                                       at android.content.res.Resources.loadDrawableForCookie(Resources.java:2598)
                                                       at android.content.res.Resources.loadDrawable(Resources.java:2503)
                                                       at android.content.res.Resources.getDrawable(Resources.java:806)
                                                       at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:836)
                                                       at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2069)
                                                       at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2049)
                                                       at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:155)
                                                       at android.content.pm.ComponentInfo.loadDefaultIcon(ComponentInfo.java:184)
                                                       at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2072)
                                                       at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2049)
                                                       at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:155)
                                                       at com.android.systemui.recents.misc.SystemServicesProxy.getActivityIcon(SystemServicesProxy.java:488)
                                                       at com.android.systemui.recents.model.RecentsTaskLoader.getAndUpdateActivityIcon(RecentsTaskLoader.java:407)
                                                       at com.android.systemui.recents.model.RecentsTaskLoadPlan.executePlan(RecentsTaskLoadPlan.java:238)
                                                       at com.android.systemui.recents.model.RecentsTaskLoader.loadTasks(RecentsTaskLoader.java:477)
                                                       at com.android.systemui.recents.Recents.preloadIcon(Recents.java:690)
                                                       at com.android.systemui.recents.Recents.preCacheThumbnailTransitionBitmapAsync(Recents.java:699)
                                                       at com.android.systemui.recents.Recents.preloadRecentsInternal(Recents.java:402)
                                                       at com.android.systemui.recents.Recents.preloadRecents(Recents.java:382)
                                                       at com.android.systemui.statusbar.BaseStatusBar.preloadRecents(BaseStatusBar.java:1139)
                                                       at com.android.systemui.statusbar.BaseStatusBar$7.onTouch(BaseStatusBar.java:1102)
                                                       at android.view.View.dispatchTouchEvent(View.java:9296)
                                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
                                                       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
                                                        at android.view.View.dispatchPointerEvent(View.java:9520)
                                                       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4238)
                                                       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4104)
                                                       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
                                                       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
                                                       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3795)
                                                       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
                                                       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3852)
                                                       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
                                                       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
                                                       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
                                                       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
                                                       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5932)
                                                       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.
0

Occasionally the recent apps list will successfully display, but there is a long lag between tapping the button and the list displaying. Attempting to scroll through recent apps is also very slow.

I'm not sure how to go about debugging this problem and I would appreciate any suggestions. Device monitor suggests that the system has plenty of memory to work with.

来源:https://stackoverflow.com/questions/36343634/outofmemoryerror-crashes-systemui-when-accessing-recent-apps-only-on-marshmallow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!