9

I am have problems with animations slowing down on many Android Samsung phones. I have traced the problem and it is too much garbage collection. However, none of the objects are being created directly by my code.

This is the stack trace from the Allocation Tracker in DDMS.

  at com.samsung.android.multiwindow.MultiWindowStyle$1.createFromParcel(MultiWindowStyle.java:493) 
  at com.samsung.android.multiwindow.MultiWindowStyle$1.createFromParcel(MultiWindowStyle.java:491) 
  at com.samsung.android.multiwindow.IMultiWindowFacade$Stub$Proxy.getMultiWindowStyle(IMultiWindowFacade.java:499) 
  at com.samsung.android.multiwindow.MultiWindowFacade.getMultiWindowStyle(MultiWindowFacade.java:81)   
  at android.app.Activity.getMultiWindowStyle(Activity.java:4681)   
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1688)    
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1264)  
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6614)    
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:813)  
  at android.view.Choreographer.doCallbacks(Choreographer.java:613) 
  at android.view.Choreographer.doFrame(Choreographer.java:583) 
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:799)   
  at android.os.Handler.handleCallback(Handler.java:733)    
  at android.os.Handler.dispatchMessage(Handler.java:95)    
  at android.os.Looper.loop(Looper.java:146)    
  at android.app.ActivityThread.main(ActivityThread.java:5678)  

This is creating thousands of Rect and Point objects when the user touches the screen.

Does anyone know of a work-around?

I am not targeting Samsung phones or using and of their sdks or libraries.

Brian White
  • 8,332
  • 2
  • 43
  • 67
theJosh
  • 2,894
  • 1
  • 28
  • 50
  • 2
    It looks like Samsung's Multi Window (Multitasking) support is activated. Maybe you can force your app to tell Samsung device to disable multi-window support for your app. Do not response to me..I am not familiar with Samsung Multi Window feature. see http://stackoverflow.com/questions/14111052/adding-multi-window-support-to-android-application – ecle Dec 01 '14 at 00:07
  • 1
    @theJosh, Have you learned anything further about this issue? – Tenfour04 Mar 27 '15 at 12:58
  • @Tenfour04 No I'm no closer. Samsung is my nemesis. – theJosh Mar 28 '15 at 17:24
  • Maybe you're leaking some UI views somewhere? Or using custom views that redraws it? Without code/application example it's just guessing – mente Apr 01 '15 at 06:49
  • Can you show the onTouch method? Or the method handling the input? – Robin Dijkhof Apr 02 '15 at 18:17

1 Answers1

0

Well, there is a design pattern comes into play which we use for situation like this, Called flyweight pattern. Not sure if this helps you if the client code is under your control , if it is , rather making the new objects, use the same object, with the properties of the object ( for example Rect will have x,y coordinates ) stored in the client object in an array , and call the draw method on the Rect object , passing the coordinates of the rect object stored in the array in the client.

Abhiram mishra
  • 1,597
  • 2
  • 14
  • 34